SRL Archive - Help and Support

Having Issue's Breakng out of a Loop? Help


Sir Ducksworthy

2012-05-07 17:53:23

Ok guy's I've scripted this Zammy Wine Grabber and Banker and I am unable to break out of the Grabbing Loop, It teleports etc then just keeps grabbing I have looked through it a fair bit n I can find this lil bug

program LeetzSxcZwineCollector;
{$DEFINE SMART}
{$i SRL/srl.simba}
{$I SRL/SRL/misc/debug.simba}
{$i sps/sps.simba}

const
//////////////////////////////////////////IMPORTANT!!IMPORTANT!!IMPORTANT!!IMORTANT\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//Welcome to LeetzSxcHideTanner by Leetsxc, Please review the STEPS below and complete which are required before starting the script.\\
// \\ // \\
//////////////////////////////Start of $etup////////////////////////////////////
SERVER = 85; // Enter "0" to pick a random server. STEP // //
MEMBER = False; //False if F2P True for P2P affects spell book STEP // //
NumbOfPlayers = 1; // \\ // //
StartPlayer = 0; // \\ // //
/////BREAKING SETUP\\\\\ // //
UseBreaks = True; //Do you want to take breaks? STEP \\ // //
SwitchWorld = False;//Do you want to switch worlds after the break? STEP \\ //
BreakIn = 290; //How many minutes until you take a break? STEP \\ // //
BreakInRandom = 10; //How many minutes should the "BreakIn" time be varied by? STEP \\ \\
BreakFor = 7; //How many minutes will you break for? \\\ \\ //
BreakForRandom = 7;//How many minutes should the "BreakFor" time be varied by? //\\ \\
///END OF BREAKING SETUP\\\


{ sxcsxcsxcsxcsxcsxsxcsxcsxcsxcsxcsxccsxcsxcsxcsxcsxcsxc
**Zammy Wine Collecting Styles**
sxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxc
Play around with these, I have made different methods
of Collecting the wine, Some are faster such as UseMi-
niMapDot.. I believe it appears before the item shows
up maybe 30 ms.........}
UseCountColor = True;
UseMiniMapDot = False; {Use the MiniMap Red Item
dot apearance to iniate clicks this is a faster opt-
ion XD}
UseSpawnTimeAvg = False;{Using the Spawn Time Aver-
age}
SpawnTimeAvg = 25150;// Seems to be optimum

{ sxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxc
**MOUSE SETTINGS**
sxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxc
Tweak your click times to maximum speed to send the p-
acket quicker, when you release your mouse is when it
actually click Grabs wine... }
UseSxcMouse = true; {This is an altered version
of Click Mouse 2}
Mouse_Settings_Hold_Time = 2; {How Long to Hold your
mouse for this is * by 3..4 }
Mouse_Settings_Hold_Offset = 1; //Offset of hold time
Stealth_Mode = False;{Stealthy Zammy Grabbing go
Good for Anti-ban It is losing in speed tho.. wit
the faster noobs around}

Trial_Member = False; //Trial Member Account or not? For the stupid message on start-up. \\
Profit = 1802; //Calculate your profit per Wine Grabbed through G.E and change it \/\/ //
//^^\\
///End of LeetzSxcArrowShafter Setup\\\ STEP 15 \\vv//
var //\/\\
Memberz, ZamWine, posx, posy, StartTime, AntiBans, Grabs, x, y, breaktimer, BreaksTaken: integer;
Walked,ColorComboDetected:boolean;
MyPos: Tpoint;
aFound:Extended;

procedure DeclarePlayers;
var
i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
begin
Players[i].BoxRewards := ['amp'];
Players[i].LampSkill := 13;
end;
With Players[0] do
begin
Name := ''; //Username. STEP 16
Pass := ''; //Password. STEP 17
Active := True;
end;
{ With Players[1] do //For more players uncomment the {'s at top left and bottem right
begin
Name := ''; //Username.
Pass := ''; //Password.
Active := True;
end; }
end;
////////////////////////////// End of Setup////////////////////////////////////

procedure Proggy;
var
GrabRate,Sec:integer;
begin
Sec:=(1+((Getsystemtime-StartTime)/1000));
GrabRate:=(3600*(Grabs))/(Sec);
Writeln('**/*/*/*/*/*/*/*/*/*/*\*\*\*\*\*\*\*\*\*\**');
Writeln(' $$$$$$$$$LeetzSxcZwineCollector$$$$$$$$$$');
Writeln(' Time Running: ' + TimeRunning);
Writeln(' Profit Gained: ' + IntToStr(Grabs*Profit) + ' GP');
Writeln(' Profit Per Hour: ' + IntToStr(GrabRate*Profit) + ' GP');
Writeln(' Z Wines Grabbed: ' + IntToStr(Grabs));
Writeln(' Z Wines Grabbed Per Hour: ' + IntToStr(GrabRate));
Writeln(' Anti-Bans Performed: ' + IntToStr(AntiBans));
Writeln('**\*\*\*\*\*\*\*\*\*\*/*/*/*/*/*/*/*/*/*/**');
end;

(*
ClickMouse2SXC
~~~~~~~~~~~

.. code-block:: pascal

procedure ClickMouse2(button: variant);

Clicks the mouse in a human way on the current mouse spot.

.. note::

by SRL Community

Example:

.. code-block:: pascal

################################################################
#.>.<.Edited a little bit by me for the script's efficieny.>.<.#
################################################################

*)
procedure ClickMouse2SXC;
var
a,b,c : integer;
begin
{ Eventually, should be made to just use Integers }
GetMousePos(b, c);
HoldMouse(b, c, mouse_left);
repeat
Wait(Mouse_Settings_Hold_Time + Random(Mouse_Settings_Hold_Offset));
a := a + 1;
until (a > 4);
GetMousePos(b, c);
ReleaseMouse(b, c, mouse_left);
Wait(50+Random(50));
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
exit;
_FindAllRandoms(false);
Case Random (2500) of
0..18: Begin
SleepAndMoveMouse(1000 + Random(1750));
AntiBans:=AntiBans+1;
End;
19..24: Begin
GameTab(tab_Inv);
ExamineInv;
SleepAndMoveMouse(600 + Random(1553));
AntiBans:=AntiBans+1;
End;
55..65: Begin
PickUpMouse;
AntiBans:=AntiBans+1;
End;
66..120: Begin
RandomMovement;
AntiBans:=AntiBans+1;
End;
121..124: Begin
BoredHuman;
AntiBans:=AntiBans+1;
End;
End;
end;

function FindTpa(HueModifier, SatModifier:TExtendedArray; Color, Tol, ColorCombo:TIntegerArray; Length1, Length2, xx1, yy1, xx2, yy2, RaastaSplitDistance, Shortness, UpWait:Integer; Text, Option:TstringArray; ClickType, Raasta, RandomClicking, MakeShort:Boolean): Boolean;
var
Probability, ArrayLength, CTS, I,II: Integer;
TPA,StoreTPA: TPointArray;
ATPA: Array of TPointArray;
Uptextfound:boolean;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
For i := 0 to High(Color) do
begin
SetColorSpeed2Modifiers(HueModifier[i], SatModifier[i]);
if(FindColorsSpiralTolerance(x, y, StoreTPA, Color[i], xx1, yy1, xx2, yy2, Tol[i]))then
begin
if(Raasta)then
RAaSTPA(StoreTPA, RaastaSplitDistance);
//Splitting Points once per Color Works best Because you have a higher probability of finding something with 2 colors on the same Area within a range
TPA := TPA+StoreTPA;
StoreTPA:=[];
end else
{*Color Combinations if we do not find for example the red on a chicken or the yellow on the feet inside a TPA it lowers the probability that the rest of the colors relate to a chicken and more likely
A hay bale or something this allows me to very accurately find Creatures or people or basically any item its sort of like TPA DTM Detection*}
For II:=0 to High(ColorCombo) do
if(i=ColorCombo[II])then
begin
Probability:=Probability+1;
if(Probability>=High(ColorCombo))then
begin
ColorComboDetected:=False;
Writeln('Didnt Find any Probable Color Combinations Exiting');
Exit;
end else
ColorComboDetected:=True;
break;
end;
end;
ATPA := TPAToATPA(TPA, Length1);
SortATPAFromSize(ATPA, Length2, true);
ColorToleranceSpeed(CTS);
DebugATPABounds(ATPA);
if(MakeShort)then
ArrayLength:=Shortness
else
ArrayLength:=High(ATPA);
For I := 0 to ArrayLength do
begin
Try
MiddleTPAEx(ATPA[i], x, y);
Except
//writeln('Something fucked up with middleTPAEx');
End;
mousespeed:=Randomrange(10,27);
MMouse(x, y, 0, 0);
mousespeed:=Randomrange(10,27);
GetMousePos(x, y);
For II := 0 to High(Text) do
If(WaitUpText(Text[II],UpWait-(II*UpWait)))then
begin
Uptextfound:=true;
break;
end;
if(Uptextfound)then
begin
if(RandomClicking)then
begin
Case Random(9) of
0..2: begin //**30% Right Click Chance**\\
Mouse(x,y,0,0,false);
if(WaitoptionMulti(Option, 200))then
begin
Result := True;
Break;
end;
end;
3..9: begin //**70% Left Click Chance**\\
Mouse(x,y,0,0,True);
Result := True;
Break;
end;
END;
end else
begin
Mouse(x,y,0,0,ClickType);
if(ClickType=False)then
begin
if(WaitoptionMulti(Option, 200))then
begin
Result := True;
Break;
end;
Uptextfound:=false;
end else
begin
Result := True;
break;
end;
end;
end;
end;
end;

procedure FailSafe;
begin
if(not( (FindNormalRandoms()) or (Findnoninventoryrandoms()) ))then
begin
writeln('We have been trying to Find something and walk to something for over 60 seconds on the Last Walk Points, their is no random and their is no random so to prevent us from looking like a stupid bot we are going to log out and terminate script');
LogOut;
TerminateScript;
end;
end;

{*
#############################################################################################
*********SPS_WalkToPos, by Leetsxc**********
#############################################################################################
Made from Orginal SPS_WalkToPos function
- Walks to position, P.

FEATURES
- Break's from loop when Distance from flag has been reached
- Will Randomly Select Run if Below a Random Percentage of 20-40 Energy Level
- No Longer uses Flag as it was to unreliable and would get you stuck in infinite Wait Loops
- Uses a Random Sleep and Move Mouse while waiting to reach specified Flag distance
- Tracks Energy Percentage to see if it has decreased, if it hasn't it will enable run
sxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxc
*}
function SPS_WalkToPosSXC(P: TPoint; Distance:integer): boolean;
var
s:string;
Time, EnergyPercentage:integer;
MM: TPoint;
begin
if not LoggedIn then
Exit;
EnergyPercentage:=GetMMLevels('run', s);
if(Random(10) < 5)then
if(not(FindcolorTolerance(x, y, 6740716, 714, 99, 734, 118, 4)))then
if(EnergyPercentage > 20)then
SetRun(true);
MM := SPS_PosToMM(P);
if (MM.X > 0) then
begin
if (SPS_MultiMouse) then
MultiMouse(MM.X, MM.Y, 25, 3, false)
else
Mouse(MM.X, MM.Y, 0, 0, mouse_Left);

Marktime(Time);
if WaitFunc(@IsMoving, 1, 3000 + random(500)) then
while isMoving do
begin
if(FlagDistance < Distance)then
break;
if(EnergyPercentage > 20)then
if(TimefromMark(Time)> 3000)then
if(not(GetMMLevels('run', s) < EnergyPercentage))then
begin
mousespeed:=Randomrange(10,27);
writeln('Energy Percentage hasnt decreased so we are not running.');
Mouse(715, 98, 20, 20, true);
EnergyPercentage:=0; //Stop tracking screw using another var to do so
end;
if(random(100) < 10)then
begin
mousespeed:=Randomrange(10,27);
SleepAndMoveMouse(random(500));
end;
if(Random(10) < 5)then
if(not(FindcolorTolerance(x, y, 6740716, 714, 99, 734, 118, 6)))then
if(EnergyPercentage > 20)then
SetRun(true);
sleep(200);
sleep(random(200));
end;
Result := True;
end;
end;

{*
#############################################################################################
*********DTM_WalkTo, by Leetsxc**********
#############################################################################################
Made from Orginal SPS_WalkToPos function
- Walks to position, P.

FEATURES
- Break's from loop when Distance from flag has been reached
- Will Randomly Select Run if Below a Random Percentage of 20-40 Energy Level
- No Longer uses Flag as it was to unreliable and would get you stuck in infinite Wait Loops
- Uses a Random Sleep and Move Mouse while waiting to reach specified Flag distance
- Tracks Energy Percentage to see if it has decreased, if it hasn't it will enable run
sxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxcsxc
*}
function DTM_WalkTo(DTM, MMX1,MMY1,MMX2,MMY2, XMinus, YMinus, XPlus, YPlus, Distance:integer; rotated:boolean): boolean;
var
s:string;
Time, EnergyPercentage:integer;
begin
if not LoggedIn then
Exit;
EnergyPercentage:=GetMMLevels('run', s);
if(Random(10) < 5)then
if(not(FindcolorTolerance(x, y, 6740716, 714, 99, 734, 118, 6)))then
if(EnergyPercentage > 20)then
SetRun(true);
if(rotated)then
begin
if(not(findDTMRotatedSe(DTM,x,y,MMX1,MMY1,MMX2,MMY2,-Pi, Pi, Pi/30, aFound)))then
begin
Result:=False;
exit;
end;
end else
if(not(findDTM(DTM,x,y,MMX1,MMY1,MMX2,MMY2)))then
begin
Result:=False;
exit;
end;
Result:=True;
X:=X-XMinus+XPlus;
Y:=Y-YMinus+YPlus;
Mouse(x,y, 0, 0, true);
if(Random(100)<6)then
Mouse(x,y, 2, 2, true); //6% Random Double Click when mini map walking via DTM's

Marktime(Time);
if WaitFunc(@IsMoving, 1, 3000 + random(500)) then
while isMoving do
begin
if(FlagDistance < Distance)then
break;
if(EnergyPercentage > 20)then
if(TimefromMark(Time)> 3000)then
if(not(GetMMLevels('run', s) < EnergyPercentage))then
begin
mousespeed:=Randomrange(10,27);
writeln('Energy Percentage hasnt decreased so we are not running.');
Mouse(715, 98, 20, 20, true);
EnergyPercentage:=0; //Stop tracking screw using another var to do so
end;
if(random(100) < 10)then
begin
mousespeed:=Randomrange(10,27);
SleepAndMoveMouse(random(500));
end;
if(Random(10) < 5)then
if(not(FindcolorTolerance(x, y, 6740716, 714, 99, 734, 118, 6)))then
if(EnergyPercentage > 20)then
SetRun(true);
sleep(200);
sleep(random(200));
end;
Result := True;
end;

procedure WalkToAltar;
var
i, CTS, Time:integer;
Altar:TpointArray;
WalkPoint:Tintegerarray;
begin
Altar:=[Point(3639, 3151),
Point(3675, 3131),
Point(3699, 3091),
Point(3679, 3043),
Point(3683, 2991), //Where it messes up
Point(3659, 2987),
Point(3631, 2943),
Point(3631, 2891),
Point(3623, 2855),
Point(3647, 2803),
Point(3635, 2755)
];

Repeat
begin
MarkTime(time);
mousespeed:=Randomrange(10,27);
While (SPS_WalkToPosSXC(Altar[i], RandomRange(22,30)) = False) and (TimeFromMark(Time)<25000) do
Sleep(100+random(200));
if(TimeFromMark(Time)>25000)then
begin
ClickNorth(0);
SetAngle(0);
i:=0;
While SPS_PosOnMM(Altar[i])=false do
begin
i:=i+1;
if(i=10)then
I:=0;
end;
end else
i:=i+1;
end;
Until(i=10);

WalkPoint:=[ //Chaos Altar middle dtms \
DTMFromString('mQwAAAHicY2ZgYDjKBMFHgLiTkYFhIhBPB2JfbzeGlMQYhqAAbwZ+oDoYZkTCQAAAQaQHKA=='),
DTMFromString('mQwAAAHicY2ZABaxQmgeIfb3d4JgfyIdhRiQMBABgxALf'),
DTMFromString('mQwAAAHicY2ZgYDjGhMCTGBkYpgNxJxAHBAXAsSRQHQwzImEgAABDAwc1'),
DTMFromString('mbQAAAHicY2VgYLjNhMBngPg5EDMzMjB8A8rxMkLYIJwQHc/g7e4Nxi4OLgyRIREM7EA1fEDMD8WCQMyIBYMBAAe6Ck4=')];
sleep(1500+random(600));

Repeat
begin
SPS_WalkToPosSXC(Altar[10], RandomRange(2,5))

sleep(1500+random(600));
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.12);
while FlagDistance > 3 do sleep(100);
writeln('Successfully Ran to the Altar!');
writeln('Checking for Chaos Altar Floor Color.. Incase of MINIMAP Glitch');
if(FindColorSpiralTolerance(x, y, 1450143, 0, 0,324, 341, 8))then
begin
{if(random(100)<30)then
begin
Mouse(x,y,4,4,false);
WaitOption('Walk',3000);
end; }
sleep(500+random(300));
ColorToleranceSpeed(CTS);
Break;
end else
begin
writeln('Mini-Map Flag Movement Glitch.. Walking into store again!..');
_FindAllRandoms(false);
end;
end;
Until(False);
end;

procedure GrabProcess;
var
z,a,Count,time:integer;
UseCoords:boolean;
begin
MakeCompass('S');
While Count<>26 do
begin

if(GetCurrentTab<>tab_Magic)then
GameTab(tab_Magic);

If(MEMBERz)then
begin
if(not(findcolortolerance(z,a,16711422,637, 292,661, 311,3)))then
Mouse(636, 293, 18, 17, True);
end else
begin
if(not(findcolortolerance(z,a,16711422,615, 297,631, 311,3)))then
Mouse(615, 297, 18, 15, True);
sleep(1000+random(3000));
end;

mousespeed:=Randomrange(10,27);
MarkTime(time);
if(UseCoords=false)then
begin
while (FindColorTolerance(z,a, 1316087, MMCX-15, MMCY-15, MMCX+15, MMCY+15, 25)=false) and (TimeFromMark(time)< 60000+random(10000)) do
sleep(5);
While (findDTMRotatedSE(ZamWine,x,y,MSX1,MSY1,MSX2,MSY2,-Pi, Pi, Pi/30, aFound)=False) and (TimeFromMark(time)< 60000+random(30000)) do
sleep(50);
MMouse(x,y,4,2);
if(TimeFromMark(time)>60000)then
begin
ClickNorth(0);
SetAngle(0);
SPS_WalkToPosSXC(Point(3627, 2755), 3);
GrabProcess;
end else
begin
if(WaitUptextMulti(['Wine', 'e of', 'ine o'],1500))then
begin
ClickMouse2SXC;
if(Walked=False)then
begin
sleep(3000+random(3000));
Mouse(x-10+random(5), y, 1, 1, false);
WaitOption('Walk', 2000);
Walked:=true;
end else
UseCoords:=true;
end else
writeln('Failed to find Uptext on DTM target retrying DTM..');
end;
end else
begin

if(Random(10)<4)then
begin
Case Random(98) of
0..43: begin
sleepandmovemouse(8000);
end;
44..98: begin
sleep(random(8000));
end;
End;
end;

//***Mini_Map_Item_Dot Monitor**
if(UseMiniMapDot)then
begin
if(Stealth_Mode)then
begin
//**RandomOffset Around Wine Coordinates** - It's kool what we can do with MiniMapItem Detection XD Great A/B
Case Random(98) of // 1/3 Around 33.3 Percent Chance of doing each action
0..32: begin
MMouse(x-Random(50)+random(50),y-Random(50)+random(50), 0, 0);
sleep(random(2000));
MMouse(x-Random(15)+random(15),y-Random(15)+random(15),0,0);
end;
33..66: begin
MMouse(x-Random(15)+random(15),y-Random(15)+random(15),0,0);
end;
67..98: begin
MMouse(x,y,2,2);
end;
END;
end else
MMouse(x+2,y,2,2);

writeln('Using MiniMap Item Dot.. Detector');
while (FindColorTolerance(z,a, 1316087, MMCX-15, MMCY-15, MMCX+15, MMCY+15, 25)=false) and (TimeFromMark(time)< 120000+random(10000)) do
sleep(5);
ClickMouse2SXC;
writeln('Click Mouse sxc');
end else
if(UseCountColor)then
begin
writeln('Using CountColor.. Detector 20pixel radius around last known red click');
MMouse(x+2,y,2,2)
while (TimeFromMark(time)<60000+random(10000)) do
begin
if(CountColorTolerance(5921886, x-5, y-5, x+5, y+5, 20)>2)then
begin
ClickMouse2SXC;
writeln('Click Mouse sxc');
break;
end;
end;
end;
end;
//***Fail_Safe***
if(TimeFromMark(time)>120000)then
begin
_FindAllRandoms(false);
UseCoords:=false;
end else
begin
//MMouse(x+2,y,2,2);
if(DidRedClick())then
begin
Count:=Count+1
Proggy;
end
else
UseCoords:=false;
end;

if(UseCoords)then
begin
Case Random(98) of
0..43: begin sleepandmovemouse(8000); end;
44..98: begin sleep(random(8000)); end;
End;
end;

//***Fail_Safe***
mousespeed:=Randomrange(10,27);
if(GetCurrentTab<>tab_Magic)then
GameTab(tab_Magic);

mousespeed:=Randomrange(10,27);
if(Count=26)then //Double Check on Inv count versus Spell Counter(Less Efficient) because we have most likely not gathered All of the Item
begin
GameTab(tab_Inv);
Count:=InvCount()-2; //Minus Waters and Laws
GameTab(tab_Magic);
end else
if(Count>13)then
begin
if(FindBlackChatMessage('have enough inventory'))then //Check Messages for Inventory is Full Message Just incase.
Count:=26;
end;

if(Count=26)then
begin
Grabs:=Grabs+26;
If(Memberz)then
begin
MMouse(687,291,15,18);
while(Waituptext('alad', 500)=false)do MMouse(687,291,15,18);
getmousepos(x,y);
Mouse(x, y, 0, 0, true);
end else
begin
MMouse(664, 294,15,18);
while(Waituptext('alad', 500)=false)do MMouse(664, 294,15,18);
getmousepos(x,y);
Mouse(x, y, 0, 0, true);
sleep(1000+random(3000));
end;
writeln('Exiting Procedure?!..');
MakeCompass('N');
sleep(6000+random(3000));
end;

end;

end;

procedure WalkToBank;
var
{WalkPoint1, WalkPoint2, WalkPoint3, WalkPoint4, WalkPoint5, WalkPoint6, WalkPoint7, WalkPoint8, WalkPoint9, WalkPoint10,} i, time:integer;
XMinus, YMinus, XPlus, YPLus, AreaX1,AreaY1,AreaX2,AreaY2, WalkPoint:Tintegerarray;
CTS,tries:integer;
begin
WalkPoint:=[ //Just Before Bank
DTMFromString('mWAAAAHicY2FgYDjExMBwAoiPAfFRIGZgZGD4B6R+AjELkM1ucRsiCMV8DKiAEQ2DAACpxQZO'),
//DTMFromString('mWAAAAHicY2FgYFjIxMCwgglCLwdic0YINgBiYyB+d0kFqIoRjnkZIIAXihnRMAgAAGZjBYU='),
DTMFromString('mWAAAAHicY2FgYBBgZmDgB2IeIBYC4i9AsV9A/BNKf/gvwDDTx51hXVggQ52dNYMkUAwZM6JhEAAAEekKDg==')];

//Array's for Map Data
AreaX1:=[548, MMX1];
AreaY1:=[19, MMY1];
AreaX2:=[631, MMX2];
AreaY2:=[107, MMY2];
XMinus:=[0,0];
YMinus:=[0,4];
XPlus:=[0,4];
YPlus:=[6,0];
Writeln('Walking to Bank..');
{While SPS_PosOnMM(Bank[i])=false do
i:=i+1;
if(i<4)then
While SPS_PosOnMM(Bank[i+1])do
begin
i:=i+1;
if(i=4)then
break;
end; }
{ Repeat
MarkTime(time);
mousespeed:=Randomrange(10,27);
While (SPS_WalkToPosSXC(Bank[i], RandomRange(1,3)) = False) and (TimeFromMark(Time)<25000) do
Sleep(100+random(200));
if(TimeFromMark(Time)>25000)then
begin
i:=0;
While SPS_PosOnMM(Bank[i])=false do
i:=i+1;
if(i<3)then
While SPS_PosOnMM(Bank[i+1])do
begin
i:=i+1;
if(i=3)then
break;
end;
end else
i:=i+1;
Until(i=4); }

Repeat
begin
MarkTime(time);
mousespeed:=Randomrange(10,27);
//Rotation
if(DTM_WalkTo(WalkPoint[i], AreaX1[i],AreaY1[i],AreaX2[i],AreaY2[i], XMinus[i], YMinus[i], XPlus[i], YPlus[i], 1, true) = False)then
begin
if(i=0)then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.75);
writeln('Checking for Path Color.. Their is no water Symbol available!');
if(FindColorSpiralTolerance(x, y, 6124410, 550, 48,567, 131, 9))then
begin
Mouse(x-7,y,3,3,true);
if WaitFunc(@IsMoving, 1, 3000 + random(500)) then
begin
while isMoving do
begin
// if(FlagDistance < 4)then
//break;
end;
end else
begin
ColorToleranceSpeed(CTS);
break;
end;
ColorToleranceSpeed(CTS);
end;
end;

if(i=1)then
begin
Mouse(MMCX, MMCY+10, 1, 1, true);
if WaitFunc(@IsMoving, 1, 3000 + random(500)) then
while isMoving do
begin
// if(FlagDistance < 4)then
//break;
end;
i:=0;
end;

end;

if(TimeFromMark(Time)>175000)then
begin
writeln('Critical DTM Error on DTM: ' + inttostr(I));
writeln('Retrying...');
if(tries>1)then
begin
if(I=0)then
I:=I+1
else
tries:=tries+1;
end;
end else
begin
if(I=0)then
sleep(1500+Random(1500));
i:=i+1;
end;
end;
Until(i=2);
end;

procedure BankProcess;
var
count,time:integer;
begin
if(random(100)<=5)then
SleepAndMoveMouse(random(3000));
MarkTime(time);

mousespeed:=Randomrange(10,27);
if(Random(9)<4)then
begin
While (FindTpa([0.40, 0.36, 0.34], [0.45, 0.43, 0.09], [4875653, 922159, 5395287], [4, 4, 10], [0], 40,
60, 245, 173, 285, 342, 40, 2, 200, ['anker'], ['ank Ban'], False, True, False, True) = False) and (TimeFromMark(time)<60000) do
begin
sleep(1000+random(1000));
count:=count+1;
if(count>7)then
break;
end;
end else
begin
{*Because Random Clicking is activated on the function below we need a wait to avoid 1 clicking the bankers since this is going for booths.*}
While (FindTpa([0.16, 0.12], [0.40, 0.44], [5074570, 6189699], [1,6], [1], 40, 40, MSX1, MSY1, MSX2, MSY2, 60, 2, 200, ['k booth'], ['ank Bank bo'],
True, True, True, True) = False) and (TimeFromMark(time)<60000) do
begin
count:=count+1;
if(count>7)then
break;
end;
end;
if(count>7)then
begin
mousespeed:=Randomrange(10,27);
ClickNorth(0);
mousespeed:=Randomrange(10,27);
WalkToBank;
BankProcess;
end;

if(TimefromMark(time)>60000)then
begin
FailSafe;
WalkToBank;
end;
end;

function CheckBankUp(Time:integer): Boolean;
begin
Result:= WaitFindColor(x,y,4106994,195,26,321,43,5,Time);
end;

procedure WithdrawProcess;
begin
if(CheckBankUp(4000+random(1000)))then
begin
mousespeed:=Randomrange(10,27);
sleep(300+random(500));
if(InvCount>3)then
begin
InvMouse(randomrange(3,28),0);
if(WaitOption('All', 3000))then
begin
if(Random(10)<5)then
Mouse(485, 31, 8, 10, true); //ExitBank
end else
begin
InvMouse(randomrange(3,28),0);
if(OptionsExist(['Drop'], False))then
BankProcess
else
WithdrawProcess;
end;
end else
Exit;
end else
begin
if(not(GetCurrentTab()=Tab_Inv))then
GameTab(Tab_Inv);
if(InvCount>4)then
BankProcess
end;
end;


procedure TakeBreaks;
begin
if not LoggedIn then
Exit;
begin
if (GetSystemTime > BreakTimer) then
begin
WriteLn('Taking a break.');
Logout;
Wait(BreakFor * 60000 + Random(BreakForRandom * 60000));
WriteLn('Logging back in.');
Case (SwitchWorld) of
True: if LoginPlayerToLob then
ChangeWorld(RandomWorld(True, False));
False: LoginPlayer;
end;
Wait(2000);
BreaksTaken:=BreaksTaken+1;
BreakTimer := GetSystemTime + (BreakIn * 60000 + Random(BreakInRandom * 60000));
end;
end;
end;

Procedure SetupSPSStuff;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['9_7', '9_6', '8_7', '8_6']);
end;

procedure LoadDTMZ;
begin
ZamWine:= DTMFromString('mbQAAAHicY2VgYDjCyMCwmxFCHwLik0DMAcRsQPwPKM8HpLmAODYqgsFSR5jBxVSMwc9GksHfToqBHyiPjhmxYDAAAJmtCLE=');
end;

Procedure FreeDtmz;
begin
FreeDTM(ZamWine);
end;

begin
if(MEMBER)then
Memberz:=true
Smart_server := SERVER;
Smart_Signed := TRUE;
Smart_Members := MEMBER;
Smart_SuperDetail := FALSE;
SetupSRL;
SetupSPSStuff;
LoadDTMZ;
DeclarePlayers;
mousespeed:=25+random(5);
if(not(Loggedin))then
LoginPlayer;
BreakTimer := GetSystemTime + (BreakIn * 60000 + Random(BreakInRandom * 60000));
StartTime:=GetSystemTime;
AddonTerminate('FreeDtmz');
{ MyPos := SPS_GetMyPos();
posx:=MyPos.x; posy:=MyPos.y;
writeln('My Position is ' + inttostr(posx) + ', ' + inttostr(posy));
TerminateScript(); }

//**Kill the Trial Member Pop Up Spam on Login**
if(Trial_Member)then
begin
sleep(15000);
mouse(331, 314,0,0,true);
end;

SetAngle(SRL_ANGLE_HIGH);
repeat
begin
Proggy;
Antiban;
WalkToAltar;
GrabProcess;
WalkToBank;
BankProcess;
Antiban;
WithdrawProcess;
if (UseBreaks) then
TakeBreaks;
end;
until (not Loggedin);
end.

Daniel

2012-05-08 07:27:47

You mean in the procedure GrabProcess? Assuming so.

Couple of things:
  • You only use the break statement once, inside a nested loop (that means it won't break out from the first loop).
  • You do not properly exit from the method.
  • You use recursion.

Jakkle

2012-05-08 07:33:53

begin
while (FindColorTolerance(z,a, 1316087, MMCX-15, MMCY-15, MMCX+15, MMCY+15, 25)=false) and (TimeFromMark(time)< 60000+random(10000)) do
sleep(5);
While (findDTMRotatedSE(ZamWine,x,y,MSX1,MSY1,MSX2,MSY2,-Pi, Pi, Pi/30, aFound)=False) and (TimeFromMark(time)< 60000+random(30000)) do
sleep(50);
MMouse(x,y,4,2);
if(TimeFromMark(time)>60000)then
begin
ClickNorth(0);
SetAngle(0);
SPS_WalkToPosSXC(Point(3627, 2755), 3);
GrabProcess;
end else

I think it's the fact your using
if(TimeFromMark(time)>60000)then
begin
ClickNorth(0);
SetAngle(0);
SPS_WalkToPosSXC(Point(3627, 2755), 3);
GrabProcess;
end else
When your saying
and (TimeFromMark(time)< 60000+random(30000)) do
There is a chance that it will go above 60000 with the random 30000 on top. There for you would be starting the procedure again ? With GrabProcess; after the 60000 weather you found it or not.

I see you don't have,
if (not LoggedIn) then
Exit;
at the beginning of your procedures so it would never exit if I wasn't logged in ?