Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-27-2006, 02:42 AM
mYg0tHaMpStEr mYg0tHaMpStEr is offline
Never trust anyone.
mYg0tHaMpStEr's Avatar
Join Date: Jul 2006
Location: Mars
Posts: 98
mYg0tHaMpStEr is on a distinguished road
Send a message via AIM to mYg0tHaMpStEr Send a message via MSN to mYg0tHaMpStEr
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);
}

__________________
Quote:
Originally Posted by Utopia RC Chat
lesmA: it's a good thing i can count to 10 now using gscript, you know, in case i forget how irl
Quote:
Originally Posted by Utopia RC Chat
lesmA: woo now i can make it count to 10 over 10 seconds!
lesmA: WATCH OUT SKYLD, HERE COME'S LESMA THE NEW SUPER-SCRIPTER!!!
Ork: ROFL
Ork: ANOTHER BRILLIANT FORUM SIG QUOTE
lesmA: oh god i should just stop talking before i make a fool of myself
  #2  
Old 11-27-2006, 03:13 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
ummm how bout this..
NPC Code:

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

__________________
Quote:
  #3  
Old 11-27-2006, 03:35 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Might want to make that


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


Unless you want decimals....
  #4  
Old 11-27-2006, 05:32 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Gambet View Post
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?
  #5  
Old 11-27-2006, 05:59 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Mark Sir Link View Post
I was pretty sure Graal's random function would always return an int anyway?

You thought wrong.
  #6  
Old 11-27-2006, 05:17 PM
mYg0tHaMpStEr mYg0tHaMpStEr is offline
Never trust anyone.
mYg0tHaMpStEr's Avatar
Join Date: Jul 2006
Location: Mars
Posts: 98
mYg0tHaMpStEr is on a distinguished road
Send a message via AIM to mYg0tHaMpStEr Send a message via MSN to mYg0tHaMpStEr
Joey AIM'ed me last night, gave me a great script, thanks to all that helped.

Mods may close/delete this thread.

-Ork
__________________
Quote:
Originally Posted by Utopia RC Chat
lesmA: it's a good thing i can count to 10 now using gscript, you know, in case i forget how irl
Quote:
Originally Posted by Utopia RC Chat
lesmA: woo now i can make it count to 10 over 10 seconds!
lesmA: WATCH OUT SKYLD, HERE COME'S LESMA THE NEW SUPER-SCRIPTER!!!
Ork: ROFL
Ork: ANOTHER BRILLIANT FORUM SIG QUOTE
lesmA: oh god i should just stop talking before i make a fool of myself
Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:30 AM.


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