madoff
12-06-2012, 01:17 AM
I'm trying to write my first script but i've run into a problem. I can't seem to actually click on the ashes. I'd really like some guidance on a way to restart with a better overall approach, but if someone wants to offer some guidance about just fixing the code i've got, i'd appreciate that too.
program SRLSuperHeater;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$i sps/sps.simba}
Const
DoDebug = True; { Create Debug Info? }
var
x, y, T, B, loads: Integer;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Nick := 'ick'; // three lowercase letters in the middle of your name
BoxRewards := ['amp'];
LampSkill := SKILL_SMITHING;
Pin := '';
Active := True;
end;
end;
Procedure Debug(s:string);
Begin
if DoDebug then
Writeln(s);
end;
Procedure Antiban;
begin
case (Random(1000)) of
1: begin BoredHuman; PickupMouse; HoverSkill('Magic', False); end;
2: HoverSkill('Smithing', False);
3: ExamineInv;
4: begin PickupMouse; RandomRClick; end;
5: HoverSkill('Magic', False);
end;
if GetCurrentTab = tab_Inv then
Exit
else
GameTab(tab_Inv);
end;
Procedure LogIn;
begin
LoginPlayerToLob;
OpenWorldScreen;
SelectWorld(98);
LoginPlayer;
end;
Procedure WalkTo(p: Integer);
Var
To0:TPointArray;
To1:TPointArray;
To2:TPointArray;
To3:TPointArray;
To4:TPointArray;
To5:TPointArray;
begin
writeln('Walking to ');
writeln(p);
To0 := [Point(126, 147)];
To1 := [Point(124, 165)];
To2 := [Point(172, 165)];
To3 := [Point(206, 167)];
To4 := [Point(93, 168)];
To5 := [Point(60, 171)];
case p of
0:
begin
SPS_WalkPath(To0);
end ;
1:
begin
SPS_WalkPath(To1);
end;
2:
begin
SPS_WalkPath(To2);
end;
3:
begin
SPS_WalkPath(To3);
end;
4:
begin
SPS_WalkPath(To4);
end;
5:
begin
SPS_WalkPath(To5);
end;
end;
wait(1 + RandomRange(1000,1500));
AntiBan;
end;
Function AtBank:Boolean;
Begin
Wait(250+random(50));
if FindBank('vwb') then
begin
writeln('At the bank');
Result:=True;
end
else
begin
writeln('We are not at the bank Teleporting to varrock and walking there');
Result:=False;
end;
end;
Function FindBanker:Boolean;
var
tmpCTS, i, l, r, counter: integer;
BankerTPA:TPointArray;
begin tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.85, 1.15);
FindColorsTolerance(BankerTPA, 4140331, MSX1, MSY1, MSX2, MSY2, 10);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
L := High(BankerTPA)
marktime(counter);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(BankerTPA[r].x, BankerTPA[r].y, 2, 2);
if waituptext('Talk-to', 300) then
Break;
if timefrommark(counter) > 20000 then
begin
writeln('Failed to find the banker');
end;
end;
writeln('Found the banker');
clickmouse2(mouse_right);
wait(RandomRange(250,300));
ChooseOption('Bank Banker');
MarkTime(b);
repeat
wait(50+random(5));
until(BankScreen or (TimeFromMark(t)>20000)or PinScreen);
Result:=True
end;
Procedure OpenBanker;
Begin
MarkTime(t);
repeat
wait(randomrange(100,200));
if FindBanker then
Begin
MarkTime(b)
repeat
wait(100+random(5));
until(BankScreen or (TimeFromMark(t)>20000)or PinScreen);
end;
until(BankScreen or (TimeFromMark(t)>20000)or PinScreen );
end;
Function DepositAsh:Boolean;
begin
MarkTime(T);
OpenBanker;
if PinScreen then InPin(players[0].Pin);
if BankScreen then
begin
DepositAll;
wait(250+random(50));
CloseBank;
wait(500+random(50));
Result:= True;
writeln('Deposited ashes');
end else
Begin
Result:=False;
writeln('Failed to Deposit');
end
end;
function AshColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.49, 1.42);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 13817311, MSX1, MSY1, MSX2, MSY2, 8);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 53.93) and (X <= 79.15) and (Y >= 56.32) and (Y <= 81.59) and (Z >= 58.45) and (Z <= 86.44) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Procedure FindAshes;
var
Nx, Ny, C: Integer;
begin
Nx := MSCX
Ny := MSCY
while (True) do
begin
C := AshColor
if FindObjTPA(Nx,Ny, C, 10, -1, 60, 60, 100, ['Tak']) then
begin
Writeln('found a tree');
GetMousePos(Nx,Ny);
Wait(RandomRange(10,30));
Mouse(Nx,Ny,0,0,True);
Wait(RandomRange(400,600))
end else;
begin
Break;
end;
end;
end;
begin
ClearDebug;
ClearReport;
SetupSRL;
ActivateClient;
DeclarePlayers;
Wait(500 + Random(500));
if (not LoggedIn) then
LogIn;
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('N');
Debug('Just Set Up Player :)');
Wait(2000);
SPS_Setup(Runescape_Surface,['Beer_Map']);
Repeat
if not LoggedIn then LogIn;
if InvFull then
begin
WalkTo(1);
WalkTo(0);
DepositAsh;
AntiBan;
end;
while(not InvFull) do
begin
WalkTo(1);
FindAshes;
AntiBan;
WalkTo(2);
FindAshes;
WalkTo(3);
FindAshes;
AntiBan;
WalkTo(2);
FindAshes
WalkTo(1);
FindAshes;
WalkTo(4);
FindAshes;
AntiBan;
WalkTo(5);
FindAshes;
WalkTo(4);
FindAshes;
AntiBan;
WalkTo(1);
FindAshes;
end;
Until(false);
end.
program SRLSuperHeater;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$i sps/sps.simba}
Const
DoDebug = True; { Create Debug Info? }
var
x, y, T, B, loads: Integer;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Nick := 'ick'; // three lowercase letters in the middle of your name
BoxRewards := ['amp'];
LampSkill := SKILL_SMITHING;
Pin := '';
Active := True;
end;
end;
Procedure Debug(s:string);
Begin
if DoDebug then
Writeln(s);
end;
Procedure Antiban;
begin
case (Random(1000)) of
1: begin BoredHuman; PickupMouse; HoverSkill('Magic', False); end;
2: HoverSkill('Smithing', False);
3: ExamineInv;
4: begin PickupMouse; RandomRClick; end;
5: HoverSkill('Magic', False);
end;
if GetCurrentTab = tab_Inv then
Exit
else
GameTab(tab_Inv);
end;
Procedure LogIn;
begin
LoginPlayerToLob;
OpenWorldScreen;
SelectWorld(98);
LoginPlayer;
end;
Procedure WalkTo(p: Integer);
Var
To0:TPointArray;
To1:TPointArray;
To2:TPointArray;
To3:TPointArray;
To4:TPointArray;
To5:TPointArray;
begin
writeln('Walking to ');
writeln(p);
To0 := [Point(126, 147)];
To1 := [Point(124, 165)];
To2 := [Point(172, 165)];
To3 := [Point(206, 167)];
To4 := [Point(93, 168)];
To5 := [Point(60, 171)];
case p of
0:
begin
SPS_WalkPath(To0);
end ;
1:
begin
SPS_WalkPath(To1);
end;
2:
begin
SPS_WalkPath(To2);
end;
3:
begin
SPS_WalkPath(To3);
end;
4:
begin
SPS_WalkPath(To4);
end;
5:
begin
SPS_WalkPath(To5);
end;
end;
wait(1 + RandomRange(1000,1500));
AntiBan;
end;
Function AtBank:Boolean;
Begin
Wait(250+random(50));
if FindBank('vwb') then
begin
writeln('At the bank');
Result:=True;
end
else
begin
writeln('We are not at the bank Teleporting to varrock and walking there');
Result:=False;
end;
end;
Function FindBanker:Boolean;
var
tmpCTS, i, l, r, counter: integer;
BankerTPA:TPointArray;
begin tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.85, 1.15);
FindColorsTolerance(BankerTPA, 4140331, MSX1, MSY1, MSX2, MSY2, 10);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
L := High(BankerTPA)
marktime(counter);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(BankerTPA[r].x, BankerTPA[r].y, 2, 2);
if waituptext('Talk-to', 300) then
Break;
if timefrommark(counter) > 20000 then
begin
writeln('Failed to find the banker');
end;
end;
writeln('Found the banker');
clickmouse2(mouse_right);
wait(RandomRange(250,300));
ChooseOption('Bank Banker');
MarkTime(b);
repeat
wait(50+random(5));
until(BankScreen or (TimeFromMark(t)>20000)or PinScreen);
Result:=True
end;
Procedure OpenBanker;
Begin
MarkTime(t);
repeat
wait(randomrange(100,200));
if FindBanker then
Begin
MarkTime(b)
repeat
wait(100+random(5));
until(BankScreen or (TimeFromMark(t)>20000)or PinScreen);
end;
until(BankScreen or (TimeFromMark(t)>20000)or PinScreen );
end;
Function DepositAsh:Boolean;
begin
MarkTime(T);
OpenBanker;
if PinScreen then InPin(players[0].Pin);
if BankScreen then
begin
DepositAll;
wait(250+random(50));
CloseBank;
wait(500+random(50));
Result:= True;
writeln('Deposited ashes');
end else
Begin
Result:=False;
writeln('Failed to Deposit');
end
end;
function AshColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.49, 1.42);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 13817311, MSX1, MSY1, MSX2, MSY2, 8);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 53.93) and (X <= 79.15) and (Y >= 56.32) and (Y <= 81.59) and (Z >= 58.45) and (Z <= 86.44) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Procedure FindAshes;
var
Nx, Ny, C: Integer;
begin
Nx := MSCX
Ny := MSCY
while (True) do
begin
C := AshColor
if FindObjTPA(Nx,Ny, C, 10, -1, 60, 60, 100, ['Tak']) then
begin
Writeln('found a tree');
GetMousePos(Nx,Ny);
Wait(RandomRange(10,30));
Mouse(Nx,Ny,0,0,True);
Wait(RandomRange(400,600))
end else;
begin
Break;
end;
end;
end;
begin
ClearDebug;
ClearReport;
SetupSRL;
ActivateClient;
DeclarePlayers;
Wait(500 + Random(500));
if (not LoggedIn) then
LogIn;
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('N');
Debug('Just Set Up Player :)');
Wait(2000);
SPS_Setup(Runescape_Surface,['Beer_Map']);
Repeat
if not LoggedIn then LogIn;
if InvFull then
begin
WalkTo(1);
WalkTo(0);
DepositAsh;
AntiBan;
end;
while(not InvFull) do
begin
WalkTo(1);
FindAshes;
AntiBan;
WalkTo(2);
FindAshes;
WalkTo(3);
FindAshes;
AntiBan;
WalkTo(2);
FindAshes
WalkTo(1);
FindAshes;
WalkTo(4);
FindAshes;
AntiBan;
WalkTo(5);
FindAshes;
WalkTo(4);
FindAshes;
AntiBan;
WalkTo(1);
FindAshes;
end;
Until(false);
end.