Log in

View Full Version : Why won't my script repeat? MonkKiller



MattL191
02-14-2012, 09:26 AM
I added some stuff. Like TPA Finding and the failsafes. Is it the failsafes that are messing it up. Can't be because i have it so its suppose to Writeln when thats the reason it just says Successfully executed.

Any help why this this happening would be greatly appreciated.


Code below and attached as well.

Thanks a lot.

Program MonkKiller;
{$DEFINE SMART}
{$i SRL\SRL.simba}
{$i sps/sps.simba}
{$i SRL\SRL\Misc\Debug.simba}
{$i SRL/SRL/skill/fighting.simba}
Const
SRLStats_Username = '';// Your SRL Stats Username
SRLStats_Password = ''; // Your SRL Stats Password
NumbOfPlayers = 1; //How many players are you using
StartPlayer = 0; //Player to start auoting with! (0 means first char)
BreakEvery = 120; //How many loads to take a break after.
BreakFor = 15; //How many minutes to break for +random range 5mins
SkillTraining = 'Strength'; // What Skill training for HoverSkill
Version = '2.0'; //Leave Alone
Var
FindMonktimer, BreakTime: Integer;
procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Pin := '' //Pin for Bank
Active := True;
Booleans[0] := True; //Take Breaks?
Integers[0] := 50; //Minimum Time before Break
Integers[1] := BreakEvery; //Maximum Time before Break
end;

end;
Procedure ResetBreakTimer;
begin
BreakTime:= GetSystemTime + RandomRange(Players[CurrentPlayer].Integers[0]*60000, Players[CurrentPlayer].Integers[1]*60000);
end;

Procedure Setup;
Begin
Smart_Server:=89;
Smart_Members:=False;
Smart_Signed:=True;
Smart_SuperDetail:=False;
SetupSRL;
Declareplayers;
Wait(2500+(250));
LogInPlayer;
ResetBreakTimer;
Wait(1500+random(500));
Setangle(SRL_ANGLE_HIGH);
End;
procedure Load_Antiban;
begin
case Random(1500) of
1: BoredHuman;
2: HoverSkill('random', False);
3: HoverSkill(SkillTraining, False);
4: PickUpMouse;
5: RandomMovement;
6: RandomRClick;
7: ExamineInv;
8: Wait(1000+random(1000));
end;
end;
Procedure Break;
var
H, M, S, Time: Integer;
begin
if (GetSystemTime >= BreakTime) and Players[CurrentPlayer].Booleans[0]then
begin
Logout;
ConvertTime(BreakFor, H, M, S);
Writeln('Break for:'+IntTostr(m)+'m'+IntTostr(s)+'s');
MarkTime(Time);
Repeat
Wait(1000);
until(BreakFor < TimeFromMark(Time))
LogInPlayer;
ResetBreakTimer;
Wait(4000);
FindNormalRandoms;
end;
end;
function MonkHeadColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 1.67);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 7318218, MSX1, MSY1, MSX2, MSY2, 7);
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
ColorToRGB(arC[i], R, G, B);

if (R >= 180) and (R <= 221) and (G >= 152) and (G <= 186) and (B >= 101) and (B <= 125) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 32.83) and (X <= 50.52) and (Y >= 33.55) and (Y <= 51.39) and (Z >= 17.30) and (Z <= 26.34) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
function MonkBodyColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.43, 1.90);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2834763, MSX1, MSY1, MSX2, MSY2, 6);
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
ColorToRGB(arC[i], R, G, B);

if (R >= 57) and (R <= 88) and (G >= 50) and (G <= 80) and (B >= 27) and (B <= 59) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 3.17) and (X <= 7.51) and (Y >= 3.35) and (Y <= 7.94) and (Z >= 1.67) and (Z <= 5.16) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

Procedure AttackMonk;
var
MyTPA: TPointArray;
MyPoint: TPoint;
x, y, i: Integer;
begin
begin
if InFight then
begin
repeat
FindNormalRandoms;
Load_Antiban;
until Not Infight
end;
MarkTime(FindMonkTimer);
x:= MSCx;
y:= MSCy;
FindColorsSpiralTolerance(x, y, MyTPA, 8235488, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, 7247558, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, MonkHeadColor, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, MonkBodyColor, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then
begin
Logout;
writeln('Couldnt find Monk');
TerminateScript;
end;
for I:=0 to High(MyTPA) do
begin
MyPoint:= MyTPA[i]
MMouse(Mypoint.x, MyPoint.y, 5, 5);
if (IsUpTextMultiCustom(['ttack', 'onk', 'monk'])) then
begin
GetMousePos(x,y);
Mouse(x, y, 0, 0, Mouse_Right);
ChooseOption('ttack Monk');
Wait(500+Random(350));
exit;
end;
end;
begin
if InFight then
begin
repeat
FindNormalRandoms;
Load_Antiban;
until Not Infight
end;
Flag;
Wait(5000+random(250));
end;
end;
end;
Procedure HealMonk;
var
MyTPA: TPointArray;
MyPoint: TPoint;
x, y, i: Integer;
begin
begin
if InFight then
begin
repeat
FindNormalRandoms;
Load_Antiban;
until Not Infight
end;
MarkTime(FindMonkTimer);
x:= MSCx;
y:= MSCy;
FindColorsSpiralTolerance(x, y, MyTPA, 7778513, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, 7380935, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, MonkHeadColor, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, MonkBodyColor, MSx1, MSy1, MSx2, MSy2, 5);
if TimeFromMark(FindMonkTimer) > (120000) then
begin
Logout;
writeLn('Couldnt find monk');
TerminateScript;
end;
if Length(MyTPA) = 0 then
begin
Logout;
writeln('Couldnt find Monk');
TerminateScript;
end;
for I:=0 to High(MyTPA) do
begin
MyPoint:= MyTPA[i]
MMouse(Mypoint.x, MyPoint.y, 5, 5);
if (IsUpTextMultiCustom(['ttack', 'onk', 'monk'])) then
begin
GetMousePos(x,y);
Mouse(x, y, 0, 0, Mouse_Right);
WaitOptionMulti(['alk', 'Talk'], 200+random(200));
Wait(1000+Random(100));
ClickContinue(True, False);
Wait(850+Random(250));
Case Random(5) of
0: Mouse(141, 395, 5, 5, Mouse_Left);

1: Mouse(229, 400, 5, 5, Mouse_Left);

2: Mouse(296, 399, 5, 5, Mouse_Left);

3: Mouse(368, 395, 5, 5, Mouse_Left);

4: Mouse(254, 399, 5, 5, Mouse_Left);
end;
Wait(850+random(150));
ClickContinue(True, False);
Wait(850+random(150));
ClickContinue(True, False);
Wait(850+random(150));
exit;
end;
Wait(350+random(350));
end;
end;
end;
procedure WalkToSpawns;
var ax, ay, x, y: Integer;
begin
case Random(3) of
0: begin
FindSymbol(ax, ay, 'water');
Mouse(ax, ay, 5, 5, Mouse_left);
Flag;
wait(850+random(150));
end;
1: begin
x := MMCX;
y :=MMCY;
if FindColorSpiralTolerance(x, y, 258295, MMX1, MMY1, MMX2, MMY2, 5) then
Mouse(x, y, 5, 5, Mouse_Left);
Flag;
wait(850+random(150));
end;
2: begin
x := MMCX;
y :=MMCY;
if FindColorSpiralTolerance(x, y, 258295, MMX1, MMY1, MMX2, MMY2, 5) then
Mouse(x, y, 5, 5, Mouse_Left);
Flag;
wait(850+random(150));
end;
end;
end;
begin;
Setup;
repeat
AttackMonk;
if not Infight then
WalkToSpawns;
Break;
if (HPPercent < 65) then
repeat
HealMonk;
until (HPPercent = 100);
until(false)
end.

MattL191
02-14-2012, 06:15 PM
bump

masterBB
02-14-2012, 06:24 PM
will look into it, 5 min.

masterBB
02-14-2012, 06:27 PM
Break; at line 382 should be removed

MattL191
02-14-2012, 06:37 PM
do you know why my break procedure is messing up repeat?

masterBB
02-14-2012, 06:40 PM
break is a reserved keyword. You should give it another name.

Repeat
if(We have to exit this repeat loop) then
break;
until(false);

It's the way you break out of a repeat loop. The same as exit works for a function or procedure and TerminateScript for the script.

MattL191
02-14-2012, 06:44 PM
ohh ok thanks a lot. Just learned something. thanks