SRL Archive - Research & Development Lounge

Random loads?


Gabe

2008-08-28 15:09:45

Lemme start with this: I haven't done SCAR in awhile and never was good at it. But everytime I play RS I think of SCAR and procedures. So heres one I thought of. I though it could be used for random loads everytime a script logs in.

 loads = case random of
'10': loads = 10
'11': loads = 11
'12': loads = 12

Correct me if Im wrong. Also feel free to edit it to make it correct.

EvilChicken!

2008-08-28 15:43:40

Loads := Random(12);

Is this what you mean..?

TViYH

2008-08-28 21:06:01


case Random(3) of
'0': Loads := 10;
'1': Loads := 11;
'2': Loads := 12;
end;

Timer

2008-08-28 21:33:26

From: TheVoiceInYourHead

case Random(3) of
'0': Loads := 10;
'1': Loads := 11;
'2': Loads := 12;
end;


Fail… IntToStr(Random(3))… ;)

Loads := 1 + Random(12);

Random(..) can be 0 to .. - 1
so, Random(12) is 0 too 11… Always remember to include one… ;)

Daniel

2008-08-29 03:41:01

From: Timer
Fail… IntToStr(Random(3))… ;)

Loads := 1 + Random(12);

Random(..) can be 0 to .. - 1
so, Random(12) is 0 too 11… Always remember to include one… ;)

Fail… Since you're using an Integer, don't use IntToStr, just use an integer instead of a string, since it'll be faster.

:p

Hobbit

2008-08-29 03:54:01

You all fail…

RandomRange(10,12);

Naum

2008-08-29 07:01:34

Nop add it in the mainloop

Until(Loads >= Banked + Random(8))

Pwnd x6, I Think :)

Narcle

2008-08-29 07:29:00

From: NaumanAkhlaQ
Nop add it in the mainloop

Until(Loads >= Banked + Random(8))

Pwnd x6, I Think :)


No if it gets repeated to much, chances are it'll just bank at "Banked + 0". If its repeated 8 times… chances are it'll be zero. So that way really isn't random.

When the player logs in it should be called into a variable.

Loads := RandomRange(10, 12);

Then use:
Until(Loads >= Banked)

Gabe

2008-08-29 08:43:14

Ok, I'm glad I started this disscussion… XD

sirlaughsalot

2008-08-29 09:04:32

From: Narcle
No if it gets repeated to much, chances are it'll just bank at "Banked + 0". If its repeated 8 times… chances are it'll be zero. So that way really isn't random.

When the player logs in it should be called into a variable.

Loads := RandomRange(10, 12);

Then use:
Until(Loads >= Banked)


Narcle>all

Remember gabe to recall loads in your mainloop after the until loads>=banked do something like

if loads>=Banked then
begin
loads := RandomRange(10,12)
logout;
blah blah...

very basic but you might nota known ;)

oh and you can use 2 constants to make a variable so instead of doing


Loads := randomrange(10,12)

you could do


const
MinLoadsBeforeLogout=
MaxLoadsBeforeLogout=
blah blah

Loads:=RandomRange(MinLoadsBeforeLogout,MaxLoadsBeforeLogout)

:D

MylesMadness

2008-08-29 10:03:11

From: Hobbit
You all fail…

RandomRange(10,12);
RandomRange is slower then
I:=10+Random(3);

Wizzup?

2008-08-29 10:24:20

From: Hobbit
You all fail…

RandomRange(10,12);


Random(3) + 10 is faster. ;)

Waddo

2008-08-29 12:10:37

but wouldn't you want to use a variable

so at the start it would be

IncEx(totalloads,random(3));

Their for you all phail =p