SCAR Code:
program New;
{.include srl/srl.scar}
//INSTRUCTIONS
//USE LOW DETAIL
//HAS AUTO COLOR
//USE VERY BRIGHT
//AUTO CORRECTS SELF WHEN WALKING TO KARAMJA
//LOBBY POTS IN FIRST SLOT
//GPS IN SECOND SLOT
//MAKE SURE YOUR CHARACTERS ARE ALL ABOVE LEVEL 20
//use findcolorstoelerance its a tons faster
//edited
//Credits:
//-Yakman for original findradial function in radial walking aid
//all i did was take out canvas drawing
//used it to get radian of symbol shop & to get out of fally bank
//Freddy1990 because i used his findcolorrighttol
//and changed it to search from bottom right to top left
//-The devs for an awesome include
//To Do List:
//
var
TimePerPlayer: Integer;
RandomTimePerPlayer: Integer;
RsAlwaysOnTop: Boolean;
ZenmaDebug: Boolean;
procedure DeclarePlayers;
begin
SRLID := ''; //Insert your SRL Stats ID here (It is different than your Forum's username!)
SRLPassword := ''; //SRL Stats password here.
// Get the above two numbers at: <a href="http://www.Stats.SRL-Forums.com" target="_blank">http://www.Stats.SRL-Forums.com</a> !!!
HowManyPlayers := 1; //Leave this unless you know what you're doing
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
TimePerPlayer := 600000; //time to run per player 60000 = 1 minute currently set to 10min
RandomTimePerPlayer := 600000; //time to add randomly currently set to add randomly 10 min
RsAlwaysOnTop := False; //Set true if you want rs to always be on top
ZenmaDebug := False; //for zenma use it makes lots of bitmaps..
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := true;
Players[0].Pin := 1968; //bankpin
Players[0].Loc := 'Bank';
Players[0].Booleans[0] := False; //have you done pirates treasure?
Writeln('Player(s): ' + IntToStr(HowManyPlayers) + ';');
end;
procedure SetUpPlayer;
begin
HighestAngle;
MakeCompass('N');
end;
{*******************************************************************************
function FindColorWithInMM(var X, Y: Integer; Color1, Color2, WithInX, WithInY, Tolerance: Integer): Boolean;
By: Zenma
Description: Results true if it finds color2 within WithInX X range and WithInY Y range. Returns Coordinates of Color2
I don't remember if this works
*******************************************************************************}
function FindColorWithInMM(var X: Integer; var Y: integer; Color1, Color2, WithInX, WithInY, Tolerance: Integer): Boolean;
var
Cx, Cy, Adder, I: Integer;
SkipArray: TBoxArray;
begin
Adder := 0;
repeat
repeat
if FindColorSkipBoxArrayTolerance(Cx, Cy, Color1, MMX1, MMY1, MMX2, MMY2, Tolerance, SkipArray) then
if FindColorTolerance(X, Y, Color2, Cx {- Round((0.5 + Adder) * WithInX)}, Cy {- Round((0.5 + Adder) * WithInY)}, Cx + Round((0.5 + Adder) * WithInX), Cy + Round((0.5 + Adder) * WithInY), Tolerance) then
begin
Result := True;
Exit;
end else
begin
SetArrayLength(SkipArray, GetArrayLength(SkipArray) + 1);
SkipArray[GetArrayLength(SkipArray) - 1].X1 := Cx - Round(0.5 * WithInX);
SkipArray[GetArrayLength(SkipArray) - 1].Y1 := Cy - Round(0.5 * WithInY);
SkipArray[GetArrayLength(SkipArray) - 1].X2 := Cx; //because if it didnt it would go after where it didnt find it
SkipArray[GetArrayLength(SkipArray) - 1].Y2 := Cy;
end;
until not (FindColorSkipBoxArrayTolerance(Cx, Cy, Color1, MMX1, MMY1, MMX2, MMY2, Tolerance, SkipArray))
for I := 0 to GetArrayLength(SkipArray) - 1 do
begin
SkipArray[i].X1 := 0;
SkipArray[i].X2 := 0;
SkipArray[i].Y1 := 0;
SkipArray[i].Y2 := 0;
end;
Adder := Adder + 1;
until Adder = 4;
end;
//Originally in Radial Walking Aid Edited out canvas drawing
function FindRadial(x, y, radius: integer): integer;
var x1, y1, r: integer;
begin
for r := 0 to 360 do
begin
x1 := Round(Radius * Sin(r * pi / 180)) + MMCX;
y1 := Round(-Radius * Cos(r * pi / 180)) + MMCY;
if (Distance(x1, y1, x, y) <= 1) then
begin
result := r;
exit;
end;
end;
end;
function GetAngle(X, Y: Integer): Integer;
begin
Result := FindRadial(X, Y, Distance(MMCX, MMCY, X, Y));
end;
//gets road color south of fally by comparing new and old colors
function GetANewRoadColor(OldRoadColor: Integer; Banking: Boolean): Integer;
var
SkipIt: TBoxArray;
Multiplier: Integer;
Rx, Ry: Integer;
TheArray: TPointArray;
Count: Integer;
TheColor: Integer;
I: Integer;
Amounts:Integer;
begin
if Banking then Amounts := 60 else
Amounts := 300;
WriteLn('Getting a new road color');
repeat
repeat
if FindColorSkipBoxArrayTolerance(Rx, Ry, 5986913, 613, 84, 679, 147, 10 + (10 * Multiplier), SkipIt) then
begin
TheColor := GetColor(Rx, Ry);
if (TheColor <> OldRoadColor) then
begin
FindColorsTolerance(TheArray, TheColor, 613, 84, 679, 147, 0);
if (GetArrayLength(TheArray) > Amounts) then //to make sure it isnt mm color
begin
Count := GetArrayLength(TheArray)
for I := 0 to (GetArrayLength(TheArray) / 2) do //speed it up
if not (Rs_OnMinimap(TheArray[i].X, TheArray[i].Y)) then Count := Count - 1;
if (Count > Amounts) then
begin
Result := GetColor(Rx, Ry);
WriteLn('New Road Color ' + IntToStr(Result) + ' @ ' + IntToStr(Rx) + ',' + IntToStr(Ry));
Exit;
end;
end;
end;
SetArrayLength(SkipIt, GetArrayLength(SkipIt) + 1);
SkipIt[GetArrayLength(SkipIt) - 1].X1 := Rx - 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y1 := Ry - 4;
SkipIt[GetArrayLength(SkipIt) - 1].X2 := Rx + 4; //because if it didnt it would go after where it didnt find it
SkipIt[GetArrayLength(SkipIt) - 1].Y2 := Ry + 4;
end;
until not FindColorSkipBoxArrayTolerance(Rx, Ry, 5986913, 613, 84, 679, 147, 10 + (Multiplier * 10), SkipIt);
Inc(Multiplier);
for I := 0 to High(SkipIt) do
begin
SkipIt[i].X1 := 0;
SkipIt[i].Y1 := 0;
SkipIt[i].X2 := 0;
SkipIt[i].Y2 := 0;
end;
until (Multiplier = 5)
Result := -1;
WriteLn('Failed TO find color');
end;
//a bit sloppy but it works
//All it does it increase the angles by 5's until it finds next walkable positon
//stops at 90degrees and 270 degrees
//stores radialwalkex at MX,My
//needs improvement
function RadialWalkZ(TheColor: Integer; StartRadial, EndRadial: Integer; Radius:
Integer; Xmod, Ymod: Integer; Click: Boolean; var Mx, My: Integer): Boolean;
var
I: Integer;
F1, F2: Boolean;
begin
// WriteLn('Clicking = ' + BoolToStr(Click) + '. Current Player Position Before Radial Walk: ' + IntToStr(GetPlayerX) + ',' + IntToStr(GetPlayerY));
if (StartRadial = EndRadial) then
begin
WriteLn('WARNING: Using LinearRalk, StarRadial, and EndRadial are the same');
Result := LinearRoadWalk(TheColor, StartRadial, Radius, XMod, YMod);
end else
if (RadialWalkEx(Mx, My, 648, 83, TheColor, 0, StartRadial, EndRadial, Radius)) then
begin
Result := True;
FFlag(10);
MouseFindNoFlag(mx - random(3), my - random(3), Xmod, Ymod);
// WriteLn('Current Player Position After Radial Walk && FFLag: ' + IntToStr(GetPlayerX) + ',' + IntToStr(GetPlayerY));
FFlag(10);
end else
begin
WriteLn('Angles werent set high enough..making em bigger');
if (StartRadial > EndRadial) then
begin
repeat
Inc(I);
if (StartRadial + (5 * I) < 200) then
Result := RadialWalkEx(mx, my, 648, 83, thecolor, 0, StartRadial + (5 * I) - 5, StartRadial + (5 * I), radius) //270
else F1 := True;
if Result then Break;
if (EndRadial - (5 * I) > 100) then
Result := RadialWalkEx(mx, my, 648, 83, TheColor, 0, EndRadial - (5 * I), EndRadial - (5 * I) + 5, Radius)//90
else F2 := True;
if Result then Break;
until (F1 and F2)
end else
//REGULAR
begin
if RadialWalkEx(mx, my, 648, 83, thecolor, 0, EndRadial, 200, radius) then
Result := True
else
repeat
Inc(I);
if (StartRadial - (5 * I) > 100) then
begin
WriteLn('Angles werent high enough so setting em bigger');
Result := RadialWalkEx(mx, my, 648, 83, TheColor, 0, StartRadial - (5 * I), StartRadial - (5 * I) + 5, radius);
if Result then Break;
end else F1 := True;
if (EndRadial + (5 * I) < 200) then
begin
WriteLn('Angles werent high enough so setting em bigger');
Result := RadialWalkEx(mx, my, 648, 83, TheColor, 0, EndRadial + (5 * I) - 5, EndRadial + (5 * I), radius);
if Result then Break;
end else F2 := True;
until (F1 and F2)
end;
end;
if Result then
begin
FFlag(10);
if not (Click) then Exit;
MouseFindNoFlag(mx - random(3), my - random(3), Xmod, Ymod);
//WriteLn('Current Player Position After Radial Walk && FFLag: ' + IntToStr(GetPlayerX) + ',' + IntToStr(GetPlayerY));
FFlag(10);
end;
end;
procedure WriteOutPoints(Color: integer);
var
TheArray: TPointArray;
i: integer;
begin
FindColorsTolerance(TheArray, Color, mmx1, mmy1, mmx2, mmy2, 1);
for i := 0 to High(TheArray) do
WriteLn(IntToStr(TheArray[i].x) + ',' + IntToStr(TheArray[i].y));
Writeln(IntToStr(GetArrayLength(TheArray)));
end;
//dont remember if this works
function TVisible: Boolean; //detects if on the left of barn
var
Wx, Wy: Integer;
begin
Result := FindColor(Wx, Wy, FindWaterColor, 644, 6, 722, 83);
end;
function AutoColorBridge: Integer;
var
SkipIt: TBoxArray;
Multiplier, Count, TheColor, I, Rx, Ry: Integer;
TheArray: TPointArray;
begin
WriteLn('Getting a new bridge color');
repeat
repeat
if FindColorSkipBoxArrayTolerance(Rx, Ry, 1389645, 613, 84, 679, 147, 10 + (10 * Multiplier), SkipIt) then
begin
TheColor := GetColor(Rx, Ry);
FindColorsTolerance(TheArray, TheColor, 613, 84, 679, 147, 0); //reverts array size too
if (GetArrayLength(TheArray) > 160) then //to make sure it isnt mm color
begin
Count := GetArrayLength(TheArray)
for I := 0 to (GetArrayLength(TheArray) / 2) do //speed it up
if not (Rs_OnMinimap(TheArray[i].X, TheArray[i].Y)) then Dec(Count);
if (Count > 160) then
begin
Result := TheColor;
WriteLn('New Bridge Color ' + IntToStr(Result) + ' @ ' + IntToStr(Rx) + ',' + IntToStr(Ry));
Exit;
end;
end;
SetArrayLength(SkipIt, GetArrayLength(SkipIt) + 1);
SkipIt[GetArrayLength(SkipIt) - 1].X1 := Rx - 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y1 := Ry - 4;
SkipIt[GetArrayLength(SkipIt) - 1].X2 := Rx + 4; //because if it didnt it would go after where it didnt find it
SkipIt[GetArrayLength(SkipIt) - 1].Y2 := Ry + 4;
end else Break;
until False;
Inc(Multiplier);
until (Multiplier = 5)
Result := -1;
WriteLn('Failed TO find color');
end;
function FindSailor: Boolean;
var
SailorX, SailorY, SailorBx, SailorBy, Tries: Integer;
begin
repeat
Inc(Tries);
if FindColorTolerance(SailorX, SailorY, 4335142, MSX1, MSY1, MSX2, MSY2, 10 + (Tries * 5)) then
begin
WriteLn('found first color');
if FindColorTolerance(SailorBx, SailorBy, 1846076, SailorX - 12, SailorY - 20, SailorX + 20, SailorY + 20, 10 + (Tries * 5)) then
begin
WriteLn('Sailor Found At ' + IntToStr(SailorX) + ',' + IntToStr(SailorY));
Mouse(SailorX, SailorY, 2, 2, False);
if Players[CurrentPlayer].Booleans[0] = True then
begin
if ChooseOption('ay-f') then
begin
Result := True;
repeat
if ClickToContinue then Break;
wait(1000 + Random(1000));
until (false);
Exit;
end;
end else
begin
if ChooseOption('alk-') then
begin
repeat
if not(ClickContinue(True,True)) then Break;
wait(500 + random(1000));
until(False);
ClickNpcChatText('es', True);
repeat
if not(ClickContinue(True,True)) then Break;
wait(500 + random(1000));
until(False);
repeat //for the ship arrives at karamja
if ClickToContinue then Break;
wait(1000 + Random(1000));
until (false);
Result := True;
Exit;
end;
end;
end;
end;
until (Tries = 5)
end;
function GetBoxPoint(X, Y: Integer): boolean;
var
Mx, My: Integer;
BoxArray: TBoxArray;
ThePoints: TPointArray;
begin
repeat
if FindColorSkipBoxArray(Mx, My, 65536, MMX1, MMY1, MMX2, MMY2, BoxArray) then
begin
FindColorsTolerance(ThePoints, 65536, Mx - 2, My - 2, Mx + 2, My + 2, 0);
if (GetArrayLength(ThePoints) > 4) then
begin
X := Mx;
Y := My;
Result := True;
Exit;
end else
begin
SetArrayLength(BoxArray, GetArrayLength(BoxArray) + 1);
BoxArray[GetArrayLength(BoxArray) - 1].X1 := Mx - 2;
BoxArray[GetArrayLength(BoxArray) - 1].Y1 := My - 2;
BoxArray[GetArrayLength(BoxArray) - 1].X2 := Mx + 2; //because if it didnt it would go after where it didnt find it
BoxArray[GetArrayLength(Boxarray) - 1].Y2 := My + 2;
end;
end else Break;
until (false); //saves time
end;
function AnyOfTheThree(X, Y: Integer): Boolean;
begin
if GetBoxPoint(X, Y) then
begin
WriteLn('Box point');
Result := True;
Exit;
end;
if FindSymbol(X, Y, 'Minigame') then
begin
WriteLn('Minigame');
Result := True;
Exit;
end;
end;
//originally copied from findcolorrighttol and change dit a bit
function FindColorBottomRight(var cx, cy: Integer; Color, x1, y1, x2, y2: Integer): Boolean;
var
BmpCol: T2DIntArray;
xx, yy: Integer;
begin
BmpCol := GetBitmapAreaColors(x1, y1, x2, y2);
for yy := y2 downto y1 do
for xx := x2 downto x1 do
begin
Result := SimilarColors(Color, BmpCol[xx - x1][yy - y1], 0);
if Result then
begin
cx := xx;
cy := yy;
Exit;
end;
end;
end;
function AutoColorKaramjaDirt: Integer;
var
SkipIt: TBoxArray;
Multiplier, Rx, Ry, Count, TheColor, I: Integer;
TheArray: TPointArray;
begin
WriteLn('getting new karamja dirt color');
repeat
repeat
if FindColorSkipBoxArrayTolerance(Rx, Ry, 1271702, MMX1, MMY1, MMX2, MMY2, 10 + (10 * Multiplier), SkipIt) then
begin
TheColor := GetColor(Rx, Ry);
FindColorsTolerance(TheArray, TheColor, MMX1, MMY1, MMX2, MMY2, 0); //reverts array size too
if (GetArrayLength(TheArray) > 50) then //to make sure it isnt mm color
begin
Count := GetArrayLength(TheArray);
for I := 0 to (GetArrayLength(TheArray) / 2) do //speed it up
if not (Rs_OnMinimap(TheArray[i].X, TheArray[i].Y)) then Dec(Count);
if (Count > 50) then
begin
Result := TheColor;
WriteLn('New Karamja Dirt Color ' + IntToStr(Result) + ' @ ' + IntToStr(Rx) + ',' + IntToStr(Ry));
Exit;
end;
end;
SetArrayLength(SkipIt, GetArrayLength(SkipIt) + 1);
SkipIt[GetArrayLength(SkipIt) - 1].X1 := Rx - 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y1 := Ry - 4;
SkipIt[GetArrayLength(SkipIt) - 1].X2 := Rx + 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y2 := Ry + 4;
end else Break;
until (False) //not until not findcolorskiparraybox because that would make it repeat causing it to be 2x slower
Inc(Multiplier);
for I := 0 to High(SkipIt) do
begin
SkipIt[i].X1 := 0;
SkipIt[i].Y1 := 0;
SkipIt[i].X2 := 0;
SkipIt[i].Y2 := 0;
end;
until (Multiplier = 5)
Result := -1;
WriteLn('Failed TO find color');
end;
function AutoColorBarBrown: Integer;
var
SkipIt: TBoxArray;
Multiplier, Rx, Ry, Count, TheColor, I: Integer;
TheArray: TPointArray;
begin
writeln('getting bar brown color');
repeat
repeat
if FindColorSkipBoxArrayTolerance(Rx, Ry, 3494514, MMX1, MMY1, MMX2, MMY2, 10 + (10 * Multiplier), SkipIt) then
begin
TheColor := GetColor(Rx, Ry);
FindColorsTolerance(TheArray, TheColor, MMX1, MMY1, MMX2, MMY2, 0);
if (GetArrayLength(TheArray) > 230) then
begin
Count := GetArrayLength(TheArray);
for I := 0 to (GetArrayLength(TheArray) / 2) do //speed it up
if not (Rs_OnMinimap(TheArray[i].X, TheArray[i].Y)) then Count := Count - 1;
if (Count > 200) then
begin
Result := TheColor;
WriteLn('New bar Color ' + IntToStr(Result) + ' @ ' + IntToStr(Rx) + ',' + IntToStr(Ry));
Exit;
end;
end;
SetArrayLength(SkipIt, GetArrayLength(SkipIt) + 1);
SkipIt[GetArrayLength(SkipIt) - 1].X1 := Rx - 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y1 := Ry - 4;
SkipIt[GetArrayLength(SkipIt) - 1].X2 := Rx + 4; //because if it didnt it would go after where it didnt find it
SkipIt[GetArrayLength(SkipIt) - 1].Y2 := Ry + 4;
end else Break;
until False; //not until not findcolorskiparraybox because that would make it repeat causing it to be 2x slower
Inc(Multiplier);
for I := 0 to High(SkipIt) do
begin
SkipIt[i].X1 := 0;
SkipIt[i].Y1 := 0;
SkipIt[i].X2 := 0;
SkipIt[i].Y2 := 0;
end;
until Multiplier = 5;
Result := -1;
WriteLn('Failed TO find color');
end;
function AutoColorTree(OtherColor: Integer): Integer;
var
SkipIt: TBoxArray;
Multiplier, Rx, Ry, Count, TheColor, I: Integer;
TheArray: TPointArray;
begin
Writeln('getting tree color');
repeat
repeat
if FindColorSkipBoxArrayTolerance(Rx, Ry, 1002106, MMX1, MMY1, MMX2, MMY2, 50 + (10 * Multiplier), SkipIt) then
begin
TheColor := GetColor(Rx, Ry);
if (TheColor = OtherColor) then
begin
SetArrayLength(SkipIt, GetArrayLength(SkipIt) + 1);
SkipIt[GetArrayLength(SkipIt) - 1].X1 := Rx - 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y1 := Ry - 4;
SkipIt[GetArrayLength(SkipIt) - 1].X2 := Rx + 4; //because if it didnt it would go after where it didnt find it
SkipIt[GetArrayLength(SkipIt) - 1].Y2 := Ry + 4;
Continue;
end;
FindColorsTolerance(TheArray, TheColor, MMX1, MMY1, MMX2, MMY2, 0); //reverts array size too
if (GetArrayLength(TheArray) > 35) then //to make sure it isnt mm color
begin
Count := GetArrayLength(TheArray);
for I := 0 to (GetArrayLength(TheArray) / 2) do //speed it up
if not (Rs_OnMinimap(TheArray[i].X, TheArray[i].Y)) then Count := Count - 1;
if (Count > 35) then
begin
Result := TheColor;
WriteLn('New Tree Color ' + IntToStr(Result) + ' @ ' + IntToStr(Rx) + ',' + IntToStr(Ry));
Exit;
end;
end;
SetArrayLength(SkipIt, GetArrayLength(SkipIt) + 1);
SkipIt[GetArrayLength(SkipIt) - 1].X1 := Rx - 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y1 := Ry - 4;
SkipIt[GetArrayLength(SkipIt) - 1].X2 := Rx + 4;
SkipIt[GetArrayLength(SkipIt) - 1].Y2 := Ry + 4;
end else Break;
until (False); //not until not findcolorskiparraybox because that would make it repeat causing it to be 2x slower
Inc(Multiplier);
for I := 0 to High(SkipIt) do
begin
SkipIt[i].X1 := 0;
SkipIt[i].Y1 := 0;
SkipIt[i].X2 := 0;
SkipIt[i].Y2 := 0;
end;
until (Multiplier = 5);
Result := -1;
WriteLn('Failed TO find color');
end;
{
Function WalkToKaramja: Boolean;
Walks to karamja checking for various symbols/land features along the way
Able to accurately detect position and fix it MOST of the time
separated into steps to make code more readable and to fix bugs
This took a really long time to make...Probably like 20 hours altogether spaced
out over 2 months to fix bugs
I've ran this a lot of times on my main in order to perfect it
}
function WalkToKaramja: Boolean;
var
RoadColor, WaterColor, Mx, My, TheAngle, Nx, Ny, OldX, OldY, Tx, Ty,
Sx, Sy, Asx, Asy, MagicShopX, MagicShopY, Tries, OldRoadColor, OldWaterColor,
BridgeColor, OldBridgeColor, Rx, Ry, Px, Py, X: Integer;
DidIt: Boolean;
label
Step1, Step2, Step3, Step4, Step5, Step6, Step7, Step8, Step9, Step10, Step11,
ClickingSpot;
begin
SetUpPlayer;
OldRoadColor := FindFallyRoadColor; //for failsafe
RoadColor := OldRoadColor;
WaterColor := FindWaterColor;
OldWaterColor := WaterColor; //failsafe
Step1: //no infinite loops here
WriteLn('Step 1');
if Tries >= 5 then LogOut;
if not (LoggedIn) then Exit; //in mainloop do if not loggedin then nextplayer false ewlse if loads is equal to amount nextgplayer true
if FindColorWithInMM(Mx, My, WaterColor, RoadColor, 20, 10, 1) then //18,8,1
begin
if ZenmaDebug then TakeScreen('Step');
WriteLn('Found Water Within RoadColor');
WriteLn('Road Color Found Within Water At ' + IntToStr(Mx) + ',' + inttostr(My));
TheAngle := GetAngle(Mx, My);
WriteLn('Angle of ' + IntToStr(Mx) + ',' + IntToStr(My) + ' is ' + IntToStr(TheAngle));
WriteLn('Radial Walking between ' + IntToStr(TheAngle - 6) + ' and ' + IntToStr(TheAngle + 6));
RadialRoadWalk(RoadColor, TheAngle - 6, TheAngle + 6, 47 + random(5), 2, 4);
Flag;
end else
begin
WriteLn('Failed to get out of bank..Trying Again'); //failsafe here needed
Inc(Tries);
goto Step1;
end;
Tries := 0;
Step2: //no infinite loops here
WriteLn('');
WriteLn('');
WriteLn('Step 2');
if ZenmaDebug then TakeScreen('Step');
if Tries = 2 then
begin
LogOut;
Players[CurrentPlayer].Loc := 'Step 2 Lost';
Players[CurrentPlayer].Active := False;
Exit;
end;
if not (LoggedIn) then Exit;
if not (FindColor(Sx, Sy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := FindFallyRoadColor;
RadialWalkZ(RoadColor, 168, 208, 65 + Random(3), 1, 1, True, Rx, Ry);
if ZenmaDebug then TakeScreen('Step');
if not (FindColor(Sx, Sy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := FindFallyRoadColor;
RadialWalkZ(RoadColor, 170, 202, 65 + Random(3), 4, 5, True, Rx, Ry); //at gate
Flag;
if not (DidIt) then //to prevent it from getting original fally color again
begin
RoadColor := GetANewRoadColor(OldRoadColor,False);
DidIt := True;
end;
if RoadColor = -1 then
begin
DidIt := False;
Inc(Tries);
goto Step2;
end;
Tries := 0;
Step3:
WriteLn('');
WriteLn('');
WriteLn('Step 3');
WriteLn('NO CLICKING IS DONE HERE');
WriteLn('Checking For Tree');
if ZenmaDebug then TakeScreen('Step');
if not (FindSymbol(Sx, Sy, 'tree')) then
begin
MakeCompass('N');
if not (FindSymbol(Sx, Sy, 'tree')) then
begin
WriteLn('Couldn''t Find Tree...');
if not (FindSymbol(Sx, Sy, 'Bank')) then
begin
RadialWalkZ(RoadColor, 150, 222, 65 + Random(3), 4, 5, True, Rx, Ry);
if ZenmaDebug then TakeScreen('Step');
if FindSymbol(Sx, Sy, 'tree') then
begin
WriteLn('Found Tree');
goto Step4;
end else
begin
RadialWalkZ(RoadColor, 155, 220, 65 + Random(3), 1, 1, True, Rx, Ry); //incase its on second click still
if ZenmaDebug then TakeScreen('Step');
if FindSymbol(Sx, Sy, 'tree') then
begin
WriteLn('Found Tree');
goto Step4;
end;
end;
end;
LogOut;
Players[CurrentPlayer].Loc := 'TreeStuck';
Players[CurrentPlayer].Active := False;
Exit;
end;
end else WriteLn('Found Tree');
Step4:
WriteLn('');
WriteLn('');
WriteLn('Step 4');
if ZenmaDebug then TakeScreen('Step');
if not (FindColor(Sx, Sy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
RadialWalkZ(RoadColor, 145, 222, 65 + Random(3), 1, 1, True, Rx, Ry);
if ZenmaDebug then TakeScreen('Step');
//TerminateScript;
WriteLn('Checking For tree existence and no water');
if not (FindSymbol(Sx, Sy, 'tree')) and not (FindColorTolerance(Sx, Sy, 12227198, MMX1, MMY1, MMX2, MMY2, 50)) then
begin
WriteLn('Didnt Find tree or found water..Unknown Position');
MakeCompass('N');
if FindSymbol(Sx, Sy, 'tree') then
begin
WriteLn('Nvm..found stuff Position Known..lol');
goto Step5;
end;
WriteLn('Still Didnt Find it..Logging out');
LogOut;
Players[CurrentPlayer].Loc := 'No tree or water';
Players[CurrentPlayer].Active := False;
Exit;
end;
WriteLn('Found tree and no water');
Step5:
WriteLn('');
WriteLn('');
WriteLn('Step 5'); //next
if ZenmaDebug then TakeScreen('Step');
if not (FindColor(Sx, Sy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
RadialWalkZ(RoadColor, 150, 220, 65 + Random(3), 1, 2, True, Rx, Ry);
if ZenmaDebug then TakeScreen('Step');
{FINE}
Step6: //waterspot
WriteLn('');
WriteLn('');
WriteLn('Step 6');
if ZenmaDebug then TakeScreen('Step'); //tree spot barely visible
if not (FindColor(Sx, Sy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
RadialWalkZ(RoadColor, 165, 212, 65 + Random(3), 1, 2, True, Rx, Ry);
if ZenmaDebug then TakeScreen('Step');
if FindSymbol(MagicShopX, MagicShopY, 'Magic Shop') then goto Step8;
WriteLn('');
WriteLn('');
Step7:
WriteLn('');
WriteLn('');
WriteLn('Step 7');
if ZenmaDebug then TakeScreen('Step');
if not (FindColor(Sx, Sy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
WriteLn('Checking For Water Color');
if FindSymbol(MagicShopX, MagicShopY, 'Magic Shop') then goto Step8;
if not (FindColor(Sx, Sy, WaterColor, MMX1, MMY1, MMX2, MMY2)) then
begin
WaterColor := FindWaterColor;
if WaterColor = 0 then
WaterColor := OldWaterColor else
if not (FindColor(Sx, Sy, WaterColor, MMX1, MMY1, MMX2, MMY2)) then
begin
if FindSymbol(Sx, Sy, 'Tree') then goto Step3;
WriteLn('Didnt Find Water Color..Logging out');
LogOut; //if find tree an water color
Players[CurrentPlayer].Loc := 'NoWater';
Players[CurrentPlayer].Active := False; //makes sure it isnt at beginning by south fally gate..if it is it will goto back there
Exit;
end;
end;
WriteLn('Found Water Color..Checking For tree symbol');
if FindSymbol(Sx, Sy, 'Tree') then goto Step3 //
else WriteLn('Tree Not found..Thats A good thing');
if ZenmaDebug then TakeScreen('Step'); //leaving T here at bottom moving out
RadialWalkZ(RoadColor, 100, 120, 60 + Random(3), 1, 2, True, Rx, Ry); //was old radialroad
if ZenmaDebug then TakeScreen('Step');
if not (FindSymbol(MagicShopX, MagicShopY, 'Magic Shop')) then
begin
WriteLn('Didnt Find Rune Shop..Trying to Detect Position');
if FindColor(Sx, Sy, FindWaterColor, MMX1, MMY1, 719, 73) then //findsymbol water put it back if door color dont work
begin
WriteLn('Found Position'); //road colors cahnge when load
if not (FindColor(Rx, Ry, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
RadialWalkZ(RoadColor, 168, 240, 60 + random(5), 2, 1, True, Rx, Ry); //was old radialroad
if ZenmaDebug then TakeScreen('Step');
if FindSymbol(MagicShopX, MagicShopY, 'Magic Shop') then
goto Step8;
end;
if FindColor(Sx, Sy, WaterColor, MMX1, MMY1, MMX2, MMY2) then
if not (FindSymbol(Sx, Sy, 'tree')) then //yup cause its resetting then walking more right
if TVisible then
goto Step7; //might need to adjust this incase you are south of fally barn and u can view water check
if not (FindSymbol(MagicShopX, MagicShopY, 'Magic Shop')) then
begin
WriteLn('Didnt Find Runeshop and coudlnt detect position..Logging out =(');
LogOut; //if find tree an water color
Players[CurrentPlayer].Loc := 'NoRuneShop';
Players[CurrentPlayer].Active := False;
Exit;
end;
end;
Step8:
WriteLn('');
WriteLn('');
WriteLn('Step 8');
FindSymbol(MagicShopX, MagicShopY, 'Magic Shop'); //going here even tho hasnt found runeshop causing it to walk west on grass
if ZenmaDebug then TakeScreen('Step');
if not (FindColor(Asx, Asy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
if not(FindSymbol(Sx,Sy,'jewelery')) then
if not(FindSymbol(Sx,Sy,'axe shop')) then
if not(FindSymbol(Sx,Sy,'cook')) then
if not(FindSymbol(Sx,Sy,'minigame')) then
begin
WriteLn('Found Runeshop');
TheAngle := GetAngle(MagicShopX, MagicShopY);
WriteLn('Angle of ' + IntToStr(MagicShopX) + ',' + IntToStr(MagicShopY) + ' is ' + IntToStr(TheAngle));
WriteLn('Radial Walking between ' + IntToStr(TheAngle - 6) + ' and ' + IntToStr(TheAngle + 6));
RadialWalkZ(RoadColor, TheAngle - 10, TheAngle + 25, 60 + random(5), 2, 1, True, Rx, Ry); //might wanna change this
if ZenmaDebug then TakeScreen('Step');
end else WriteLn('Didnt need to click near runeshop =)');
//167-200
Step9:
WriteLn('');
WriteLn('');
WriteLn('Step 9');
if ZenmaDebug then TakeScreen('Step');
if not (FindColor(Asx, Asy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
RadialWalkZ(RoadColor, 167, 200, 60 + random(5), 2, 1, True, Rx, Ry);
if ZenmaDebug then TakeScreen('Step');
Step10:
if FindSymbol(MagicShopX, MagicShopY, 'magic shop') then
if not (FindSymbol(Sx, Sy, 'cook')) then
if not(FindSymbol(Sx,Sy,'minigame')) then
if not(FindSymbol(Sx,Sy,'jewelery')) then
if not(FindSymbol(Sx,Sy,'axe shop')) then
begin
WriteLn('was in incorrect step..autocorrecting');
goto Step8;
end;
WriteLn('');
WriteLn('');
WriteLn('Step 10');
if Tries = 10 then
begin
WriteLn('Tries = 3 @ dock..logging out..');
LogOut;
Players[CurrentPlayer].Loc := 'NoCookSymbol';
Players[CurrentPlayer].Active := False; //makes sure it isnt at beginning by south fally gate..if it is it will goto back there
Exit;
end;
if not (FindColor(Asx, Asy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
if FindSymbol(Sx, Sy, 'cook') then
WriteLn('Found Cooking Symbol')
else
begin
Flag;
wait(100 + random(100));
Inc(Tries);
goto Step10;
end;
Step11:
WriteLn('');
WriteLn('');
WriteLn('Step 11');
if ZenmaDebug then TakeScreen('Step');
WaterColor := FindWaterColor;
TheAngle := GetAngle(Sx, Sy);
WriteLn('Angle of ' + IntToStr(Sx) + ',' + IntToStr(Sy) + ' is ' + IntToStr(TheAngle));
if RadialWalkZ(WaterColor, TheAngle - 15, TheAngle + 35, 60 + random(5), 2, 1, False, Rx, Ry) then
begin //rx,ry = watercolor coords
if ZenmaDebug then TakeScreen('Step');
X := Rx - Sx; //gets approximate middle
X := Round(X / 2);
X := X + Sx;
Mouse(X - Random(5) + Random(3), Ry + 4 + Random(3), 0, 0, True);
FFlag(10);
end else
begin
if ZenmaDebug then TakeScreen('Step');
WriteLn('Couldnt RRW FALSE');
LogOut;
Players[CurrentPlayer].Loc := 'RRWFALSE';
Players[CurrentPlayer].Active := False; //makes sure it isnt at beginning by south fally gate..if it is it will goto back there
Exit;
end;
if not (FindColor(Asx, Asy, RoadColor, MMX1, MMY1, MMX2, MMY2)) then RoadColor := GetANewRoadColor(RoadColor,False);
BridgeColor := AutoColorBridge;
OldBridgeColor := BridgeColor;
Flag;
if FindSymbol(Tx, Ty, 'Transportation') then
begin
ClickingSpot:
if FindColor(Nx, Ny, 60909, Tx - 10, Ty - 10, Tx + 10, Ty + 20) then
begin //average out points from dot to symbol and do random
if (Tx < Nx) then
begin
OldX := Nx;
Nx := Tx;
Tx := OldX;
end;
if (Ty < Ny) then
begin //make it go back on tree shit if not find it and do it here to
OldY := Ny;
Ny := Ty;
Ty := OldY;
end;
MouseBox((Tx - 5), (Ty - 5), (Nx + 5), (Ny + 4), 1);
Flag;
end else
begin
WriteLn('Couldnt Find Npc Dots Around trans symbol so clicking it =(');
Mouse(Tx - 4, Ty - 4, 4, 4, True);
FFlag(10);
end;
end else
begin
if AnyOfTheThree(Sx, Sy) then
begin //188 //here make it do above
WriteLn('Couldnt Find Transportation symbol so walking again');
Mouse(Sx + 2, Sy + 15, 6, 5, True);
FFlag(10);
if not (FindSymbol(Tx, Ty, 'transportation')) then Mouse(Sx + 2, Sy + 15, 6, 5, True) else goto ClickingSpot;
FFlag(10);
if not (FindSymbol(Tx, Ty, 'transportation')) then
begin
WriteLn('Couldnt Find transportation symbol');
LogOut;
Players[CurrentPlayer].Loc := 'NoTransSymbol';
Players[CurrentPlayer].Active := False;
Exit;
end else goto ClickingSpot;
end else
begin
if FindColorBottomRight(Sx, Sy, AutoColorBridge, MMX1, MMY1, MMX2, MMY2) then
begin
Mouse(Sx - 5, Sy - 6, 3, 3, True);
FFlag(10);
if not (FindSymbol(Tx, Ty, 'transportation')) then
begin
WriteLn('Couldnt Find transportation symbol');
LogOut;
Players[CurrentPlayer].Loc := 'NoTransSymbol';
Players[CurrentPlayer].Active := False;
Exit;
end else goto ClickingSpot;
end else
begin
WriteLn('Couldnt Find transportation symbol');
LogOut;
Players[CurrentPlayer].Loc := 'NoTransSymbol';
Players[CurrentPlayer].Active := False;
Exit;
end;
end;
end;
if FindSailor then //make sure to check for GEEPEES before leaving bank after walking is perfect
WriteLn('Found The Sailor and successfully chose option to board ship');
MakeCompass('n');
if FindColorTolerance(Px, Py, 4019818, MSX1, MSY1, MSX2, MSY2, 10) then
begin
if FindColor(Sx, Sy, 0, Px - 10, Py - 10, Px + 10, Py + 10) then
begin
MMouse(Px, Py, 5, 5);
if IsUpText('ros') then
begin
GetMousePos(Px, Py);
Mouse(Px, Py, 0, 0, True);
//out of boat
end else
if FindObjCustom(Mx, My, ['ros', 'ang', 'ank'], [3954025, 2110789, 4942467], 20)
then Mouse(Mx, My, 0, 0, True);
end else
if FindObjCustom(Mx, My, ['ros', 'ang', 'ank'], [3954025, 2110789, 4942467], 20)
then Mouse(Mx, My, 0, 0, True);
end else
if FindObjCustom(Mx, My, ['ros', 'ang', 'ank'], [3954025, 2110789, 4942467], 20)
then Mouse(Mx, My, 0, 0, True);
repeat
WriteLn('waiting to get out of boat');
if (GetColor(644, 95) <> 65536) then Break;
Wait(1000 + Random(1000));
until (False);
///////////WOOOOOOOOT AT KARAMJA DOCKS////////////////////////////////
WriteLn('At Karamja Docks!!!');
RoadColor := AutoColorKaramjaDirt;
RadialWalkZ(RoadColor, 230, 300, 60 + Random(5), 2, 2, True, Sx, Sy);
if not(FindColor(Sx,Sy,RoadColor,MMX1,MMY1,MMX2,MMY2)) then RoadColor := AutoColorKaramjaDirt;
RadialWalkZ(RoadColor, 240, 320, 60 + Random(5), 2, 2, True, Sx, Sy);
if FindSymbol(Sx, Sy, 'bar') then
WriteLn('Found Bar') else
begin
if not(FindColor(Sx,Sy,RoadColor,MMX1,MMY1,MMX2,MMY2)) then RoadColor := AutoColorKaramjaDirt;
RadialWalkZ(RoadColor, 277, 300, 60 + Random(5), 2, 2, True, Sx, Sy);
if not (FindSymbol(Sx, Sy, 'bar')) then
begin
WriteLn('Couldnt Find Bar symbol..');
LogOut;
Players[CurrentPlayer].Loc := 'No Bar Symbol';
Players[CurrentPlayer].Active := False;
Exit;
end;
end; //Find Bar place color
//find tree color using autocolor and if color not equal to
//bar place color its tree color
Flag;
if not(FindSymbol(Sx,Sy,'general store')) then
RadialWalkZ(RoadColor, 240, 300, 60 + Random(5), 2, 2, True, Sx, Sy)
else
WriteLn('Found General STore shoould be in range');
FFlag(6);
if not(FindColor(Sx,Sy,RoadColor,MMX1,MMY1,MMX2,MMY2)) then RoadColor := AutoColorKaramjaDirt;
RadialWalkZ(AutoColorTree(AutoColorBarBrown), 340, 416, 60 + Random(5), 2, 2, True, Sx, Sy);
Flag;
if FindSymbol(Sx, Sy, 'fishing spot') then
begin
Mouse(Sx, Sy, 4, 4, True);
Flag;
end else
begin
RadialWalkZ(AutoColorTree(AutoColorBarBrown), 45, 90, 60 + Random(5), 2, 2, True, Sx, Sy);
if not(FindSymbol(Sx,Sy,'fishing spot')) then
begin
WriteLn('Havent thought of a recorrecting thing for this so logging out couldnt find fishing spot');
LogOut;
Players[CurrentPlayer].Loc := 'No Bar Symbol';
Players[CurrentPlayer].Active := False;
Exit;
end else Mouse(Sx,Sy,4,4,True);
end;
Flag;
Result := True;
WriteLn('WOOT MADE IT TO KARAMJA DOCKS FLAWLESSLY!!!!');
//97-170
end;
//Mainloop
begin
ClearDebug;
ClearReport;
Declareplayers;
SetUpSrl;
MouseSpeed := 11;
wait(1000 + random(1000));
if RsAlwaysOnTop then SetClientPos(True) else SetClientPos(False); //so rs stays on top
WalkToKaramja;
end.