SRL Archive - Outdated Tutorials

Using antirandoms in your scripts!


n3ss3s

2007-08-01 11:24:01

AntiRandoms

You've got a fresh working script?
It does all you've ever dreamed of?
W-W-W-W00t you aut0z0er!!!1!111!

But, then you face problem… A damn random event comes and happens?
You feel like raping that sandwich lady?
Eating that frog?

Heres the answer for your problems…
AntiRandoms :O

In this tutorial I will teach you how to use SRL antirandoms in your scripts.

Lets start with a "empty" script which has only Program new, begin and end and SRL included.


Program new;
{.include SRL/SRL.scar}
begin
SetupSRL;
end.

You only need to include SRL/SRL.scar because SRL.scar contains the other includes in SRL, so you DONT have to include the antirandoms like
{.include SRL/SRL/Core/Antirandoms.scar}

Now, we can use them, but how?

Lets start to put some things in our template.


Program new;
{.include SRL/SRL.scar}
{.include SRL/SRL/Misc/PlayerForm.scar}
begin
SetupSRL; // Includes the srl include :D
SetupPlayers;
ActivateClient; // This "activates" the client.
FindNormalRandoms; // Solves the randoms.
end.
There we have activate client to "activate" our runescape
and FindNormalRandoms to check for randoms.
SRL has the solve for most of the randoms, but some randoms like ScapeRune, Surpise Exam and so on are still unsolved.

FindNormalRandoms loggs out if any of those unsolvable randoms appear.

The reason why we have SetupPlayers there is that when a random appears, SRL antirandoms set your current players location to the random.
for example
Players[CurrentPlayer].loc := 'No GameTab';
If we havent set our players, the script will stop because of:
[Runtime Error] : Out Of Range in line (the error line) in script
So the script'd stop there.
But, ofcourse you can avoid that by using
try - except technique which I wont be explaining now, Ill make a tut for that lol.

SetupPlayers calls a procedure from PlayerForm.scar which displays a form, where you can set your players. Nothing hard, just empty text boxes to type your username and pass and so on in.

When to call an AntiRandom procedure?
Ofcourse you cannot just call your Antirandom procedure just once or all the time. You need to find a right place for it.

for example:


repeat
MyAntiRandomsProcedure;
until(not(MiningARock));

That example would not work since any of those arent real procedures or functions.

But, if they were, and that piece of code would be in some script, it would be repeating doing an antirandoms procedures until not mining a rock. Simple, isnt it?

An antirandoms procedure is for example:

procedure MyAntiRandomsProcedure;
begin
FindNormalRandoms;
SolveBox;
end;
SolveBox checks if a new box has appeared to your inventory, and if has, solves the box.

Happy and safe autoing!






p.s: Rate 1..5

passiondrive

2007-08-01 14:34:04

Another good tut on AntiRandoms :p. If 5 is highest… I'll give you a 4.

Drive

n3ss3s

2007-08-01 15:50:00

:O Thanks!

I hope this thread would draw a bit attention too, since I made 2 tuts in a row so people read only the 2nd one since you can see that as the "last post…"
Except after this post :)

JAD

2007-08-01 19:09:21

procedure MyAntiRandomsProcedure;
begin
FindNormalRandoms;
SolveBox;
end;

I would NOT suggest calling for SolveBox because that would ignore the constant in SetupSRL; to either solve the box, or gamble on the box. FindNormalRandoms will already find the box and do what the constant says already, so if their was a box, FindNormalRandoms would have found it, then you would have called for SolveBox just making un-needed checking for the box, and possible lag.



repeat
MyAntiRandomsProcedure;
until(not(MiningARock));

I would put a wait in their just to cause lag in case someone thinks of using that :p I know this isn't a script, but you might as well show people how to do it the right way without causing lag, right?


Anyways, even though their have been over 5 tutorials made on anti randoms, you still explained it pretty well :) Good job!

joerobo

2007-08-01 19:48:42

hey JAD and n3ss3s, was wondering how necessary u think it is to include findfastrandoms, or is it not at all?

n3ss3s

2007-08-02 06:02:50

hey JAD and n3ss3s, was wondering how necessary u think it is to include findfastrandoms, or is it not at all?

Its not necassary, but its pretty good to have since it does most, but not all the random so it takes less time..
And it looks cool.
Ofcourse you can make your own even shorter version, what would done your own custom randoms, like only four or something…

I know this isn't a script, but you might as well show people how to do it the right way without causing lag, right?

Thru but I was a bit lazy :) And I have 3 scripts like half a way so It feels like rest to "break the rules" :D

exppo

2007-08-02 06:17:39

Realy helped, thanks.

exppo

Pentti

2007-08-02 07:26:26

Box solver does nomore cause lag like it did in <SRL 3.6.
And by gambling the box you… You would just have about 100 of them when you login with your player.
And probably no one is using GambleBox since Box solver works.

joerobo

2007-08-02 08:23:03

pentti, it caused lag when i used it in my script… guess yr computer must be much better :p cos i dont think it was a problem with my script..

n3ss3s

2007-08-02 09:17:19

pentti, it caused lag when i used it in my script… guess yr computer must be much better cos i dont think it was a problem with my script..

SRL 3.8 and up box solver does not lag! :D
I doesnt lagg on any of the comps I've used it on, it doesnt lagg on pentti's comp which means it doesnt lagg :D

joerobo

2007-08-02 09:22:10

well i guess ill have 2 agree wit u2 then :redface: :redface: :redface:

n3ss3s

2007-08-02 09:25:46

Yeah, we are above the rights of peoples opinions :)



:P Jk/Jk

EDIT: TY FOR TUT CUP!!!! UUUBEERRNEEEESS TY SO MUCH!!

Lalaji

2007-08-02 10:09:37

Can i use something like…

While (MiningtheRock) do
Begin
AntiRandoms
End;


Would that work or did i foreget something?

joerobo

2007-08-02 10:39:31

you could if miningtherock is a boolean function i think but this would not be the most typical way to do it, the following is more usual:
repeat
AntiRandoms;
until (timefrommark(start)>5000) or (oreisgone);
obviously v basic but u get the message.

CorpseCamper

2007-08-02 14:44:08

oooohhh.

THATS how it works :)

Thanks alot man!

n3ss3s

2007-08-02 15:03:58

np :)

JAD

2007-08-04 16:27:39

I know it doesn't cause extreme lag… But anything can cause lag.


program Whatever;
{.include SRL/SRL.scar}

begin
repeat
SolveBox;
until(False);
end.

Run that and tell me what happens after your computer vomits :)

n3ss3s

2007-08-04 16:42:42

vomits
I think you mean
"after you've bought a new computer lol"

Miitchyy

2007-08-08 05:15:17

Perhaps put in that if you dont declare the NickNameBMP yourself it will only be declared if you call LogInPlayer and it needs to log in :P

Otherwise your randoms wont work

n3ss3s

2007-08-08 05:16:45

Naa, they hafta use search button when they get a problem with that.