variable question

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Runt
First Lieutenant
Posts: 188
Joined: Wed Feb 11, 2004 5:03 pm
Location: The Netherlands
Contact:

variable question

Post by Runt »

Hey,

I found this on rjukan's poject site:

-------------------------------------------------------------------------------------
Command: randomfloat
Syntax: randomfloat ( Float max )
Example: randomfloat 14.9
Description: Returns a random number between 0 and 'max', inclusive of 0 and exclusive of 'max' (i.e. 'max' will never be returned).

-------------------------------------------------------------------------------------

Command: randomint
Syntax: randomint ( Integer max )
Example: randomint 10
Description: Returns a random number between 0 and 'max', inclusive of 0 and exclusive of 'max' (i.e. 'max' will never be returned).

-------------------------------------------------------------------------------------

This is almost what i want. The only thing that i want is that i can choose between which numbers there will be chosen.
So, basicly i want a number be chosen between 10 and 20. (example numbers)
thanks,

-Runt
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

local.variable = 10 + randomint(10)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Runt
First Lieutenant
Posts: 188
Joined: Wed Feb 11, 2004 5:03 pm
Location: The Netherlands
Contact:

Post by Runt »

Thank you, Pro One :wink: :D

And how should i put his in a script?
local.object speed (variable?)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

just put that wherever you want it in your script. For an entity property like that, do this.
local.object.speed = ( 10 + randomint(10) )
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Runt
First Lieutenant
Posts: 188
Joined: Wed Feb 11, 2004 5:03 pm
Location: The Netherlands
Contact:

Post by Runt »

Thank you :!:
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Hehe, no problem. ;)

Speed is not a property, I believe. I think it's a method, which means it cannot be assigned to. You can do it like this:

Code: Select all

local.object speed (10 + randomint(10))
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

speed is a method? Well what's it do? i always assumed an objects speed was the multiplier for it;s velocity...
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Post Reply