/////////////////////////////////////////////////////////////////////// // // // READ THE DIRECTIONS IN THE OP FIRST OR ELSE // // Make sure you have setup your player file // // Under SRL>PlayerManager // // Press Play // // // /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// // // // Don't touch below this line unless you know what you're doing!! // // // /////////////////////////////////////////////////////////////////////////////////////////// program AshamanFletcher; {$DEFINE SMART} {$I SRL-6/SRL.Simba} {$i srl-6/lib/misc/srlplayerform.simba} var itemCount, XP, slot, startingXP, itemsPH, XPH, Bir, Bfr: Integer; timeout, currentBTime: TTimeMarker; W,X,Y,Z,RealBTime,BreakRounds,TotalBreaks,MouseB,AntiB: Integer; itemType: String; debug: Boolean; const scriptVersion = '1.8'; procedure declarePlayers(); var i,j: integer; begin players.setup(playerForm.playerNames, playerForm.playerFile); // load the SPF players from the SRL Player Manager currentPlayer := 0; // player to use first // set player attributes based on the settings from the form for i := 0 to high(players) do with players[i] do begin // convert the integers integers[0] := strToInt(playerForm.players[i].settings[2]); //minutes until break integers[1] := strToInt(playerForm.players[i].settings[3]); //minutes to break ismember:=true; for j := 0 to high(playerForm.comboBoxItems[1]) do if (playerForm.players[i].settings[10] = playerForm.comboBoxItems[1][j]) then integers[2] := j; //bankinglocation integers[3] := strToInt(playerForm.players[i].settings[1]); //minutes to break World := strToInt(playerForm.players[i].settings[4]); //world for j := 0 to high(playerForm.comboBoxItems[2]) do //quickload if (playerForm.players[i].settings[11] = playerForm.comboBoxItems[2][j]) then integers[4] := j+3; // booleans booleans[0] := strToBool(playerForm.players[i].settings[5]); booleans[1] := strToBool(playerForm.players[i].settings[6]); FindMod := strToBool(playerForm.players[i].settings[7]); debug := strToBool(playerForm.players[i].settings[8]); // any other data types you've decided to use strings[0] := playerForm.players[i].settings[0]; //quickkey strings[1] := playerForm.players[i].settings[9]; //cleanorpots end; end; // initiates the SRL player form (you aren't restricted to the procedure name; it can be whatever you want) procedure initPlayerForm(); begin with playerForm do begin name := 'AshamanFletcher v'+toStr(ScriptVersion); // the title of the SPF, usually the name of your script scriptHelpThread := ''; // a link to a help thread, if set to '' will link to my setup guide scriptSettingsPath := ''; // where you want the settings file to be saved; saved in script's path by default editBoxLabels := ['QuickKey', 'ProductionBox', 'Minutes until Break', '# of Minutes to Break', 'World']; // edit boxes are created for each array element editBoxDefaults := [ '0', '3', '600', '15','0']; // optional default values for each edit box; array length must equal editBoxLabel length checkBoxLabels := ['Take Breaks', 'Switch Worlds (After Break)', 'Logout if Mod is near', 'Debug']; // same as editBoxLabels but for check boxes checkBoxDefaults := ['True','True','True', 'False']; comboBoxLabels := ['CutOrString','Location','QuickLoad']; // same as editBoxLabels but for combo boxes (drop down boxes) comboBoxDefaults := ['Cut','NPC_BLUE','PRESET_1']; // this needs to be done for every element in the comboBoxLabels array setLength(comboBoxItems, length(comboBoxLabels)); comboBoxItems[0] := ['Cut', 'String']; // all the options available for the first combo box comboBoxItems[1] := ['NPC_BLUE', 'NPC_GREY', 'NPC_GREEN', 'NPC_DRAYNOR', 'BANK_BOOTH', 'CHEST_SW', 'CHEST_SHANTAY', 'CHEST_DUEL', 'CHEST_CW', 'CHEST_GROTTO', 'CHEST_LUMBRIDGE', 'TABLE_BURTHORPE']; // all the options available for the first combo box comboBoxItems[2] := ['PRESET_1', 'PRESET_2']; end; end; procedure debugSPFSettings(); var i: integer; begin writeln(''); writeln('Player file: ', playerForm.playerFile); for i := 0 to high(players) do begin writeln('QuickKey: ', players[i].strings[0]); writeln('Minutes until Break: ', players[i].integers[0]); writeln('# of Minutes to Break: ', players[i].integers[1]); writeln('Take Breaks: ', players[i].booleans[0]); writeln('Switch Worlds (After Break): ', players[i].booleans[1]); writeln('Logout if Mod is near: ', players[i].findmod); writeln('CleanOrPots: ', players[i].strings[1]); writeln('Location: ', players[i].integers[2]); writeln(''); end; end; {******************************************************************************* Function AutoupdateMe; By: Shuttleu Edited By: Ashaman88 Description: Autoupdates Script. *******************************************************************************} Procedure AutoUpdateMe; Var Neifile: Integer; OnlineVersion, NewScript, NeiFeilNennen: String; Begin Writeln('Checking for script updates...'); OnlineVersion := GetPage('http://ashamanfletcher.googlecode.com/git/Version.txt'); Writeln('Online Version: '+ToStr(OnlineVersion)); Writeln('Local Version: '+ToStr(ScriptVersion)); If (trim(OnlineVersion) > ScriptVersion) Then Begin WriteLn('Newer script version online!'); WriteLn('Autoupdating to newer version.'); NewScript := GetPage('http://ashamanfletcher.googlecode.com/git/AshamanFletcher.simba'); NeiFeilNennen := ScriptPath+ 'AshamanFletcher V'+OnlineVersion+'.simba'; Neifile := Rewritefile(NeiFeilNennen, true); Try WriteFileString(Neifile, NewScript); Except Begin WriteLn('Fatal error writing to '+NeiFeilNennen+'!!'); Terminatescript; End; End; CloseFile(Neifile); WriteLn('New script downloaded to '+NeiFeilNennen+'!! Please use this one!!'); TerminateScript; End Else WriteLn('You have the latest version of the script!'); End; function TRSChatBox.getXP: Integer; var b: TBox; s: String; tpa : TPointArray; atpa : T2DPointArray; i,cts,p: Integer; begin b := self.getBounds(); b.edit(+(b.x2-b.x1)-140, +10, -5, -94); findColorsTolerance(tpa, 14013909, b, 4,colorSetting(2, 0.00, 0.00)); if length(tpa) < 2 then begin print('chatBox.getXP(): No XP found', TDebug.SUB); Exit; end; atpa := tpa.cluster(5); b:= atpa.getbounds; b.edit(-2,-2,+2,+3); s:=Replace(tesseractgettext(b.x1,b.y1,b.x2,b.y2, FILTER_SMALL_CHARS), ' ', '', [rfReplaceAll]); P := Pos('x', S); if P > 0 then Result := StrToIntDef(ExtractFromStr(Copy(s, P, Length(S)), Numbers), 0) else Result := StrToIntDef(ExtractFromStr(S, Numbers), 0); print('chatBox.getXP(): XP found: ' + tostr(result), TDebug.SUB); end; procedure findNormalRandoms; begin exitTreasure; claimTicket; end; Function Antiban: Boolean; Var I: Integer; Begin I := Random(600); Case I Of 1: boredHuman(false); 2..7: Begin hoverSkill(Skill_Fletching); Wait(GaussRangeInt(600,2000)); End; 8..50: mouseMovingObject; 51..100: SleepAndMoveMouse(GaussRangeInt(100,MouseB)); 101..400: Begin MouseOffClient(Random(4)); Wait(GaussRangeInt(0, MouseB)); End; 501..600: Wait(GaussRangeInt(0, 2000)); End; Wait(GaussRangeInt(0, AntiB)); End; Procedure ProgressReport; Var TTB: Integer; Begin ClearDebug; TTB := (((W) + (Y) + BreakRounds)-GetTimeRunning); XP := (ChatBox.GetXP - StartingXP); XPH := Round(XP * (3600.0 / (GetTimeRunning / 1000.0))); ItemsPH := Round((ItemCount * (3600.0 / (GetTimeRunning / 1000.0)))); writeln('|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|'); writeln('| AshamanFletcher v'+PadR(toStr(ScriptVersion), 24), '|'); writeln('|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|'); writeln(PadR('| Running For: '+TimeRunning, 60)+'|'); writeln(PadR('| '+ItemType+'''s Made: ' + GroupDigits(ItemCount,','), 40) + padR('Made/H: ' + GroupDigits(ItemsPH,','), 20) + '|'); writeln(PadR('| Exp Earned: ' + GroupDigits(XP,','), 40) + padR('Exp/Hour: ' + GroupDigits(XPH,','), 20) + '|'); writeln('|___________________________________________________________|'); writeln('|___________________________________________________________|'); If Players[CurrentPlayer].Booleans[0] Then Writeln('Time until break: '+MsToTime(TTB, Time_Bare)); End; Function BreakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean; Var H,M,S: Integer; Begin If Not IsLoggedIn Then Exit; If (GetTimeRunning < ((W) + (Y) + BreakRounds)) Then Exit Else If (GetTimeRunning > ((W) + (Y) + BreakRounds)) Then Begin RealBTime := Round((X+Z)/60000); Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.'); Players[CurrentPlayer].Logout; CurrentBTime.Reset; CurrentBTime.Start; Repeat Wait(21000); ConvertTime((X+Z)-CurrentBTime.GetTime,H,M,S); Writeln('Breaktime left: '+IntToStr(H)+':'+IntToStr(M)+':'+IntToStr(S)); Until(CurrentBTime.GetTime>(X+Z)); Writeln('Logging in.'); If Players[CurrentPlayer].booleans[1] Then Players[CurrentPlayer].World := 0; Players[CurrentPlayer].Login; Wait(4000); Timeout.Start; Result := IsLoggedIn; Minimap.SetAngle(MM_DIRECTION_EAST); MainScreen.SetAngle(MS_ANGLE_HIGH); IncEx(BreakRounds, (W) + (X)); Inc(TotalBreaks); Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.'); W := (BreakIn * 60000); X := (BreakFor * 60000); Y := RandomRange(-BIR * 60000, BIR * 60000); Z := RandomRange(-BFR * 60000, BFR * 60000); End; End; function banking: boolean; var t: TTimeMarker; Time: Integer; begin if not isLoggedIn then exit; if debug then print('Entering banking'); t.start; SRL_Events[EVENT_ANTIBAN] := nil; time := gaussRangeInt(15000, 24000); repeat wait(random(100)); if bankscreen.open(players[currentPlayer].integers[2]) then begin if debug then print('opened banker'); break; end else begin if debug then print('Opening banker failed, resetting camera'); minimap.setAngle(MM_DIRECTION_NORTH); mainScreen.setAngle(MS_ANGLE_HIGH); end; if (t.getTime > time) or (not isLoggedIn) then begin if debug then print('timed out or not logged in banking 1'); exit; end; until (bankScreen.isOpen or pinscreen.isOpen); SRL_Events[EVENT_ANTIBAN] := @Antiban; pinScreen.enter(players[currentPlayer].bankPin); if debug then print('attempting to withdraw items'); t.start; time := gaussRangeInt(3500, 6000); repeat if bankScreen.clickButton(players[currentPlayer].integers[4]) then begin if debug then print('clicked preset button successfully'); break; end; if (t.getTime > time) or (not isLoggedIn) then begin if debug then print('timed out or not logged in banking 2'); exit; end; wait(gaussRangeInt(0, 800)); until false; if debug then print('waiting for bank to close'); t.start; time := gaussRangeInt(3500, 6000); if debug then print('time:= ' + tostr(time)); repeat if debug then print('start of loop 3'); if not bankScreen.__find() then begin if debug then print('bankscreen is closed'); break; end else if debug then print('bankscreen is still open'); if debug then print('after bankscreen check loop 3'); if (t.getTime > time) or (not isLoggedIn) then begin if debug then print('timed out or not logged in banking 3'); exit; end else if debug then writeln('t:= ' + toStr(t.getTime)); if debug then print('after login and timer check loop 3'); wait(gaussRangeInt(0, 200)); until false; if debug then print('waiting for items to show in inventory'); wait(gaussRangeInt(0, 500)); t.Start; repeat wait(gaussRangeInt(0, 300)); if (t.getTime > 10000) then begin writeln('Failed withdrawing, shutting down - took a screenshot, send pic to ashaman (in the scripts folder)'); saveScreenshot(scriptPath + timeRunning() + '_' + 'FletchFail.png'); players[currentPlayer].logout; terminateScript; end; if not isLoggedIn then exit; until (tabBackpack.isItemInSlot(28)); if chatbox.findTextOnLines(['could not be'], [0]) then if countColorTolerance(66033, chatbox.lineBoxes[0], 10) > 100 then begin writeln('Failed withdrawing, shutting down - took a screenshot, send pic to ashaman (in the scripts folder)'); saveScreenshot(scriptPath + timeRunning() + '_' + 'FletchFail.png'); players[currentPlayer].logout; terminateScript; end; wait(gaussRangeInt(400, 800)); result := true; end; function makeItems: boolean; var time, X, Y, i: Integer; t: TTimeMarker; begin if not isLoggedIn then exit; if debug then print('attempting to make items'); tabBackpack.open; case lowercase(players[currentPlayer].strings[1]) of 'cut': begin antiB := randomRange(0, 3000); mouseB := randomRange(0, 6000); for i:=0 to 3 do begin wait(gaussRangeInt(0, 500)); if debug then writeln('Sending quickkey to open menu'); sendKeys(Players[CurrentPlayer].Strings[0], 60 + Random(60), 60 + Random(60)); wait(GaussRangeInt(0, 100)); if debug then writeln('Waiting for production or tool menu'); t.start; time := gaussRangeInt(4000, 7000); repeat wait(gaussRangeInt(0, 100)); if t.getTime > time then break; until productionscreen.isOpen or toolscreen.isOpen; if productionscreen.isOpen or toolscreen.isOpen then break; end; if debug then writeln('Checking if toolscreen is open'); toolScreen.select('Knife'); wait(gaussRangeInt(0, 200)); if debug then writeln('Waiting for production menu'); t.start; time := gaussRangeInt(6000, 12000); repeat wait(gaussRangeInt(0, 200)); if (not isLoggedIn) or (t.getTime > time) then begin if debug then print('timedout or logged out makeitems 1'); exit; end; until productionscreen.isOpen; wait(gaussRangeInt(0, 100)); if debug then writeln('Trying to select designated box'); if not productionscreen.selectBox(players[currentPlayer].integers[3]) then begin writeln('Your desired box is not valid, shutting down'); terminatescript; end; if itemType = '' then itemType := productionscreen.getSelectedBoxText; if debug then writeln('Clicking start on production screen'); if not productionscreen.clickStart then exit; if debug then writeln('Waiting for first slot pixel change'); SRL_Events[EVENT_ANTIBAN] := nil; if not tabBackpack.waitSlotPixelChange(gaussRangeInt(2, 5), gaussRangeInt(10000, 20000)) then begin if debug then print('failed to shift inventory'); SRL_Events[EVENT_ANTIBAN] := @antiban; exit; end; SRL_Events[EVENT_ANTIBAN] := @antiban; wait(gaussRangeInt(0, 1500)); timeout.start; if debug then writeln('Waiting for last slot pixel change'); if not TabBackpack.waitSlotPixelChange(28,GaussRangeInt(55000, 65000)) Then Exit; if debug then writeln('Last slot is done'); incEx(ItemCount, 28); End; 'string': Begin AntiB:= RandomRange(0,500); MouseB:= RandomRange(0,3000); Wait(GaussRangeInt(0, 500)); SendKeys(Players[CurrentPlayer].Strings[0], 60 + Random(60), 60 + Random(60)); Wait(GaussRangeInt(0, 100)); T.Start; Time:=GaussRangeInt(6000, 12000); Repeat Wait(GaussRangeInt(0, 500)); If (Not IsLoggedIn) Or (T.GetTime>Time) Then Exit; Until Productionscreen.IsOpen; Wait(GaussRangeInt(0, 400)); If ItemType='' Then ItemType:= Productionscreen.getSelectedBoxText; If Not Productionscreen.selectbox(Players[CurrentPlayer].Integers[3]) Then Begin Writeln('Your desired box is not valid, shutting down'); Terminatescript; End; Productionscreen.ClickStart; If Not TabBackpack.WaitForShift(RandomRange(2000,4000)) Then Exit; Wait(GaussRangeInt(0, 1500)); Timeout.Start; T.Start; Time:=GaussRangeInt(25000, 45000); Repeat Wait(GaussRangeInt(0, 900)); AntiBan; If (Not IsLoggedIn) Or (T.GetTime>Time) Then Exit; Until Not (TabBackpack.IsItemInSlot(28)); ItemCount := ItemCount + 14; End; Else Begin Writeln('StringOrCut type wrong, shutting down'); TerminateScript; End; End; Result := True; End; procedure setup; begin clearDebug; autoUpdateMe; smartEnableDrawing := True; SRL_Events[EVENT_ANTIBAN] := @antiban; initPlayerForm(); // initiate your settings runPlayerForm(); // run the form // use this so the script doesn't continue if the user exits out of the form if (not playerForm.isScriptReady) then terminatescript; declarePlayers(); smartPlugins := ['OpenGL32.dll','d3d9.dll']; setupSRL; if not isLoggedIn then begin if not players[currentPlayer].login then terminateScript; writeln('Just loggedin, waiting a bit'); wait(randomRange(6000, 10000)); end; if not debug then disableSRLDebug := true else disableSRLDebug := false; clearDebug; mainScreen.setAngle(MS_ANGLE_HIGH); findNormalRandoms; timeout.start; bir:= 20; // ***Random minutes to add/subtract from how long until we break*** bfr:= 30; // ***Random minutes to add/subjtract from break duraction*** w := (players[currentPlayer].integers[0] * 60000); x := (players[currentPlayer].integers[1] * 60000); y := randomRange(-bIR * 60000, bIR * 60000); z := randomRange(-bFR * 60000, bFR * 60000); if conversationBox.continue(true, true) then wait(randomRange(3000, 2000)); tabBackpack.Open; startingXP := chatBox.getXP; End; procedure mainloop; begin if debug then print('entering mainloop'); findNormalRandoms; if not isLoggedIn then begin if debug then print('logged out attempting to login'); wait(5000); disableSRLDebug := false; if not players[currentPlayer].login then terminateScript; mainScreen.setAngle(MS_ANGLE_HIGH); if not Debug then disableSRLDebug := True; Timeout.Start; end; if banking then if makeItems then progressReport; if timeout.getTime > 300000 then begin writeln('Nothing has happened for too long, shutting down!- took a screenshot, send pic to ashaman (in the logs folder)'); saveScreenshot(scriptPath + timeRunning() + '_' + 'FletchFail.png'); terminateScript; end; if players[currentPlayer].booleans[0] then breakHandler(players[currentPlayer].integers[0], players[CurrentPlayer].integers[1], bir, bfr); end; begin setup; while (players.getActive() > 0) do mainloop; end.