Graal Forums

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

mYg0tHaMpStEr 11-27-2006 02:42 AM

random numbers?
 
I'm making something as a prize, and what ever number a person gets determines what prize they get. I need a random number here. This is what I got.
But it doesn't give a random number, I need a random number! >:{

NPC Code:
//#CLIENTSIDE
function onCreated()
{
}
function onPlayerTouchsMe()
{
message("8");
sleep(3);
}


fowlplay4 11-27-2006 03:13 AM

ummm how bout this..
NPC Code:

//#CLIENTSIDE
function onCreated() {
this.num = random(0,9999);
this.chat = "Enjoy your random number!" SPC this.num;
}


Gambet 11-27-2006 03:35 AM

Might want to make that


this.num = int(random(0,9999));


Unless you want decimals....

Mark Sir Link 11-27-2006 05:32 AM

Quote:

Originally Posted by Gambet (Post 1247585)
Might want to make that


this.num = int(random(0,9999));


Unless you want decimals....

I was pretty sure Graal's random function would always return an int anyway?

Gambet 11-27-2006 05:59 AM

Quote:

Originally Posted by Mark Sir Link (Post 1247610)
I was pretty sure Graal's random function would always return an int anyway?


You thought wrong. >_<

mYg0tHaMpStEr 11-27-2006 05:17 PM

Joey AIM'ed me last night, gave me a great script, thanks to all that helped. :D

Mods may close/delete this thread.

-Ork


All times are GMT +2. The time now is 07:49 AM.

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