Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program new;
- {$DEFINE SMART}
- {$i SRL\SRL.scar}
- {$i Reflection\Reflection.Simba}
- const
- {Setup}
- S_World = 10;
- S_Membs = True;
- S_Signed = True;
- {Player Info}
- DontEat = 0;
- procedure DeclarePlayers;
- begin
- HowManyPlayers := 1;
- NumberOfPlayers(HowManyPlayers);
- CurrentPlayer := 0;
- with Players[0] do
- begin
- Name := '';
- Pass := '';
- Active := True;
- Arrays[DontEat] := []; //Slots not to eat (whole number, between 1 and 28), seperated by commas
- end;
- end;
- {*******************************************************************************
- function NavigateObstacle(HueModifier, SatModifier: Extended; Color, Tolerance,
- ATPADist, MouseRan: Integer; Split: Boolean;
- Uptext: string): Boolean;
- By: TomTuff
- Description: Navigates an agility obstacle. HueModifier and SatModifier are the
- Hue and Sat mods for CTS 2. Color is the color to search for. Tolerance is the
- color tolerance. ATPA dist is the distance to use when splitting the TPA to an
- ATPA. MouseRan is the how much randomness there should be to mousing. If you
- want to use SplitTPA, Split should be true. If split is false, TPAtoATPA will be
- used. Uptext is the text to search for. Returns true if the uptext is found, and
- then after clicking the red crosshair is found.
- *******************************************************************************}
- function NavigateObstacle(HueModifier, SatModifier: Extended; Color, Tolerance,
- ATPADist, MouseRan: Integer; Split: Boolean;
- Uptext: string): Boolean;
- var
- TPA: TPointArray;
- ATPA: T2DPointArray;
- x, y, i, CTS: Integer;
- HueMod, SatMod: Extended;
- begin
- if not(LoggedIn) then
- Exit;
- CTS := GetColorToleranceSpeed;
- GetColorspeed2Modifiers(HueMod, SatMod);
- SetColorToleranceSpeed(2);
- SetColorspeed2Modifiers(HueModifier, SatModifier);
- FindColorsTolerance(TPA, Color, MSX1, MSY1, MSX2, MSY2, Tolerance);
- SetColorspeed2Modifiers(HueMod, SatMod);
- SetColorToleranceSpeed(CTS);
- if (Length(TPA) < 1) then
- Exit;
- SortTPAFrom(TPA, Point(MSCX, MSCY));
- if Split then
- ATPA := SplitTPA(TPA, ATPADist)
- else
- ATPA := TPAtoATPA(TPA, ATPADist);
- for i := 0 to High(ATPA) do
- begin
- MiddleTPAEx(ATPA[i], x, y);
- MMouse(x - MouseRan, y - MouseRan, (2* MouseRan), (2 * MouseRan));
- Wait(300 + Random(300));
- if WaitUptext(Uptext, 1250) then
- begin
- ClickMouse2(True);
- Result := DidRedClick;
- end;
- if Result then
- Break;
- end;
- end;
- function AttemptObstacleAndSwivel(Hue, Sat: Extended; Color, Tol, ATPADist,
- MouseRan: Integer; Split: Boolean;
- Uptext: string; Attempts, SwivelPer, RanSwiv: Integer): Boolean;
- var
- i: Integer;
- begin
- for i := 1 to Attempts do
- begin
- if NavigateObstacle(Hue, Sat, Color, Tol, ATPADist, MouseRan, Split, Uptext) then
- begin
- Result := True;
- Exit;
- end;
- R_FindRandoms;
- MakeCompass(rs_GetCompassAngleDegrees + SwivelPer - RanSwiv + Random(2 * RanSwiv));
- Wait(800 + Random(200));
- end;
- end;
- function WalkAndWait(Tile: TTile): Boolean;
- var
- T: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- if not(WalkToTile(Tile, 0, 0)) then
- Exit;
- T := GetSystemTime + 6000;
- while (LoggedIn and (GetSystemTime < T)) do
- begin
- if not(CharacterMoving) then
- begin
- Result := True;
- Exit;
- end;
- WaitNone;
- end;
- end;
- function IntInArr(Int: Integer; Arr: TVariantArray): Boolean;
- var
- i: Integer;
- begin
- for i := 0 to High(Arr) do
- if (Int = Arr[i]) then
- begin
- Result := True;
- Exit;
- end;
- end;
- function EatFood: Boolean;
- var
- Box: TBox;
- i, StartCount, T: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- StartCount := InvCount;
- for i := 1 to 28 do
- begin
- if IntInArr(i, Players[CurrentPlayer].Arrays[DontEat]) then
- Continue;
- if not(ExistsItem(i)) then
- Continue;
- Box := InvBox(i);
- MMouse(Box.X1, Box.Y1, (Box.X2 - Box.X1), (Box.Y2 - Box.Y1));
- if WaitUptext('Eat', 500) then
- begin
- ClickMouse2(True);
- T := GetSystemTime + 1500;
- while (GetSystemTime < T) and not(Result) and LoggedIn do
- begin
- if (InvCount <> StartCount) then
- Result := True;
- WaitNone;
- end;
- end;
- if Result then
- Break;
- end;
- end;
- function UnderAttack: Boolean;
- var
- Me: TMe;
- NPCs: TNPCArray;
- i: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- Me := GetMe;
- if not(Me.InFight) then
- Exit;
- Result := True;
- NPCs := GetAllNPCs(False);
- for i := 0 to High(NPCs) do
- begin
- if InteractingWithMe(NPCs[i]) then
- begin
- Result := False;
- Exit;
- end;
- end;
- end;
- function WaitInBoxEx(Boxes: TBoxArray; MaxTime, WaitBetween, RanWait: Integer): Boolean;
- var
- T, i: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- T := GetSystemTime + MaxTime;
- while (GetSystemTime < T) do
- begin
- R_FindRandoms;
- for i := 0 to High(Boxes) do
- begin
- Result := MeInBox(Boxes[i]);
- if Result then
- Break;
- end;
- if Result then
- Break;
- Wait(WaitBetween + Random(RanWait));
- end;
- end;
- function WaitInBox(X1, Y1, X2, Y2, MaxTime, WaitBetween, RanWait: Integer): Boolean;
- begin
- Result := WaitInBoxEx([IntToBox(X1, Y1, X2, Y2)], MaxTime, WaitBetween, RanWait);
- end;
- function RecoverFromRopeSwing: Boolean;
- var
- T: Integer;
- MyPos: TTile;
- begin
- if not(LoggedIn) then
- Exit;
- if (HPPercent < 70) then
- if not(EatFood) then
- Exit;
- if WalkAndWait(Tile(3005, 10362)) then
- begin
- if AttemptObstacleAndSwivel(0.10, 0.73, 3358531, 15, 35, 5, False, 'mb-up', 16, 45, 8) then
- begin
- T := GetSystemTime + 9000;
- while (GetSystemTime < T) and LoggedIn do
- begin
- MyPos := GetMyPos;
- if (MyPos.Y < 10000) then
- begin
- Result := True;
- Wait(200 + Random(400));
- Exit;
- end;
- R_FindRandoms;
- Wait(200 + Random(50));
- end;
- end;
- end;
- end;
- function RecoverFromBalance: Boolean; //slightly redundant from above, but oh well
- var
- T: Integer;
- MyPos: TTile;
- Ex: Boolean;
- begin
- if not(LoggedIn) then
- Exit;
- if (HPPercent < 70) then
- if not(EatFood) then
- Exit;
- if WalkToTile(Tile(3003, 10346), 1, 3) then
- begin
- if WalkAndWait(Tile(3005, 10362)) then
- begin
- if AttemptObstacleAndSwivel(0.10, 0.73, 3358531, 15, 35, 5, False, 'mb-up', 16, 45, 6) then
- begin
- T := GetSystemTime + 9000;
- while (GetSystemTime < T) and LoggedIn do
- begin
- MyPos := GetMyPos;
- if (MyPos.Y < 10000) then
- begin
- Ex := False;
- Break;
- end;
- R_FindRandoms;
- Wait(200 + Random(50));
- end;
- if Ex then
- Exit;
- Result := WalkAndWait(Tile(2995, 3961));
- end;
- end;
- end;
- end;
- function R_ClimbRocks: Boolean; //Decided to incorporate attempts and compass rotating into the function itself, looks cleaner.
- label FuncStart;
- var
- Rocks: TTileArray;
- ChosenTile: TTile;
- Pt: TPoint;
- Attempts: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- Rocks := [Tile(2993, 3936), Tile(2994, 3936), Tile(2995, 3936)];
- FuncStart:
- ChosenTile := Rocks[Random(2)];
- Pt := TileToMS(ChosenTile, 0);
- MMouse(Pt.x - 4, Pt.y - 4, 8, 8);
- if WaitUptext('mb Roc', 1250) then
- begin
- Wait(80 + Random(30));
- ClickMouse2(True);
- Result := DidRedClick;
- end;
- if Result then
- Exit;
- Inc(Attempts);
- if (Attempts > 16) then
- Exit;
- MakeCompass(rs_GetCompassAngleDegrees + 45 - 6 + Random(12));
- goto FuncStart;
- end;
- procedure MainLoop;
- label RopeSwing, BalanceLog, LavaPit; //<3 labels
- var
- MyPos: TTile;
- begin
- if not(LoggedIn) then
- begin
- LoginPlayer;
- Wait(3000 + Random(1000));
- end;
- repeat
- SetAngle(True);
- {PIPE}
- if WalkAndWait(Tile(3004, 3937)) then
- begin
- if AttemptObstacleAndSwivel(0.56, 0.07, 6119010, 6, 30, 5, False, 'ze-thr', 16, 45, 6) then
- begin
- if not(WaitInBox(3003, 3951, 3005, 3949, 15000, 500, 200)) then
- Logout;
- end else Logout;
- end else Logout;
- {/PIPE}
- {SWING}
- RopeSwing:
- if WalkAndWait(Tile(3005, 3953)) then
- begin
- if AttemptObstacleAndSwivel(0.16, 1.07, 795432, 10, 5, 0, True, 'on Rop', 16, 45, 6) then
- begin
- if WaitInBoxEx([IntToBox(3004, 3959, 3006, 3958), IntToBox(3003, 10357, 3006, 10354)], 15000, 500, 200) then
- begin
- MyPos := GetMyPos;
- if (MyPos.Y > 10000) then
- if RecoverFromRopeSwing then
- goto RopeSwing
- else
- Logout;
- end else Logout;
- end else Logout;
- end else Logout;
- {/SWING}
- if LoggedIn then
- Wait(600 + Random(400));
- {LAVA}
- LavaPit:
- if AttemptObstacleAndSwivel(0.17, 0.73, 2376274, 10, 10, 4, True, 'ss Step', 16, 45, 6) then
- begin
- if WaitInBoxEx([IntToBox(2995, 3961, 2996, 3959), IntToBox(3001, 3964, 3003, 3962)], 15000, 500, 200) then
- begin
- if MeInBox(IntToBox(3001, 3964, 3003, 3962)) then
- goto LavaPit
- end else Logout;
- end else Logout;
- {/LAVA}
- {LOG}
- BalanceLog:
- if WalkAndWait(Tile(3001, 3946)) then
- begin
- if AttemptObstacleAndSwivel(0.06, 0.39, 932195, 10, 30, 5, False, 'cross L', 16, 45, 6) then
- begin
- if WaitInBoxEx([IntToBox(2993, 3946, 2995, 3944), IntToBox(2994, 10349, 3002, 10342)], 15000, 500, 200) then
- begin
- MyPos := GetMyPos;
- if (MyPos.Y > 10000) then
- if RecoverFromBalance then
- goto BalanceLog
- else Logout;
- end else Logout;
- end else Logout;
- end else Logout;
- {/LOG}
- {ROCKS}
- if WalkAndWait(Tile(2996, 3937)) then
- begin
- if (R_ClimbRocks or AttemptObstacleAndSwivel(0.00, 0.13, 4539720, 5, 30, 5, False, 'mb Roc', 16, 45, 6)) then //Reflection primary func for this one because it was very difficult with color
- begin
- if not(WaitInBox(2993, 3933, 2996, 3932, 15000, 500, 200)) then
- Logout;
- end else Logout;
- end else Logout;
- {/ROCKS}
- until(not(LoggedIn));
- end;
- begin
- Smart_Server := S_World;
- Smart_Members := S_Membs;
- Smart_Signed := S_Signed;
- Smart_SuperDetail := False;
- SetupSRL;
- DeclarePlayers;
- MainLoop;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement