Page 1 of 1

variable question

Posted: Mon Jun 27, 2005 2:30 pm
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

Posted: Mon Jun 27, 2005 3:08 pm
by Rookie One.pl
local.variable = 10 + randomint(10)

Posted: Mon Jun 27, 2005 3:12 pm
by Runt
Thank you, Pro One :wink: :D

And how should i put his in a script?
local.object speed (variable?)

Posted: Mon Jun 27, 2005 3:28 pm
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) )

Posted: Mon Jun 27, 2005 4:39 pm
by Runt
Thank you :!:

Posted: Mon Jun 27, 2005 5:52 pm
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))

Posted: Mon Jun 27, 2005 6:36 pm
by lizardkid
speed is a method? Well what's it do? i always assumed an objects speed was the multiplier for it;s velocity...