I Am Legend
12-02-2011, 01:26 AM
Hi i have been having problems with this can someone tell me what method i should use to check if gate is open. Another problem is how i can place the character (walk to the gate ) if they are in certain parts of the map .
I attempted to do some of it , but its not workingproperly
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(false);
// DTM := DTMFromString('mlwAAAHicY2dgYHgIxJuBWICRgeEekP4KxK eh4vuBeB8Q7wLiuUB8DIrPAbGZgRaDjakeQ2qYC0N2tAdDZqQb GJvoaTDgAqxAzIgHQwEApfcQPA==');
DTM := DTMFromString('mwQAAAHicjcpBCkVgAEXha8g+TCj9ykOSko ENWADZCkZs4A2Yiz2+w+BNufUNbh1bUmdJPTLMaLFgQokYX7oB KzacGHFgx4Qqj9TUqfJPoNh4t+sXiVHouyoTXw7dE+uF/36x5A80');
if FindDTM(DTM,x, y,1, 1, 200, 200) then
begin
writeln('found');
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['pen', 'ate'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
Exit;
end else if (IsUpTextMultiCustom(['pen', 'ate'])) then
result := true;
end;
writeln('north and high angle');
MakeCompass('n');
SetAngle(true);
closed := DTMFromString('mQwAAAHicY2ZgYDgFxKeB+DgQTwXiIiDeAs RZkW4M4Z5WYMwF5MMwIxIGAgA+Owb5');
if FindDTM(closed,x, y,1, 1, 200, 200) then
begin
writeln('found');
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['lose', 'ate'])) then
begin
result := true;
Exit;
end;
writeln('not found');
{ x := MSCx;
y := MSCy;
FindColorsSpiralTolerance(x, y, MyTPA, 3159870 , MSx1, MSy1, MSx2, MSy2, 5);
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, 0, 0, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
Exit;
end else if (IsUpTextMultiCustom(['pen', 'ate'])) then
result := true;
Wait(350+random(350)); }
end;
end;
procedure walktoGate;
begin
x := MMCX;
y := MMCY;
if FindColorSpiralTolerance(x,y,262904,MMX1, MMY1, MMX2, MMY2, 10) then
begin
Mouse(x, y, 1, 1, True);
Wait(1000); //Waits 2 seconds for the flag to appear on screen
FFlag(10);
end else if FindColorTolerance(x,y,10260102,MMX1, MMY1, MMX2, MMY2, 5) then
RadialWalk(2897982 , 200,210,70,1,1)
else RadialWalk(2897982,180,190,70,1,1);
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']);
myPath := [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)];;
bank := myPath;
invertTPA(bank);
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
walktoGate;
end;
repeat
pickCabbage;
until InvFull;
until(t = 50);
SPS_GetMyPos();
end.
my code so far thanks
it picks cababge and banks in draynor
crap just realised i posted in wrong section .
I attempted to do some of it , but its not workingproperly
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(false);
// DTM := DTMFromString('mlwAAAHicY2dgYHgIxJuBWICRgeEekP4KxK eh4vuBeB8Q7wLiuUB8DIrPAbGZgRaDjakeQ2qYC0N2tAdDZqQb GJvoaTDgAqxAzIgHQwEApfcQPA==');
DTM := DTMFromString('mwQAAAHicjcpBCkVgAEXha8g+TCj9ykOSko ENWADZCkZs4A2Yiz2+w+BNufUNbh1bUmdJPTLMaLFgQokYX7oB KzacGHFgx4Qqj9TUqfJPoNh4t+sXiVHouyoTXw7dE+uF/36x5A80');
if FindDTM(DTM,x, y,1, 1, 200, 200) then
begin
writeln('found');
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['pen', 'ate'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
Exit;
end else if (IsUpTextMultiCustom(['pen', 'ate'])) then
result := true;
end;
writeln('north and high angle');
MakeCompass('n');
SetAngle(true);
closed := DTMFromString('mQwAAAHicY2ZgYDgFxKeB+DgQTwXiIiDeAs RZkW4M4Z5WYMwF5MMwIxIGAgA+Owb5');
if FindDTM(closed,x, y,1, 1, 200, 200) then
begin
writeln('found');
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['lose', 'ate'])) then
begin
result := true;
Exit;
end;
writeln('not found');
{ x := MSCx;
y := MSCy;
FindColorsSpiralTolerance(x, y, MyTPA, 3159870 , MSx1, MSy1, MSx2, MSy2, 5);
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, 0, 0, False);
ChooseOption('pen');
Wait(500+random(250));
result := true;
Exit;
end else if (IsUpTextMultiCustom(['pen', 'ate'])) then
result := true;
Wait(350+random(350)); }
end;
end;
procedure walktoGate;
begin
x := MMCX;
y := MMCY;
if FindColorSpiralTolerance(x,y,262904,MMX1, MMY1, MMX2, MMY2, 10) then
begin
Mouse(x, y, 1, 1, True);
Wait(1000); //Waits 2 seconds for the flag to appear on screen
FFlag(10);
end else if FindColorTolerance(x,y,10260102,MMX1, MMY1, MMX2, MMY2, 5) then
RadialWalk(2897982 , 200,210,70,1,1)
else RadialWalk(2897982,180,190,70,1,1);
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']);
myPath := [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)];;
bank := myPath;
invertTPA(bank);
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
walktoGate;
end;
repeat
pickCabbage;
until InvFull;
until(t = 50);
SPS_GetMyPos();
end.
my code so far thanks
it picks cababge and banks in draynor
crap just realised i posted in wrong section .