SRL Archive - News and General

A small note to all scripters..


Sir R. M8gic1an

2010-09-06 05:10:14

I'm posting this just because I've seen this mistake ever since the stone age of SRL.

The only times you need to use randomness is when you interact with RS.

Things like these are pointless and harmfull:

T := GetSystemTime + 2000 + Random(200); //baaaaad
while (GetSystemTime < T) do
begin
if (FlagPresent) or (IsMoving) then
Break;
Wait(20);
end;

Why pointless? - Because NOBODY is monitoring this
Why Harmful? - Because it is randomizing the rhythm of your script, making it harder to fine tune!

~RM

Nava2

2010-09-06 06:48:11

I disagree, by doing that you make the waits random, and thus harder to track.

Placing the random there is silly. Doing wait(10+random(10)); makes more sense.

Sir R. M8gic1an

2010-09-06 06:53:43

No one is tracking it in this particular place… it's internal to the script.

You're better off just putting the random wait before the next time you interact with RS.
Also, when you are analysing things that are critical to your script run you don't want useless waits. You want it done as quickly as possible so you can determine what the best action is.

~RM