Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Random (https://forums.graalonline.com/forums/showthread.php?t=8346)

Poogle 07-29-2001 04:00 AM

Random
 
What is the Random script?

LiquidIce00 07-29-2001 04:02 AM

random(mininumvalue,highestvalue)

Poogle 07-29-2001 04:14 AM

I dont understand sir!

ownerofbabylon 07-29-2001 04:26 AM

Like this:

if (weaponfired) {this.result=random(1,100)
if (this.result<=20) {
message Uh oh it was less than or equal to 20;
}
else if (this.result<=50) {
Oh thank god it was higher than or equal to 50;
}

I just did that off the top of my head but its the basic idea.

LiquidIce00 07-29-2001 04:37 AM

Quote:

Originally posted by ownerofbabylon
Like this:

if (weaponfired) {this.result=random(1,100)
if (this.result<=20) {
message Uh oh it was less than or equal to 20;
}
else if (this.result<=50) {
Oh thank god it was higher than or equal to 50;
}

I just did that off the top of my head but its the basic idea.

its wrong .. line should be
else if (this.result>=50) {

ownerofbabylon 07-29-2001 04:38 AM

woops I just did that off the top of my head.

Poogle 07-29-2001 10:02 AM

What is this the war of the > and the < ?!

LiquidIce00 07-29-2001 11:31 AM

Quote:

Originally posted by Poogle
What is this the war of the > and the < ?!
yes cuz > is different then <

Solareon 07-29-2001 11:59 AM

......................
 
rmemeber to use int(var); to round the variable, if you don't you could have some kind of wierd garbly goop for a script. Hope you don't ever become a big scripter though Poogle, cause frankly, neopets sucks the big one

LiquidIce00 07-29-2001 12:47 PM

Re: ......................
 
Quote:

Originally posted by Solareon
rmemeber to use int(var); to round the variable, if you don't you could have some kind of wierd garbly goop for a script. Hope you don't ever become a big scripter though Poogle, cause frankly, neopets sucks the big one
lolz.
yeah depends what kind you need like sprite random then u need int so you dont have decimals and junk . but if your doing something like
this.check=random(0,100);
if (this.check<10) { lay goldrupee; }
or whatever then you dont

General 07-29-2001 01:06 PM

ap=random(0,100) would make the ap bar mad becuase it would wind up with
ap=42.45684574562341256

grim_squeaker_x 07-29-2001 03:34 PM

Quote:

Originally posted by General
ap=random(0,100) would make the ap bar mad becuase it would wind up with
ap=42.45684574562341256

ap=int(random(0,101)) :rolleyes:
(And yes 101, integers always round down)


All times are GMT +2. The time now is 02:17 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.