I Am Legend
12-04-2011, 10:41 AM
Help im trying to run this code
program spsTest;
{$DEFINE SMART}
{$i srl/srl.scar}
{$i sps/sps.simba}
var
t: integer;
myPath, bank: TPointArray;
x, y : integer;
procedure HandleBank;
var
B: TBox;
I, x, y: Integer;
begin
if not LoggedIn then Exit;
FindNonInventoryRandoms;
if not OpenBankFast('db') then
begin
if (FindSymbol(x, y, 'bank')) then
begin
Mouse(x, y, 1, 1, True);
Flag;
OpenBankFast('db');
end else Exit;
end;
Wait(300 + Random(50));
DepositAll;
CloseBank;
Wait(300 + Random(50));
FindNonInventoryRandoms;
end;
function openGate:boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i, DTM ,closed: Integer;
begin
writeln('low angle');
SetAngle(true);
MakeCompass('n');
DTM := DTMFromString('mWAAAAHicY2FgYHgNxB+h+BgQ7wTi+UBcAs Q7gDjS25ohLcyZIdrXhqEs2Y9BBCiGjBnRMAgAAG5tClk=');
if FindDTM(DTM,x, y,MSX1, MSY1, MSX2, MSY2 ) then
begin
writeln('found gate is open');
result := true;
FreeDTM(DTM);
Exit;
end;
SetAngle(false);
writeln(' gate is not open trying dtm method');
MakeCompass('n');
DTM := DTMFromString('mlwAAAHicY2dgYNCDYgkgdgJibSCOZYAAJS A2BGJNKAYBWSBWBGIzAy0GEz0NhsxINzDOjvZgSA1zYbAx1WPg Asrjwox4MBQAAN8gCEw=');
if FindDTM(DTM,x, y,MSX1, MSY1, MSX2, MSY2 ) then
begin
writeln('found gate is closed trying to open');
MMouse (x, y, 1, 1);
if (IsUpTextMultiCustom(['pen', 'ate'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
FreeDTM(DTM);
Exit;
end
end;
FreeDTM(DTM);
writeln('Failsafe Method - TPA ');
x := MSCx;
y := MSCy;
FindColorsSpiralTolerance(x, y, MyTPA, 2633525 , MSx1, MSy1, MSx2, MSy2, 15);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, 4544359 , MSX1, MSY1, MSX2, MSY2, 5);
for i := 0 to High(MyTPA) do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['pen', 'ate'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 1, 1, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
Exit;
end else if (IsUpTextMultiCustom(['lose', 'ate'])) then
result := true;
Wait(350+random(350));
end;
end;
function walktoGate : boolean;
begin
x := MMCX;
y := MMCY;
if FindColorSpiralTolerance(x,y,262904,MMX1, MMY1, MMX2, MMY2, 30) then
begin
Mouse(x, y, 1, 1, True);
Wait(1000); //Waits 2 seconds for the flag to appear on screen
FFlag(10);
result := true;
Exit;
end else if FindColorTolerance(x,y,9933187 ,MMX1, MMY1, MMX2, MMY2, 30) then
begin
if(RadialWalkTolerance(2897982 , 200,210,70,1,1,10)) then
result := true;
end;
if(RadialWalkTolerance(2897982,180,190,70,1,1,10)) then
result := true;
end;
procedure pickCabbage;
begin
x := MSCX;
y := MSCY;
if(not IsMoving) then
begin
if(FindColorSpiralTolerance(x, y, 6942403, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
MMouse(x,y, 4,4);
Wait(200 + Random(100));
if IsUpText('abbage') then
begin
Mouse(x, y, 0, 0, True);
wait(1000 + random(250));
end else
Writeln('Couldn''t find the uptext of the cabbage.');
end;
end;
end;
begin
smart_server := 1;
smart_members := false;
smart_signed := true;
smart_superDetail := false;
clearDebug();
setupSRL();
SPS_Debug := true;
SPS_Setup(RUNESCAPE_SURFACE, ['11_8','10_8','10_9']);
bank := [Point(4609, 3520), Point(4551, 3509), Point(4493, 3522), Point(4463, 3564), Point(4421, 3591), Point(4386, 3614), Point(4330, 3625), Point(4281, 3624), Point(4230, 3638), Point(4192, 3666)];;
myPath := bank;
invertTPA(myPath);
repeat
inc(t);
HandleBank;
if not InvFull then
begin
if (SPS_WalkPath(myPath)) then
writeLn(format('Walked to Cabbage farm', [t]));
walktoGate;
end;
if InvFull then
begin
if walktoGate then
begin
if OpenGate then
begin
if (SPS_WalkPath(bank)) then
writeLn(format('Walked to bank ', [t]));
end;
end;
end;
if not invFull then
begin
repeat
pickCabbage;
until InvFull;
end;
until(t = 50);
SPS_GetMyPos();
end.
But im getting this error
SRL Compiled in 15 msec
SMART Initialized.
Loaded: Server 1, Members: False, Signed: True, Super Detail: False.
Exception in Script: Failed to create new thread, code:8
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
I dont know whats wrong .
program spsTest;
{$DEFINE SMART}
{$i srl/srl.scar}
{$i sps/sps.simba}
var
t: integer;
myPath, bank: TPointArray;
x, y : integer;
procedure HandleBank;
var
B: TBox;
I, x, y: Integer;
begin
if not LoggedIn then Exit;
FindNonInventoryRandoms;
if not OpenBankFast('db') then
begin
if (FindSymbol(x, y, 'bank')) then
begin
Mouse(x, y, 1, 1, True);
Flag;
OpenBankFast('db');
end else Exit;
end;
Wait(300 + Random(50));
DepositAll;
CloseBank;
Wait(300 + Random(50));
FindNonInventoryRandoms;
end;
function openGate:boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i, DTM ,closed: Integer;
begin
writeln('low angle');
SetAngle(true);
MakeCompass('n');
DTM := DTMFromString('mWAAAAHicY2FgYHgNxB+h+BgQ7wTi+UBcAs Q7gDjS25ohLcyZIdrXhqEs2Y9BBCiGjBnRMAgAAG5tClk=');
if FindDTM(DTM,x, y,MSX1, MSY1, MSX2, MSY2 ) then
begin
writeln('found gate is open');
result := true;
FreeDTM(DTM);
Exit;
end;
SetAngle(false);
writeln(' gate is not open trying dtm method');
MakeCompass('n');
DTM := DTMFromString('mlwAAAHicY2dgYNCDYgkgdgJibSCOZYAAJS A2BGJNKAYBWSBWBGIzAy0GEz0NhsxINzDOjvZgSA1zYbAx1WPg Asrjwox4MBQAAN8gCEw=');
if FindDTM(DTM,x, y,MSX1, MSY1, MSX2, MSY2 ) then
begin
writeln('found gate is closed trying to open');
MMouse (x, y, 1, 1);
if (IsUpTextMultiCustom(['pen', 'ate'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
FreeDTM(DTM);
Exit;
end
end;
FreeDTM(DTM);
writeln('Failsafe Method - TPA ');
x := MSCx;
y := MSCy;
FindColorsSpiralTolerance(x, y, MyTPA, 2633525 , MSx1, MSy1, MSx2, MSy2, 15);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, 4544359 , MSX1, MSY1, MSX2, MSY2, 5);
for i := 0 to High(MyTPA) do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['pen', 'ate'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 1, 1, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
Exit;
end else if (IsUpTextMultiCustom(['lose', 'ate'])) then
result := true;
Wait(350+random(350));
end;
end;
function walktoGate : boolean;
begin
x := MMCX;
y := MMCY;
if FindColorSpiralTolerance(x,y,262904,MMX1, MMY1, MMX2, MMY2, 30) then
begin
Mouse(x, y, 1, 1, True);
Wait(1000); //Waits 2 seconds for the flag to appear on screen
FFlag(10);
result := true;
Exit;
end else if FindColorTolerance(x,y,9933187 ,MMX1, MMY1, MMX2, MMY2, 30) then
begin
if(RadialWalkTolerance(2897982 , 200,210,70,1,1,10)) then
result := true;
end;
if(RadialWalkTolerance(2897982,180,190,70,1,1,10)) then
result := true;
end;
procedure pickCabbage;
begin
x := MSCX;
y := MSCY;
if(not IsMoving) then
begin
if(FindColorSpiralTolerance(x, y, 6942403, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
MMouse(x,y, 4,4);
Wait(200 + Random(100));
if IsUpText('abbage') then
begin
Mouse(x, y, 0, 0, True);
wait(1000 + random(250));
end else
Writeln('Couldn''t find the uptext of the cabbage.');
end;
end;
end;
begin
smart_server := 1;
smart_members := false;
smart_signed := true;
smart_superDetail := false;
clearDebug();
setupSRL();
SPS_Debug := true;
SPS_Setup(RUNESCAPE_SURFACE, ['11_8','10_8','10_9']);
bank := [Point(4609, 3520), Point(4551, 3509), Point(4493, 3522), Point(4463, 3564), Point(4421, 3591), Point(4386, 3614), Point(4330, 3625), Point(4281, 3624), Point(4230, 3638), Point(4192, 3666)];;
myPath := bank;
invertTPA(myPath);
repeat
inc(t);
HandleBank;
if not InvFull then
begin
if (SPS_WalkPath(myPath)) then
writeLn(format('Walked to Cabbage farm', [t]));
walktoGate;
end;
if InvFull then
begin
if walktoGate then
begin
if OpenGate then
begin
if (SPS_WalkPath(bank)) then
writeLn(format('Walked to bank ', [t]));
end;
end;
end;
if not invFull then
begin
repeat
pickCabbage;
until InvFull;
end;
until(t = 50);
SPS_GetMyPos();
end.
But im getting this error
SRL Compiled in 15 msec
SMART Initialized.
Loaded: Server 1, Members: False, Signed: True, Super Detail: False.
Exception in Script: Failed to create new thread, code:8
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
I dont know whats wrong .