SRL Archive - OSR Help

Compiling error when using ObjectDTM + Paintsmart


J J

2012-04-05 17:33:50

Hi,

I've nearly finished my cooking script. I just added an onscreen progress report because it looks neat, but apparantly using ObjectDTM + Paintsmart gives me an error. I have no idea what's wrong with my code. If I comment {$i SRL/SRL/misc/paintsmart.simba} or {$i ObjectDTM/ObjDTMInclude.simba} out the script will compile but using both of them doesn't seem to work.

Here is the full script:

program Script;
{$DEFINE SMART}
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
{$i SRL/SRL/misc/paintsmart.simba}
{$i ObjectDTM/ObjDTMInclude.simba}

var
StartTime, BurnedLogs, CookedFish, FishXp, LogXp, Pincode: integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
{ Fill this in with your details }
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
{
Be sure to fill in the correct values for your logs/fishes!

Common firemaking xp rates
Normal logs: 40
Oak logs: 60
Willow logs: 90
Maple logs: 135
Yew logs: 202,5
Magic logs: 303,5

Common cooking xp rates
Trout: 70
Salmon: 90
Lobster: 120
Swordfish: 140
Monkfish: 160
Shark: 200
Rocktail: 225
}

LogXp := 60; {Replace 60 with your Firemaking xp value}
FishXp := 70; {Replace 80 with your Cooking xp value}
end;

procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
StartTime:=GetSystemTime;
Wait(2000 + Random(2000));
ClickNorth(0);
end;

procedure OnScreenProggy;
var
FmXp, CookXp, FmXpRate, CookXpRate, Sec: Integer;
FmXp2, CookXp2: String;

begin
{ OnScreenProggy handles the progress report painted on SMART }
Sec := (1+((GetSystemTime-StartTime)/1000));
FmXp := ((LogXp*BurnedLogs)/(Sec));
CookXp := ((FishXp*CookedFish)/(Sec));
FmXpRate := ((3600*(FmXp))/(Sec));
CookXpRate := ((3600*(CookXp))/(Sec));

CookXp2 := 'Cooked '+IntToStr(CookedFish)+' fishes for '+IntToStr(CookXp)+' cooking xp at '+IntToStr(CookXpRate)+' per hour';
FmXp2 := 'Burned '+IntToStr(BurnedLogs)+' logs for '+IntToStr(FmXp)+' firemaking xp at '+IntToStr(FmXpRate)+' per hour'

SMART_ClearCanvas;
SMART_DrawText(5, 303, UpCharsEx, CookXp2, clYellow);
SMART_DrawText(5, 320, UpCharsEx, FmXp2, clYellow);
end;

procedure Banking;
var
arP: TPointArray;
ararP: T2DPointArray;
i, arL, X, Y: Integer;
P: TPoint;

begin
{ Detects the banker }
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.56);
FindColorsTolerance(arP, 5779774, MSX1, MSY1, MSX2, MSY2, 11);
SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arP, 20, 20);
arL := High(ararP);
for i := 0 to arL do
begin
{ Banks via the banker }
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(25 + Random(25));
if WaitUpTextMulti(['Talk', 'alk', 'k-to'], 150) then
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, 0);
if WaitOptionMulti(['Bank '], 150) then
Wait(600 + Random(600));
if(PinScreen) then
InPin(Players[0].Pin);
if BankScreen then
begin;
{ Deposits everything in the inventory }
Mousebox(352, 297, 385, 320, 1);
Wait(200 + Random(200));
{ Withdraws logs and raw food }
Mousebox(38, 92, 73, 123, 1);
WriteLn('Withdrawed logs');
Wait(200 + Random(200));
Mousebox(82, 92, 117, 123, 0);
if WaitOptionMulti(['All', 'Withdraw-All'], 150) then
WriteLn('Withdrawed raw food');
Wait(200 + Random(200));
Exit;
end;
end;
end;

procedure MakeFire;
var
X, Y, Logs: Integer;
PBox: TBox;

begin;
{ Walking to a firemaking spot }
ObjDTM_Walk('82:63:5:1:7:36:84:1:7:62:41:3:7:117:55:10:7:71:78:10:7:113:75', 1, 80, 200, True);
Wait(500 + Random(500));
if GetCurrentTab = (tab_Inv) then
begin
WriteLn('Current tab is the inventory tab, correct')
end else
begin
FTab(tab_Inv);
WriteLn('Changed tabs to the inventory tab')
end;
{ Failsafe when standing on a fire }
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 0.62);
if FindColorSpiralTolerance(X, Y, 536379, 244, 159, 276, 193, 3) then
{ Standing in a fire, moving }
begin;
MouseBox(211, 99, 318, 161, 1);
Wait(400 + Random(200));
end else
{ Light a log }
Logs := DTMFromString('mAAEAAHiclcvBCkBAFIXhY9aewjNIyUISK5Pm8SeUhbJB3oC/WFiaW9+pU+fGkmojVciRIX2V6OBg0aLBws+AEbOevuPEhhUTPA70RUJGv11Ba8kE7r93A1hgD7U=');
if FindDTM(Logs, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
MMouse(X, Y, 2, 2);
Mouse(X, Y, 0, 0, 0);
WaitOptionMulti(['ight', 'Light'], 150);
Inc(BurnedLogs);
end;
FreeDTM(Logs);
{ Check for fire animation }
PBox := IntToBox(282, 145, 320, 195);
repeat
Wait(100 + Random(100));
//Antiban; //Still have to add this
Wait(100 + Random(100));
until Animating(PBox, 100, 200);
Wait(150 + Random(150));
end;

procedure StartCooking;
var
X, Y, i, arL: Integer;
arP: TPointArray;
ararP: T2DPointArray;
P: TPoint;

begin;
{ Find fire coordinates }
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 0.62);
FindColorsSpiralTolerance(X, Y, arP, 536379, 279, 158, 318, 195, 3);
SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arP, 20, 20);
arL := High(ararP);
for i := 0 to arL do
begin
P := MiddleTPA(ararP[i]);
case Random(9) of
0..4: MouseBox(605, 213, 640, 244, 1);
5..7: MouseBox(605, 249, 640, 280, 1);
8: MouseBox(563, 249, 598, 280, 1);
end;
MMouse(P.x, P.y, 5, 5);
Exit;
end;
end;

procedure Cooking;
var
X, Y, t: Integer;

begin;
{ Start cooking all the food }
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, 1);
Wait(500 + Random(300));
MouseBox(222, 397, 302, 466, 1);

{ Mark the time to know when the inventory has been cooked }
MarkTime(t);
repeat
Wait(100 + Random(100));
//Antiban; //Still have to add this
Wait(100 + Random(100));
until TimeFromMark(t) >= RandomRange(63000, 66000);

{ If the inventory has been cooked, walk back to the banker }
Inc(CookedFish);
ObjDTM_Walk('81:102:5:3:7:122:75:1:7:62:58:1:7:31:105:10:7:117:96:10:7:70:117', 3, 80, 200, True);
Wait(200 + Random(200));

end;

begin
SetupSRL;
ActivateClient;
ObjDTM_Setup;
repeat
OnScreenProggy;
Banking;
MakeFire;
StartCooking;
Cooking;
until not(LoggedIn);
end.

Thanks in advance.

Abu

2012-04-05 17:38:09

You don't need to include Paintsmart, {$DEFINE SMART} does it for you


EDIT: Just tested, it should compile now

J J

2012-04-05 17:42:58

From: abu_jwka
You don't need to include Paintsmart, {$DEFINE SMART} does it for you


EDIT: Just tested, it should compile now

Yes I just tested it aswell, it runs now how it should run. Forgot to add SetupLogin at the end though but I just fixed that and the script does what I wanted it to do. Thanks :) Will add the finishing touch tomorrow, a light antiban and some more failsafes :P Possibly increasing the speed a bit.

EDIT: I copied it off another script of mine and it didn't gave any problems in that script. Pretty weird. But yeah it works now :)

euphemism

2012-04-05 20:02:47

From: abu_jwka
You don't need to include Paintsmart, {$DEFINE SMART} does it for you


EDIT: Just tested, it should compile now


Incorrect. The Object DTM Include includes PaintSmart within it. If you include both paintsmart and the include, you will get a compiling error. Straight from my tutorial on how to use Object DTMS:

The Object DTM Include will automatically include the PaintSmart file, used to paint on the SMART canvas. If for some reason you want it included in your script anyway, your include statements will have to look like this:


program Script;
{$DEFINE SMART}
{$DEFINE PAINT}
{$i SRL\SRL.simba}
{$i SRL\SRL\Misc\PaintSmart.simba}
{$i ObjectDTM\ObjDTMInclude.simba}