SRL Archive - OSR Help

Need help to stabilise my script


ogustuce

2013-01-03 21:52:10

basically the script work. but its unstable. the longer i've been able to run it is 1hour……

So what i need is:

good failsafe ideas.


i tried many different failsafes but they aren't always working.

the script is a urn maker. run bank to pottery and make urns.
it mostly fails when it have to walk to bank( SPS that clicks on the bank on MM) and when it walks to pottery (also when it click on the building on MM) but thwe bank problem is the one that happens the most.

If Someone is willing to help me, ill pm the script code.

thanks

xdarkshadowx

2013-01-04 01:44:03

If it gets lost, have it use a loadstone (if they still have those) to reorient itself? teleports are really the only definite locations you can end up at once the bot gets lost. You could also possibly slow down the walking procedure by double checking where it's at so it doesn't miss as often, but that might not help.

WT-Fakawi

2013-01-05 17:04:11

It is easier just to put the code here to make sure people will help you better.

ogustuce

2013-01-09 19:20:25

well here's the script. but it will get leeched =/ so i added some anti-leeches =p


program OgyUrn;

{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$i SPS\SPS.simba} {

var
ToPot:Tpoint;
SoftClay,UrnFired,UrnShaped,TripDone,CraftXp,Start,tries: Integer;


procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Number of Players to use
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; // Player to start with, first one is 0
Players[0].Name := 'xenophorme'; // Username
Players[0].Pass := 'flamboyantvoidnigga'; // Password
Players[0].Active := True; // just leave it as is.
Players[0].Pin := '3270'; // Bank Pin. Leave it if you don't have one.
Players[0].Integers[1] := 10000; // Number of loads
Players[0].Strings[0] := 'fishing'; // Urn skill to make <-------------------------------------------------------
//--> woodcutting,mining,smithing,prayer,fishing,cooking <--
end;

function ClayAmount(const row0, col1: Integer): Integer;
begin
Result := GetBankIndexItemAmount(BankPointToBankIndex(Point(0, 1)));
end;

Function UrnSkill:string;
begin
case (Players[CurrentPlayer].Strings[0]) of
'Mining','mining':
begin
Mousebox(22,113,87,123,mouse_left);
end;
'Woodcutting','woodcutting':
begin
Mousebox(25,159,119,167,mouse_left);
end;
'Fishing','fishing':
begin
Mousebox(25,101,90,107,mouse_left);
end;
'Cooking','cooking':
begin
Mousebox(25,84,85,92,mouse_left);
end;
'Smithing','smithing' :
begin
Mousebox(25,144,101,153,mouse_left);
end;
'Prayer','prayer':
begin
Mousebox(25,133,92,137,mouse_left);
end;
end;
end;

procedure AntiBan;
begin
writeln('Pick random');
case random(40) of



0 : begin
writeln('Random movement selected');
RandomMovement;
end;
1 : begin
writeln('Hover skill RC');
HoverSkill(skill_Runecrafting,false);
GameTab(25);
end;
2 : begin
writeln('Hover skill RC');
HoverSkill('random',false);
GameTab(25);
end;
3 : begin
writeln('Game Tab stats selected');
GameTab(23);
gametab(25);
end;
4 : begin
writeln('Random wait1 selected');
Wait(randomrange(1000,2000));
end;
5 : begin
writeln('Equip Tab selected');
GameTab(26);
Wait(RandomRange(1000,2000));
gametab(25);
end;

6 : begin
writeln('Friend List Tab selected');
GameTab(30);
Wait(RandomRange(2000,3000));
gametab(25);
end;
7 : begin
writeln('ClanChat Tab selected');
GameTab(32);
Wait(RandomRange(1000,3000));
gametab(25);
end; {

8: begin
writeln('Random wait2 selected');
Wait(randomrange(500,3000));
end;
end;
end;


Function PUrnAmount:boolean;
var
PottedUrn,C: Integer;
begin
PottedUrn := DTMFromString('mQwAAAHicY2ZgYMhmYmAoAeIkIE5kZGBIZoTQGgpCDNPzxBj2d0szyAHV8UMxIxIGAgDmoAWM');
C := CountItems('dtm', PottedUrn, []);
Result := (C >= 14);
FreeDtm(PottedUrn);
end;


Function FUrnAmount:boolean;
var
FiredUrn,C: Integer;
begin
FiredUrn := DTMFromString('mQwAAAHicY2ZgYHBiYmDwBWJzIJZkZGAQB2IxILY102RIDdRl2D4liEEOqI4fihmRMBAAAKnMBHQ=');
C := CountItems('dtm', FiredUrn, []);
Result := (C >= 14);
FreeDtm(FiredUrn);
end;


////FailSafe -> if it sees Oven DTM///
Function SeePot:Boolean;
var
x, y,Potter: integer;
aFound:extended;
begin
Potter:= DTMFromString('mggAAAHicY2NgYPgOxEyMDAyvoex/QPwBiFcA8SogXgnES4B4GRQf1pRhuB4pz7DdR4phtZkEww51aYbFSuIMRkA5bJgRB4YAAHGdEDE=');

if FindDTMRotated(Potter, x, y, MsX1, MsY1, MsX2, MsY2, -Pi/4, Pi/4, Pi/60, aFound) then
result := True;
begin
if not FindDTMRotated(Potter, x, y, MsX1, MsY1, MsX2, MsY2, -Pi/4, Pi/4, Pi/60, aFound) then
result := False
end;
FreeDTM(Potter);
end;
////////////////////////////////////////////////



//////Part of 'seeBank' failsafe///////////////
Procedure BankMap;

Begin
if (LoggedIn) then
begin
writeln('Dont see bank, trying again');
//for i:= 0 to 5 do
// case i of
case random(5) of

0: begin
writeln('try1');
ToPot := [Point(2300, 3323)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(1000,2000));
end;

1: begin
writeln('try2');
ToPot := [Point(2313, 3323)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(1000,2000));
end;
2: begin
writeln('try3');
ToPot := [Point(2290, 3322)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(1000,2000));
end;
{ 3: begin
writeln('try4');
InBank := DTMFromString('mKgEAAHic42NgYOBjZGAwAuLPQPZDIPYAsuOB+BiQfQWIbwKxN5DvC8QCQKwPxG8YIGyQ3HkgvgTEl4H4CRDfBeKTQHwNiE9A9R8HYiFGCG6uK2RwczJjcLI1Yti2fT0YJ0c5MeQlezIcO76PYcOGFXA6NcaZoau1nKGjuYxBDmgGPw4shwczkolRAQDB1SeP');
if FindDTM(InBank, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
mouse(5,5,x,y,Mouse_left);
wait(randomrange(1000,2000));
end;
FreeDtm(InBank);
end; }
3: begin
writeln('try5');
ToPot := [Point(2312, 3326)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(1000,2000));
end;
4: begin
writeln('try6');
ToPot := [Point(2301, 3327)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(1000,2000));
end;
5: begin
writeln('try7');
ToPot := [Point(2316, 3327)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(1000,2000));
end;

end;
End;
end;

///////////////////////////////////////////////////////////




////failsafe -> if it sees a DTM i made in the bank //////

Function SeeBank:Boolean;
Var
x,y,BankBooth: integer;
aFound:extended;
begin
BankBooth:= DTMFromString('mwQAAAHic42RgYOBmZGDgAWI5IP4H5P8FYlmoGAgLAnExEOci4RYgbgXiWiDOhMo311cyBHmZMfh7mILpiABrMJ2d6M5gY2XF0NJQyWAENJufAGYkAsMBAJcOED8=');
if FindDTMRotated(BankBooth, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
Result := True;
begin
BankBooth:= DTMFromString('mwQAAAHic42RgYOBmZGDgAWI5IP4H5P8FYlmoGAgLAnExEOci4RYgbgXiWiDOhMo311cyBHmZMfh7mILpiABrMJ2d6M5gY2XF0NJQyWAENJufAGYkAsMBAJcOED8=');
if not FindDTMRotated(BankBooth, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
result :=False;
end;
FreeDtm(BankBooth);
end;
//////////////////////////////////////////////////////////////////////


Function ClickBank: Boolean;

Var
x,y,BankBooth: integer;
aFound:extended;
begin
GameTab(25);
BankBooth:= DTMFromString('mwQAAAHic42RgYOBmZGDgAWI5IP4H5P8FYlmoGAgLAnExEOci4RYgbgXiWiDOhMo311cyBHmZMfh7mILpiABrMJ2d6M5gY2XF0NJQyWAENJufAGYkAsMBAJcOED8=');
if FindDTMRotated(BankBooth, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 5, 5, True);
wait(1000+random(250));

wait(250+random(150));
end;
FreeDtm(BankBooth);

end;

procedure Bank;
var
tryPin,Tries:integer;
begin
ClickBank;
wait(randomrange(1000,2000));
if not Bankscreen then
Waitfunc( @ClickBank ,1500 ,9000 );
If PinScreen then
begin
TryPin := 0;
repeat
InPin(Players[CurrentPlayer].Pin);
Inc(TryPin);
until BankScreen or (TryPin = 4) or not LoggedIn;
end;

if (Tries = 4) or (TryPin = 4) then
begin
ClosePinScreen;
LogOut;
Exit;
end;
if Bankscreen then
if not (InvEmpty) then
begin
DepositAll;
end;
SoftClay := GetBankItemAmount(1,0);
If (SoftClay < 50) then
begin
closeBank;
Logout;
TerminateScript;
end else
if Withdraw(1, 0, 28) then
wait(500+random(250));

closebank;
end;

////////FailSafe i tried but it works so so/////////

function PotGoodSpot: Boolean;
begin
if CountColorTolerance(8554120,MSx1,MSy1,MSx2,MSy2,6) > 3000 then
result := true;

if CountColorTolerance(8554120,MSx1,MSy1,MSx2,MSy2,6) < 3000 then
result := False;

end;

function BankGoodSpot: Boolean;
begin
if CountColorTolerance(11779003,MSx1,MSy1,MSx2,MSy2,10) > 20000 then
result := true;

if CountColorTolerance(11779003,MSx1,MSy1,MSx2,MSy2,10) < 20000 then
result := False;

end;

/////////////////////////////////////////////////////////////////////////


///////////to test the countColor//////////////
procedure yo;

begin
clearDebug;
if PotGoodSpot = true then
begin
writeln('shit true');
end else
writeln('shit false');
end;
////////////////////////////////////////


Procedure Go1;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(2250, 3316)];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,2500));
end;
End;



Function CrossLog: Boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i : Integer;
begin
FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,4552090,MSX1,MSY1,MSX2,MSY2,6);
if Length(MyTPA) = 0 then
FindColorsSpiralTolerance(MSCX,MSCY,MyTPA,4156559,MSX1,MSY1,MSX2,MSY2,6);
for i := 0 to High(MyTPA)do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['og Balanc', 'Log Balanc','Log Balance','cross','acros','Walk-acros','alk-acros'])) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
while IsMoving do
wait(500);
if findBlackChatMessage('ooting') then
begin
wait(randomrange(4000,5000));
end;
wait(randomrange(4000,5000));
exit;
end;
end;
end;

///////////////////////////////////////////////////
//// Custom map sps test section///////////////////

Procedure TGo1;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(244, 190)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
End;

Procedure TGo2;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(197, 224)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
End;
Procedure TBack1;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(226, 190)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
End;
Procedure TBack2;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(286, 197)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
End;

//////////////////////////////////////////////////////

Procedure Go2;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(2189, 3354)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
End;

Procedure Back1;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot:= [Point(2227, 3315)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,2500));
end;
End;

Procedure Back2;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(2301, 3325)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
End;

/////////SPS to use if you dont want to use the LogBalance//////

Procedure WalkingToPot;
Begin }
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(2265, 3353), Point(2261, 3413), Point(2249, 3477), Point(2206, 3445), Point(2184, 3401), Point(2190, 3366)];
SPS_WalkPath(ToPot1);
Wait(RandomRange(2000,3000));
end;
End;

Procedure WalkingToBank1;
Begin
if (LoggedIn) then
begin
IF RunEnergy(50) then
SetRun(true);
ToPot := [Point(2184, 3401), Point(2206, 3445),Point(2249, 3477), Point(2261, 3413),Point(2265, 3353), Point(2300, 3323)];
SPS_WalkPath(ToPot1);
Wait(RandomRange(1000,2000));
IncEx(TripDone,1);
end;
End;

//////////////////////////////////////////////////////////////////////////




//////Part of 'seepot' failsafe/////////////////////

Procedure PotMap;
Begin
if (LoggedIn) then
begin
writeln('Dont see pot, trying again');
case random(2) of
0: begin
writeln('try1');
ToPot := [ Point(2190, 3366)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
1: begin
writeln('try2');
ToPot := [Point(2191, 3356)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
2: begin
writeln('try3');
ToPot := [Point(2183, 3353)];
SPS_WalkToPos(ToPot);
Wait(RandomRange(2000,3000));
end;
end;
End;
end;
///////////////////////////////////////////////////////

Procedure MakeUrn;
var
x, y,Potter, Urnbutton: integer;
aFound:extended;
begin

Potter := DTMFromString('mlwAAAHicY2dgYHgGxE+B+DUQ34eyn0PFe4G4A4h7oHgiENcA8WwgzkpwB+OkSEeGnCQPMF6/fDlDQV42gwZQnh8HZsSDoQAAnCwTPQ==');

if FindDTMRotated(Potter, x, y, MsX1, MsY1, MsX2, MsY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 5, 5, True);
while IsMoving do

wait(500);

wait(randomrange(1500,2000));
end;

FreeDTM(Potter);

begin

Mousebox(22,42,230,56,mouse_left);
Wait(RandomRange(1000,1500));

UrnSkill;

Wait(RandomRange(500,700));

Wait(RandomRange(1000,1500));
end;
begin
UrnButton:= DTMFromString('mggAAAHicY2NgYAhlZGCQAuJ+IFYA4jpGiNhCIF4OxMuAeDoUTwVi9tQeBq7qVQxcNasZWA2dwJhNy4rBCGgWPxbMiANDAACXlwrq');

if FindDtm(UrnButton,x,y,MsX1, MsY1, MsX2, MsY2) then
begin
Mouse(x, y, 5, 5, True);
Wait(RandomRange(500,700));
AntiBan;
end;
FreeDTM(UrnButton);
end;
repeat
wait(1)
until PUrnAmount = true;
wait(randomrange(1000,2000));
incEx(UrnShaped,14);
incEx(CraftXp,532);
end;

Procedure FireUrn;
var
x, y,Oven, Firebutton,tries: integer;
aFound:extended;

begin

Oven := DTMFromString('mWAAAAHicY2FgYJAAYlEGCNAEYm4glgViJqhYa0s9w51oBYaiwlyGrMxUBiOgmBwSZkTDIAAALVAGfA==');


if FindDTMRotated(Oven, x, y, MsX1, MsY1, MsX2, MsY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 5, 5, True);
while IsMoving do
wait(500);
Wait(RandomRange(1500,2000));

end;

FreeDTM(Oven);
Wait(RandomRange(1000,1500));

begin

FireButton:= DTMFromString('mggAAAHicY2NgYAhlZGCQAuJ+IFYA4jpGiNhCIF4OxMuAeDoUTwVi9tQeBq7qVQxcNasZWA2dwJhNy4rBCGgWPxbMiANDAACXlwrq');

if FindDtm(FireButton,x,y,MsX1, MsY1, MsX2, MsY2) then
begin
Mouse(x, y, 5, 5, True);
Wait(RandomRange(500,700));
AntiBan;

end;

FreeDTM(FireButton);
end;
repeat
wait(1);
until FUrnAmount=True;

Wait(RandomRange(1000,2500));
incEx(UrnFired,14);
incEx(CraftXp,798);
end;

procedure Report;
var
ExpHr, TimeRan: integer;
begin;
ClearDebug;
TimeRan := (1+((GetSystemTime - Start) / 1000));
ExpHr := Round((CraftXp * 3600) / (GetTimeRunning / 1000));


writeln(' ');
writeln('-=]=-=[=OgyUrns=]=-=[=-')
writeln('| Runtime: ' + TimeRunning);
writeln('| Urn Shaped Made: ' + IntToStr(UrnShaped));
writeln('| Urn Fired: ' + IntToStr(UrnFired));
writeln('| SoftClay left: ' + IntToStr(SoftClay));
writeln('| XP: ' + IntToStr(CraftXp));
writeln('| XP/h: ' + IntToStr(ExpHr))
writeln('| TripeDone: ' + IntToStr(TripDone));
writeln('-=]=-=[=OgyUrns=]=-=[=-');
writeln(' ');
end;



begin
SRL_SixHourFix := True;
Smart_FixSpeed := True;
SetupSRL;
DeclarePlayers;
LogInPlayer;
SPS_Setup(RUNESCAPE_SURFACE,['5_8']);
//SPS_Setup(RUNESCAPE_OTHER,['ArdyB']);
ClickNorth(SRL_ANGLE_HIGH);

MarkTime(start);


repeat
logout;
terminatescript;
If TimeFromMark(Start) > 5000 then
Report;
if seebank = False then
Repeat
BankMap;
until seebank = True;
bank;
Go1;
CrossLog;
Go2;
if SeePot = False then
repeat
PotMap;
until SeePot = true;
makeurn;
fireurn;
back1;
CrossLog;
Back2
if Lobbyscreen then
begin
leaveLobby;
terminatescript;
end;
If (SoftClay < 50) then
Begin
Logout;
TerminateScript;
end;
until (false) or (not loggedin)



repeat
If TimeFromMark(Start) > 5000 then
Report;
if SeeBank = False then
Repeat
BankMap;
until SeeBank = True;
bank;
walkingtopot;
Wait(RandomRange(1000,2000));
if SeePot = False then
repeat
PotMap;
until SeePot = true;
makeurn;
fireurn;
walkingtobank1;
If (SoftClay < 50) or not (LoggedIn) then
Begin
Logout;
TerminateScript;
end;
until (false) }
end.