Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program CHOPdaBOB;
- (*******************************************************************************
- C H O P D A B O B
- A Falador Yew Cutter by Markus
- Q: MARKUS WHY DID YOU MAKE THIS?!?!?! HOW ABOUT THE WONDERFUL MSI????
- A: I couldn't get MSI to work and in the 20 mins I used it got really fed up
- with some bugs: WHY can't it detect my location. WHY does it think I'm
- powerskilling? WHY do i have to enter a fckn 0 every time in the form
- or else the script will hang? Not even the crappiest RSBot script wants that.
- Oh and I really couldn't be bothered to mess the code around good enough to
- get it working. And it hated my scriptrecord so much that I was like,
- I can do this better and it'll be quicker if I do it from scratch.
- TL;DR: I'm a lazy fuck and couldn't get it to work.
- Q: So, such a nice script, how long did it take to write you?
- A: It took me one hour to make it do it's first bank run :) And another hour
- to fix some bugs and have it do yewhopping between yew one and two.
- After that yet another two hours to rewrite some parts and make it
- 'stateless': which means anything can happen and it'll just work fine
- because of extreme fault tolerance.
- *******************************************************************************)
- {$i srl/srl/misc/smart.scar}
- {$i srl/srl.scar}
- {$i reflection/reflection.simba}
- //Yew ID: 1309
- //Yew STUMP: 7402
- //Cutting anim: 867
- procedure DeclarePlayers;
- begin
- HowManyPlayers := 1;
- NumberOfPlayers(HowManyPlayers);
- CurrentPlayer := 0;
- with Players[0] do //ripped this from bobzilla without permission
- begin
- Name := ''; //Username
- Pass := ''; //Password
- Nick := ''; //3-4 non uppercase, number, or space characters on your username
- Pin := ''; //Bank Pin (Blank if none)er
- Active := True; //Player Active?
- Integers[2] := 10; //how long to work for in minutes
- end;
- end;
- const
- id_YEW_TREE = 1309;
- id_YEW_STUMP= 7402;
- id_ANIM_CUT = 867;
- const
- CdB_YewCount= 2; //This might be useful later for other locations
- //In fact, it shouldn't be too hard to modify this script
- //in order to use it at other locations/skills. Maybe
- //I can even add some kind of "Scritp Record" so it's easy
- //to make it do multiple skills in multiple locations? :o
- const //To be used in the future
- CdB_TO_YEWS = 1337; //Besides, the exact numbers don't really matter
- CdB_CUT_YEWS = 1338;
- CdB_SWITCH_YEWS = 1339;
- CdB_TO_BANK = 1340;
- CdB_CLEAR_INV = 1341;
- CdB_CAN_CUT = 1342;
- var
- YewTimeStamps : array [0..CdB_YewCount-1] of integer;
- YewTiles : array [0..CdB_YewCount-1] of TTile;
- BankToYews : TTileArray;
- YewsToBank : TTileArray;
- CurrentYew : Integer;
- Breakout : Boolean;
- ////////////////////////////////////////////////////////////////////////////////
- function CdB_ObjectInReach(objID, MaxDist : integer;) : boolean;
- var
- tempObject : TRSObject;
- begin
- result := False;
- tempObject := GetObjectByID(id_YEW_TREE, OBJECT_TYPE_INTERACTABLE, MaxDist);
- if (DistanceFrom(tempObject.Tile) < MaxDist) then
- result := true;
- end;
- ////////////////////////////////////////////////////////////////////////////////
- function FindYew : boolean;
- var
- FoundObjs : TRSObjectArray;
- YewPoint : TPoint;
- TimeMark : Integer;
- Tries : Integer;
- begin
- Result := False;
- FoundObjs := GetObjectsByID(id_YEW_TREE, OBJECT_TYPE_INTERACTABLE, 10); //First try to find a yew
- if length(FoundObjs) = 0 then
- begin
- FoundObjs := GetObjectsByID(id_YEW_STUMP, OBJECT_TYPE_INTERACTABLE, 10);
- if length(FoundObjs) = 0 then
- begin
- writeln('There is no fckn yew, and no fckn stump of a yew!');
- BreakOut := True;
- exit;
- end else
- writeln('we found a stump -.-''');
- //writeln(FoundObjs);
- result := False;
- end else
- begin
- writeln('WE found a yew tree!');
- writeln('We found itat : '+ ToStr(FoundObjs[0].Tile)+' to be precise');
- writeln('WE are at: '+ToStr(GetMyPos));
- if GetAnimation <> id_ANIM_CUT then
- begin
- While(Tries < 10) do
- begin
- writeln('and were gonna cut it!');
- if InvFull then
- begin
- writeln('wait we are not, as our inventory is full');
- result := True; //to follow main loop logic
- Exit;
- end;
- YewPoint := TileToMS(FoundObjs[random(9)].Tile, random(500));
- MMouse(YewPoint.x, YewPoint.y, 5, 5);
- if IsUpText('hop') then
- begin
- GetMousePos(YewPoint.x, YewPoint.y);
- if Random(2) = 1 then
- Mouse(YewPoint.x, YewPoint.y, 0, 0, true)
- else begin
- Mouse(YewPoint.x, YewPoint.y, 0, 0, false);
- ChooseOption('hop');
- end;
- R_Flag;
- TimeMark := GetSystemTime;
- While ((GetSystemTime-TimeMark) < 5000) do
- begin
- if GetAnimation = id_ANIM_CUT then
- begin
- writeln('We iz cuttin and we r done');
- Result := True;
- Exit;
- end;
- end;
- end;
- Inc(Tries);
- end;
- end else
- begin
- writeln('we are already cutting it');
- Result := True;
- end;
- end;
- end;
- (*
- Typical script-loop:
- Walk from bank to yews TO_YEWS
- cut a yew CUT_YEWS
- switch yew SWITCH_YEWS
- Invfull: walk back to bank TO_BANK
- at bank: deposit stuff CLEAR_INV
- *)
- function SwitchYews : boolean;
- var
- i, j, k : integer;
- begin
- if FindYew then exit; //No need to switch, there's a yew in front of us
- j := MaxInt;
- for i := 0 to high(YewTimeStamps) do //Find out which yew to go
- begin
- if (YewTimeStamps[i] < j) then
- begin
- j := YewTimeStamps[i];
- k := i;
- end;
- end;
- if i > high(yewtimestamps) then i := random(length(yewtimestamps));
- writeln('we are switching to yew: '+inttostr(i)+'@'+ToStr(yewtiles[i]));
- if (r_WebWalk(YewTiles[i])) then
- begin
- writeln('we iz at the right yew!');
- writeln('Yew: '+tostr(i)+' @ '+ToStr(yewtiles[i]));
- R_Flag;
- end;
- end;
- function ScriptState : integer; //Not used atm, I want to make this script stateless
- var
- MyPos : TTile;
- begin
- Result := -1; //aka middleofnowhere
- MyPos := GetMyPos;
- if InvFull {and position is like ..} then
- begin
- result := CdB_TO_BANK; //Hey, the inventory is full ;)
- end;
- //Check if we are chopping
- if CdB_ObjectInReach(id_YEW_TREE, 5) then //1 should do actually
- begin
- if (GetAnimation = id_ANIM_CUT) then
- result := CdB_CUT_YEWS
- else
- result := CdB_CAN_CUT; //Might do some check for axes here
- end;
- end;
- procedure LoadArrays;
- begin
- BankToYews := TPointArray([Point(3012, 3355), Point(3006, 3348),
- Point(3006, 3334), Point(3006, 3323),
- Point(3019, 3318)]);
- YewsToBank := TPointArray([Point(3012, 3355), Point(3006, 3348),
- Point(3006, 3334), Point(3006, 3323),
- Point(3019, 3318)]);
- InvertPath(YewsToBank);
- YewTiles[0].x := 2995+random(6);
- YewTiles[0].y := 3310+random(6);
- YewTiles[1].x := 3018+random(6);
- YewTiles[1].y := 3314+random(6);
- end;
- begin
- Smart_Members := True;
- Smart_Server := 52;
- Smart_Signed := True;
- Smart_SuperDetail := False;
- setupsrl;
- SetupReflection;
- DeclarePlayers;
- LoadArrays;
- repeat
- { case ScriptStatus of
- TO_YEWS: WalkPath(BankToYews);
- TO_BANK: WalkPath(YewsToBank);
- CUT_YEWS: FindYew;
- SWITCH_YEWS: SwitchYews;
- CLEAR_INV: DepositStuff; //c-c-c-c-c-COOOMBO BREAKER =D
- end else
- begin
- writeln('Uhm, IDK wtf ur trying to do, but I can tell you one thing and'+
- ' that''s that it just doesn''t work');
- TerminateScript;
- end; }
- BreakOut := False;
- WalkPath(BankToYews);
- CurrentYew := 1; //cus of walkpath
- repeat
- FindNormalRandoms;
- if FindYew then
- begin
- repeat
- if random(500) = 1 then BoredHuman;
- wait(50+random(200));
- if InvFull then break;
- until not FindYew;
- YewTimeStamps[currentyew] := GetSystemTime;
- end;
- if not invfull then SwitchYews;
- until InvFull;
- WalkPath(YewsToBank);
- OpenBankFast('feb');
- DepositAll;
- until false;
- writeln('markus u r s00 leet');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement