Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { Humidify Script, made on December 31, 2013 by samerdl. Happy new year
- Updated and posted on January 11, 2014.
- Have a great civilian year.
- **** Instructions ****
- 1) Have the Humidify spell runes: Water staff, Fire & astral runes.
- 2) Make or buy a fishbowl (42 crafting), place it in Inv slot #5.
- 3) Ease up your PC's CPU usage, memory leaks can mess it up.
- 4) Stand at spots with no random events I.E: GWD, PC bank/boat.
- 5) Setup the script and launch.
- **** Topic ****
- http://villavu.com/forum/showthread.php?t=107550&p=1279873#post1279873
- First script in a while
- Thanks for everything SRL
- Hi Hoodz Hi Wilco
- {* *}
- program Humidify;
- {$DEFINE SMART8}
- {$I SRL-OSR/SRL.Simba}
- {$i SRL-OSR\SRL\misc\debug.simba}
- {$i SRL-OSR\SRL\misc\SmartGraphics.simba}
- {$I SRL-OSR/SRL/Reflection/Reflection.simba}
- {$I SRL-OSR/SRL/misc/al_functions.simba}
- var
- worldshopped, w, messedup, Cast, timer: integer;
- TimeTillBreak: string;
- const
- {Fail Safes}
- Breakhandler = true; // Breaks settings.
- BreakTime1 = 45; // how long to play before breaking.
- BreakTime2 = 120; // ----
- BreakWait1 = 15; // how long to break for.
- BreakWait2 = 30; // -----
- {Fail Safes}
- SpellColor= 9861723; // Humidify Color at the coords: 565,248, change it.
- debugScolor = false; // Debugs the Humidify Spell Color at the start.
- SafeTimer = 25000; // Maximum Fail Safe timer, logs out when it passes.
- AreaCheck = false; // assign a polygon area as 'your area'
- decoords = false; // Debugs your Coords from reflection to debugbox.
- XCord1 = 2920; // coords for the polygon.
- Xcord2 = 2940; // if script isn't inside coords, it will terminate.
- YCord1 = 5340; // a fail safe, can be disabled.
- YCord2 = 5360; // Uses reflection of course.
- RuneCheck = true; // Checks if you've run out of runes.
- HopPlayers= true; // hops worlds if another player appears in the area.
- Dotected = 1; // If More than X white dots, script Hops worlds.
- TermCheck = true; // If errors compile, it allows for termination.
- Procedure PlayerSetup;
- Begin
- HowManyPlayers := 1; // How many players are you using?
- NumberOfPlayers(HowManyPlayers);
- CurrentPlayer := 0;
- With Players[0] Do // What are the preferences for each player?
- Begin
- Name := 'zezima';
- Pass := 'iscool';
- Nick := 'ezim';
- LampSkill := Skill_Herblore;
- Active := True;
- End;
- End;
- {Credits to SRL OSR Dev Team, i just added the Green Color to locate magic}
- function GetGreenUptext: string;
- var
- WhiteT, BlueT, YellowT, OrangeT, GreenT, FoundText: string;
- begin
- WhiteT := GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'UpChars07');
- BlueT := GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 13423640, 65, 'UpChars07');
- YellowT := GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 1235160, 40, 'UpChars07');
- OrangeT := GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 4687583, 53, 'UpChars07');
- GreenT := GetTextAtExWrap(8, 8, 150, 21, 0, 5, 1, 120577, 65, 'UpChars07');
- FoundText := WhiteT + ' ' + BlueT + YellowT + OrangeT + GreenT;
- FoundText := ReplaceWrap(FoundText, '.', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '/', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '\', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, ',', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '*', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '^', '', [rfReplaceAll]);
- FoundText := ReplaceWrap(FoundText, '"', '', [rfReplaceAll]);
- Result := FoundText;
- end;
- {had to add this, so the command wouldn't break, only added green color}
- function IsUpTextMultiCustom2(Text: TStringArray): Boolean;
- var
- TheText: string;
- i, n: Integer;
- begin
- TheText := GetGreenUptext;
- n := High(Text);
- for i := 0 to n do
- if (Pos(Text[i], TheText) > 0) then
- begin
- Result := True;
- Exit;
- end;
- end;
- {Same as above}
- function WaitUpTextMulti2(S: TStringArray; Time: Integer): Boolean;
- var
- T: Integer;
- begin
- Result := false;
- T := GetSystemTime + Time;
- while (GetSystemTime < T) do
- begin
- if (IsUpTextMultiCustom2(S)) then
- begin
- Result := True;
- Exit;
- end;
- Wait(20 + Random(20));
- end;
- end;
- procedure StartTime;
- begin // generates a random time for breaking, after a break is done this command is run again to generate next break time.
- Timer := GetTimeRunning + RandomRange(BreakTime1 * 60000, BreakTime2 * 60000);
- end;
- {Termination makes sure we end our script at any cost, it still tries to end it safely first and if that fails, it ends it regardless}
- procedure Termination(const Status: string);
- begin
- if (TermCheck = false) then // Users can Enable/disable termination checks
- exit;
- writeln(Status); // Prints our reason for termination
- if loggedin then // if we're logged in, it will log us out.
- begin
- if WaitFunc(@ LogOut, 500, RandomRange(8000, 20000)) then // waits for the script to log out.
- terminatescript
- else
- terminatescript; // if it doesn't manage to log out, it ends anyway
- end else
- terminatescript; // and if we're not loggedin it ends.
- end;
- function LogMeOut: boolean;
- begin
- writeln('Logging out..');
- if WaitFunc(@ LogOut, 500, RandomRange(8000, 20000)) then
- begin //Logging out is buggy right now on OSRS, it needs some extra time
- writeln('We have managed to log out');
- result := true;
- end else //ends script if we fail to logout
- termination('We have failed to log out, ending script');
- end;
- procedure TakeBreaks;
- var
- T, BreakTimer: integer;
- begin
- if (BreakHandler = false) then
- Exit;
- if (GetTimeRunning >= Timer) then // Checks if its time to break
- begin
- BreakTimer := Randomrange(BreakWait1 * 60000, BreakWait2 * 60000); // Calculates a time to break for
- MarkTime(T);
- writeln('It is time to take a break');
- WriteLn('Breaking for: ' + (MsToTime(BreakTimer, Time_Formal)));
- if LogMeOut then
- begin
- while (TimeFromMark(T) < BreakTimer) do // Credits & Props to P1ng for proper formating advise!
- Wait(RandomRange(1500, 2500)); // wait time is important so Simba can cycle throug the memory slowly without causing CPU leaks
- WriteLn('Completed break, re-starting script');
- StartTime; // Calculates next break's timer.
- end else // if it fails to log out then script ends.
- termination('We have failed to log out for our break, ending script');
- end;
- end;
- {random time - of waittime for activities}
- procedure WaitShortClick;
- begin
- if (not (loggedin)) then
- exit;
- case random(600) of
- 1..450: Wait(RandomRange(100, 150));
- 451..570: Wait(RandomRange(150, 200));
- 571..590: Wait(RandomRange(200, 250));
- 591..600: Wait(RandomRange(250, 400));
- end;
- end;
- procedure WaitShortClick2;
- begin
- if (not (loggedin)) then
- exit;
- case random(600) of
- 1..450: Wait(RandomRange(400, 450));
- 451..570: Wait(RandomRange(450, 500));
- 571..590: Wait(RandomRange(500, 550));
- 591..600: Wait(RandomRange(550, 600));
- end;
- end;
- procedure WaitHumanClick;
- begin
- if (not (loggedin)) then
- exit;
- case random(600) of
- 1..450: Wait(RandomRange(600, 650));
- 451..570: Wait(RandomRange(650, 700));
- 571..590: Wait(RandomRange(700, 750));
- 591..600: Wait(RandomRange(750, 800));
- end;
- end;
- procedure WaitHumanClick2;
- begin
- if (not (loggedin)) then
- exit;
- case random(600) of
- 1..450: Wait(RandomRange(800, 1000));
- 451..570: Wait(RandomRange(1000, 1200));
- 571..590: Wait(RandomRange(1200, 1400));
- 591..600: Wait(RandomRange(1400, 2000));
- end;
- end;
- function NotchatTabAll: boolean;
- var
- Monster: TpointArray;
- TmpCts: Integer;
- begin
- if (not (loggedin)) then
- exit;
- tmpCTS := GetColorToleranceSpeed;
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.10, 0.34); // Looks for the Color on Chat tab activity "all"
- result := FindColorsTolerance(Monster, 4213586, 6, 482, 60, 497, 11); // If color isn't present, i.e chat tab changed, then its false and clicks chat tab to all
- ColorToleranceSpeed(0);
- SetColorSpeed2Modifiers(0.2, 0.2); // This is used to find text of the 'magic word' so when we run out of runes..
- end;
- procedure MakeMyChatTabAll;
- begin
- if (not (loggedin)) then
- exit;
- writeln('Our chat Tab is not set to all, making chat tab to all');
- mousebox(12, 485, 45, 497, 1); // CLicks teh chat tab.
- end;
- procedure ProgressReport;
- var
- Timeleft, XpPerhour, Casts, CastsPH: Integer;
- begin
- if (not (loggedin)) then
- exit;
- ClearDebug;
- FindNonInventoryRandoms(); // finds randoms.
- findnoninventoryrandoms; // and prints progress report.
- XpPerhour := (3600 * (Cast) / ((GetTimeRunning / 1000)));
- Casts := (Cast) CastsPH := (3600 * (Casts) / ((GetTimeRunning / 1000)));
- timeleft := ((Timer) - (GetTimeRunning));
- TimeTillBreak := (MsToTime(timeleft, Time_Formal));
- WriteLn('* FHumidify v 1.0');
- WriteLn('* Runtime: ' + TimeRunning);
- Writeln('*');
- writeln('* No.Of Casts: ' + IntToStr(Cast) + ' Casts P/H: ' + IntToStr(XpPerhour) + ' Times messed up ' + IntToStr(messedup));
- if (Breakhandler = true) then
- Writeln('* Time till break : ' + (TimeTillBreak));
- end;
- procedure HoverNearbyNpc;
- var
- I: Tpointarray;
- P: Integer;
- begin
- if (not (loggedin)) then
- exit;
- I := GetMiniMapDots('npc'); // Gets all the NPC dots on the screen
- if (length(I) > 0) then // If the Length of the TPA is Larger than 0 then continues..
- begin
- SortTPAFrom(i, Point(MMCX, MMCY)); // Sorts them from Middle points of minimaps
- P := random(length(I)); // Assigns a length to the TPA
- Mmouse(I[0].x, I[0].y, 3, 3); // Moves mouse on the NPC mini map dot.
- end;
- end;
- procedure Keyboards;
- begin
- case random(5) of
- 0..2: // keyboard antibans
- begin
- KeyDown(37);
- WaitShortClick KeyUp(37); // moves key up/down.
- WaitShortClick KeyDown(40);
- WaitShortClick KeyUp(40);
- end;
- 3..4:
- begin
- KeyDown(39);
- WaitShortClick KeyUp(39);
- WaitShortClick KeyDown(38);
- WaitShortClick KeyUp(38);
- end;
- 5:
- begin
- KeyDown(38);
- WaitShortClick KeyUp(38);
- WaitShortClick KeyDown(39);
- WaitShortClick KeyUp(39);
- end;
- end;
- end;
- procedure Antiban;
- begin
- if (not (loggedin)) then // Our antiban,
- exit;
- case random(100) of
- 0..56:
- begin
- end;
- 57..100:
- begin
- case random(150) of
- 10: hoverskill(skill_magic, false);
- 20: BoredHuman;
- 30: MMouseOffClient('top');
- 40: MMouseOffClient('left');
- 50: MMouseOffClient('right');
- 60: MMouseOffClient('bottom');
- 70: SmallRandomMouse;
- 80: RandomAngle(1);
- 90: RandomAngle(2);
- 100: PickUpMouse;
- 110: CompassMovement(10, 70, true);
- 120: HoverNearbyNpc; // Thats the procedure above
- 130: Keyboards; // Same as above
- 140: MissMouse(250, 250);
- 150: RandomMovement; // Rest are from the include.
- 160: CompassMovement(240, 300, true);
- 170: AdjustMouseSpeed(3, 10, 20);
- 180: RandomFKeys(true);
- 190: RandomTab(true);
- end;
- end;
- end;
- end;
- function GotRunes: boolean;
- var
- x: integer;
- begin
- if (not (loggedin)) then
- exit;
- if (RuneCheck = false) then // If Its disabled by the user then exists.
- exit;
- if not GameTab(tab_magic) then // if we're not on mage tab then exists.
- exit;
- x := GetColor(565, 248) if (debugScolor = true) then // Finds the blue spell color
- begin
- writeln('Our Humidify Spell Color is: ' + IntToStr(x)); // If we're out of runes then it will be black and terminate.
- writeln('please set DebugSColor to false now');
- Termination('We have received the correct color for the Humidify spell spot, please edit it and disable Rune color debugging');
- end;
- if (X = SpellColor) then // if Its blue then this is true!.
- result := true
- end;
- function PlayersDetected: boolean;
- var
- P: Integer;
- begin
- if (not (loggedin)) then
- exit;
- if (HopPlayers = false) then
- exit;
- P := CountDots('white'); // counts player dots
- if (P > Dotected) then // if its more than the allowed amount, script will log out.
- begin
- writeln('we have more than one player on the map, logging out');
- result := true;
- end;
- end;
- {Credits to Elffy & SRL OSR dev team, just had to copy paste it into script since
- Include didn't have it at the time}
- Procedure OpenWScreen;
- begin // Opens our world screen.
- if WorldScreen then // If its already there then exists
- exit; // IF we are logged in then exists.
- if Loggedin then
- Exit;
- if not WorldScreen then // If we're not on world screen Then it opens it.
- begin
- Mmouse(54, 475, 1, 1);
- ClickMouse2(Mouse_Left);
- waithumanclick;
- end;
- end;
- function whitecolor: boolean; // Detects the white color you would see once
- var // Your mouse is hovering a world
- Monster: TpointArray;
- TmpCts: Integer;
- begin
- tmpcts := GetColorToleranceSpeed;
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.22, 1.69);
- result := FindColorsTolerance(Monster, 9163999, 192, 67, 583, 469, 4);
- ColorToleranceSpeed(tmpcts);
- SetColorSpeed2Modifiers(0.2, 0.2);
- end;
- procedure loginloop;
- var
- badworlds: TIntegerArray;
- OurCurrentworld: Integer;
- begin
- badworlds := [308, 316, 325, 337, 365];
- OpenWorldScreen;
- waithumanclick;
- repeat
- if whitecolor then
- break;
- if not whitecolor then
- writeln('We have not hovered a world yet');
- case random(10) of
- 0..2: mouse(randomrange(397, 554), randomrange(78, 394), 1, 1, mouse_move);
- 3..4: mouse(randomrange(298, 462), randomrange(200, 392), 1, 1, mouse_move);
- 5..6: mouse(randomrange(205, 555), randomrange(80, 154), 1, 1, mouse_move);
- 7..10: mouse(randomrange(211, 555), randomrange(246, 367), 1, 1, mouse_move);
- end; // Obviously its bad to just randomly move mouse.. I've tried and fail in creating a proper math formula to resolve this
- until (whitecolor); // The above works perfectly :).
- if whitecolor then
- begin
- clickmouse2(mouse_left); // Clicks the world as it is selected.
- waithumanclick;
- currentworld;
- waithumanclick;
- OurCurrentworld := CurrentWorldLS;
- waithumanclick; // Finds what our current world is
- if InIntArray(Badworlds, OurCurrentworld) then //If its a bad one then exists
- exit; // Bads are: f2p, Pvp and high risk world, it exists and repeats process
- waithumanclick;
- loginplayer; // if not then it logs in and resumes script.
- exit; // This is a bit useless but just another extra fail safe.
- end;
- end;
- function BowlWater: boolean;
- var
- TPA: TpointArray;
- begin
- if (not (loggedin)) then
- exit; // Finds the bowl Of water when its full
- ColorToleranceSpeed(2);
- SetColorSpeed2Modifiers(0.52, 1.09);
- result := FindColorsTolerance(TPA, 8415075, 565, 247, 592, 270, 1);
- ColorToleranceSpeed(1);
- SetColorSpeed2Modifiers(0.02, 0.2);
- end;
- function InsideSafeSpot: boolean;
- begin
- if (not (loggedin)) then
- exit;
- result := R_inPolygon([point(xcord1, ycord1), point(Xcord1, ycord2), point(xcord2, ycord2), point(xcord2, ycord2)]);
- if (result = false) then
- begin // A fail safe using reflection, detects the position the player designed as his training area.
- writeln('we are lost!');
- termination('We are not in Safe spot, terminating, if you dont wish to use Safe spot detection then set it to false!');; // if its not inside then it starts the termination procedure.
- end;
- end;
- procedure Clickbowl;
- begin
- if not loggedin then
- exit;
- if (AreaCheck = true) then
- InsideSafeSpot;
- if WaitUpTextMulti2(['Empty'], 300) then
- begin
- clickmouse2(mouse_left);
- case random(100) of
- 0..50: waithumanclick; // if the mouse is already on the bowl
- 50..60: waitshortclick;
- 61..80: waitshortclick2;
- 81..95: waithumanclick2;
- 96.100: antiban;
- end;
- exit;
- end;
- case random(100) of
- 0..50: waitshortclick; // Loads of wait times
- 50..60: waitshortclick2;
- 61..80: waithumanclick;
- 81..95: waithumanclick2;
- 96.100: antiban;
- end;
- case random(20) of
- 0..16: Mouse(RandomRange(572, 574), RandomRange(251, 253), random(1), random(1), mouse_move);
- 17..18: Mouse(RandomRange(575, 575), RandomRange(260, 262), random(1), random(1), mouse_move);
- 19..20: Mouse(RandomRange(572, 575), RandomRange(255, 270), random(1), random(1), mouse_move); // First inventory Slot,
- end;
- if WaitUpTextMulti2(['Empty'], 300) then
- begin
- clickmouse2(mouse_left);
- case random(100) of
- 0..50: waithumanclick; // Empties it and does wait/antibans.
- 50..60: waitshortclick;
- 61..80: waitshortclick2;
- 81..95: waithumanclick2;
- 96.100: antiban;
- end;
- end;
- end;
- procedure clickmagic;
- var
- t: integer;
- begin
- if not loggedin then
- exit;
- if (AreaCheck = true) then
- InsideSafeSpot; // Goes to the magic tab and clicks the Humidify spell.
- if BowlWater then
- exit; // If we already have the bowl of water, we can't humidify it :p.
- case random(10) of
- 0..8: FTab(tab_magic); // Switches to mage tab.
- 9..10: GameTab(tab_magic);
- end;
- case random(100) of
- 0..50: waithumanclick;
- 50..60: waitshortclick;
- 61..80: waitshortclick2; // a small wait time or antiban.
- 81..95: waithumanclick2;
- 96.100: antiban;
- end;
- if gametab(tab_magic) then
- begin
- if not GotRunes then // if we're out of runes i.e no blue color on the spell then ends.
- Termination('we Dont have any runes left, ending script');
- case random(10) of
- 0..8: Mouse(RandomRange(571, 574), RandomRange(251, 253), random(1), random(1), mouse_move);
- 9..10: Mouse(RandomRange(560, 570), RandomRange(247, 260), random(1), random(1), mouse_move); // moves mouse to the humidify spot
- end;
- if WaitUpTextMulti2(['Cast Humidify'], 300) then // If the Cast option is in the uptext... We did it right!
- begin
- clickmouse2(mouse_left);
- case random(10) of
- 0..8: FTab(tab_Inv); // clicks on it, it doesn't automatically switch you to inv tab.
- 9..10: GameTab(tab_Inv);
- end;
- Inc(cast);
- progressreport; // Prints progress and begins a fail safe to see if it was done.
- marktime(t);
- repeat
- wait(400);
- if not loggedin then
- exit;
- if BowlWater then
- exit; // This is a short, just an extra fail safe.
- if not gametab(tab_inv) then // If we didn't find the bowl of water then we messed up!.
- gametab(tab_inv);
- until (TimeFromMark(t) >= SafeTimer) or (bowlwater);
- if (TimeFromMark(T) >= SafeTimer) then
- begin
- writeln('something went wrong, the bowl full of water never appeared');
- inc(messedup); // If we messed up somehow, we'll just log out and log back in. Just a really extra fail safe, should never happen.
- repeat
- wait(400);
- Logout;
- if not loggedin then
- exit;
- Logout;
- until (not loggedin)
- end;
- end
- else
- begin // We didn't find the Humidify cast in uptext.
- writeln('we messed up, we dont have cast humidify in select, probably a CPU leak issue from client side');
- Mouse(RandomRange(740, 755), RandomRange(290, 330), random(2), random(2), mouse_left);
- inc(messedup); // Clicks far right on the screen to unclick any mouse movement.
- case random(100) of
- 0..50: waithumanclick;
- 50..60: waitshortclick;
- 61..80: waitshortclick2;
- 81..95: waithumanclick2;
- 96.100: antiban;
- end;
- end;
- end;
- end;
- {our second main loop}
- procedure magicloop;
- begin
- if not loggedin then // if we're not logged in then exit!
- exit;
- takebreaks;
- if PlayersDetected and (HopPlayers = true) then // if players are detect then log us out and hop!
- LogMeOut;
- if NotchatTabAll then // if We're not on 'all' chat tab, then make it on all so we can know when we run out of runes.
- MakeMyChatTabAll;
- if (AreaCheck = true) then // if we enabled training area checks, then check it.
- InsideSafeSpot;
- if BowlWater then // If we have the bowl of water then empty it.
- clickbowl;
- if not BowlWater then // if we don't have the bowl of water then humidify it!.
- Clickmagic;
- end;
- procedure mainloop;
- begin
- if not loggedin then // and it all breaks down to..
- exit;
- if loggedin then
- magicloop;
- end;
- procedure DebugPosition;
- var
- t: integer;
- point1: tpoint; // Debugs our position so we can create polygon cords for safe spot.
- begin
- marktime(t);
- repeat
- wait(400);
- Point1 := R_GetTileGlobal;
- writeln(point1);
- FindNonInventoryRandoms();
- findnoninventoryrandoms;
- until (TimeFromMark(t) >= SafeTimer);
- end;
- procedure DebuggSColor;
- var
- t: integer;
- begin
- marktime(t); // Debugs the Blue Color when humidify is visible in magic tab. (I.E not black/out of runes).
- repeat
- wait(400);
- GotRunes;
- FindNonInventoryRandoms();
- findnoninventoryrandoms;
- until (TimeFromMark(t) >= SafeTimer);
- end;
- procedure startitup;
- begin
- Playersetup;
- SetupSRL;
- ActivateClient;
- SRL_CombatRandoms := False; // Starts our script up
- StartTime;
- if (decoords = true) then // if a user wants to debug cords..
- DebugPosition;
- if (debugScolor = true) then // if a user wants to debug the color.
- DebuggSColor; // after both are done, we'll get back to the script!.
- end;
- begin
- startitup;
- repeat
- wait(400);
- if loggedin then
- mainloop;
- if not loggedin then
- loginplayer;
- until (false);
- writeln('how did we get here...');
- end.
Advertisement
Add Comment
Please, Sign In to add comment