AntiRandoms
Anti randoms should be included in every RS script. It is what checks if your character is in a random event and then attempts to solve it or runs/logs out to save you from a ban/death. Without random solving autoing would last about 5 mins before the character got stuck in a random and then just sat there. So include AntiRandoms.
SCAR Code:
procedure AntiRandoms;
if not LoggedIn then
Exit;
FindNormalRandoms;
if InFight then
RunAway('n', True, 1, 10000);
end;
You don’t want it to preform antirandoms while not logged in so you include the if not logged in then part like always. Then you have FindNormalRandoms; This will attempt to solve randoms if they are found.
InFight checks if your character is under attack. In this case if the character was under attack it would run away
SCAR Code:
RunAway(‘direction’,RunFar,Action,Wait time);
‘Direction’ is ‘n’ for north, ‘s’ for south and so on. RunFar True makes it run further away. False it doesn’t run as far. Action is in the form of 1, 2, or 3. Wait time is how long to wait before running back.
SCAR Code:
Action can be either 1, 2 or 3.
1: RunAway + Wait(WaitTime) + RunBack
2: RunAway + Wait(WaitTime)
3: RunBack
Obivously you would only use RunAway if you were making a script that did not include fighting (or if your health was low while fighting).
The AntiRandom procedure should be called whenever you could get a random. Try putting it in your main loop or in you procedure where you are actually doing something. Example--while you are waiting for your character to cut down a tree, or right after the character begins to cut.