I Am Legend
2011-12-05 02:13:54
This script collects cabbage in lumbridge and banks in draynor
you can start at the cababge farm or bank, up to you.
Please suggest me improvements and bugs
:spot:
you can start at the cababge farm or bank, up to you.
Please suggest me improvements and bugs
:spot:
{ useless Script by I Am Legend , this script pics cabbage in lumbridge and banks them in draynor they 33 gp each OMG ! thats so much im going to be rich in no time !
The whole point of this script was to learn how to script so please dont flame, i have learned alot and those who i pissed off in IRC sorry :D , thanks to u guys i learned something
hoping to bring more scripts to the community will be working on Monsantry Raider next ( Monk killer )
Until then peace out }
program CabbageThis;
{$DEFINE SMART}
{$i srl/srl.scar}
{$i sps/sps.simba}
var
t: integer;
myPath, bank: TPointArray;
x, y : integer;
const
howManyRuns = 50; // how many runs
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Pin := '';
// Players[0].Load := 50;
Players[0].Active := true;
end;
//handles bank
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;
// opens gate to get cabbage
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+UBcAsQ7gDjS25ohLcyZIdrXhqEs2Y9BBCiGjBnRMAgAAG5tClk=');
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('mlwAAAHicY2dgYNCDYgkgdgJibSCOZYAAJSA2BGJNKAYBWSBWBGIzAy0GEz0NhsxINzDOjvZgSA1zYbAx1WOQA8rjwox4MBQAAPsECNg=');
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);
if(ChooseOption('pen')) then
result := true;
Wait(500+random(250));
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);
if(ChooseOption('pen')) then
result := true;
Wait(500+random(250));
result := true;
Exit;
end else if (IsUpTextMultiCustom(['lose', 'ate'])) then
result := true;
Wait(350+random(350));
end;
end;
// walks to the nearest gate - if sps works properly there shud be no problem
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;
if FindColorTolerance(x,y,9933187 ,MMX1, MMY1, MMX2, MMY2, 30) then
begin
if(RadialWalkTolerance(2897982 , 200,210,70,1,1,30)) then
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;
end else
if(RadialWalkTolerance(2897982,180,190,70,1,1,10)) then
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
end;
end;
// this procedure picks cabbage or not you decide
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;
// main function
begin
smart_server := 1;
smart_members := false;
smart_signed := true;
smart_superDetail := false;
clearDebug();
setupSRL();
DeclarePlayers;
if not loggedin then
loginplayer;
// SPS_Debug := true;
SPS_Setup(RUNESCAPE_SURFACE, ['11_8','10_8','10_9']);
bank := [Point(4196, 3665), Point(4235, 3641), Point(4285, 3622), Point(4329, 3609), Point(4386, 3598), Point(4446, 3596), Point(4462, 3551), Point(4510, 3521), Point(4562, 3500), Point(4611, 3522)];
myPath := [Point(4610, 3521), Point(4554, 3508), Point(4492, 3525), Point(4458, 3559), Point(4426, 3593), Point(4369, 3611), Point(4318, 3625), Point(4262, 3633), Point(4212, 3641), Point(4196, 3666)];
// invertTPA(myPath);
repeat
if (LoggedIn) then
begin
inc(t);
HandleBank;
if not InvFull then
begin
if (SPS_WalkPath(bank)) then
writeLn(format('Walked to Cabbage farm', [t]));
if walktoGate then
if OpenGate then
begin
writeln('opened gate after coming from bank');
end;
end;
if InvFull then
begin
if walktoGate then
begin
if OpenGate then
begin
if (SPS_WalkPath(myPath)) then
writeLn(format('Walked to bank ', [t]));
end;
end;
end;
if not invFull then
begin
repeat
pickCabbage;
until InvFull;
end;
end;
until(t = howManyRuns);
SPS_GetMyPos();
end.