ID:177176
 
i want a proc that selects from 4 random commands,

like i call the proc, then lets say it selects the third thing, that would be to change a var, and to say something.
I'm not quite sure but this might work

var/number =rand(1,2,3,4)
if(number = 1)
usr <<"The number was 1"
if(number = 2)
usr <<"The number was 2"
if(number = 3)
usr <<"The number was 3"
if(number = 4)
usr <<"The number was 4"
In response to Mysticmichael839
sorry im getting a bunch of bad proc errors, i tried to switch it around and fix some stuff, but i cant get this to work
In response to Mysticmichael839
Mysticmichael839 wrote:
I'm not quite sure but this might work

var/number =rand(1,2,3,4)
if(number = 1)
usr <<"The number was 1"
if(number = 2)
usr <<"The number was 2"
if(number = 3)
usr <<"The number was 3"
if(number = 4)
usr <<"The number was 4"

I believe you meant to use == and not = in your comparisons.

Try this:

switch(rand(1,4))
if(1)
do_thing_1()
if(2)
do_thing_2()
if(3)
do_thing_3()
if(4)
do_thing_4()

Or you could do it this way:

call(pick(/proc/thing1, /proc/thing2, /proc/thing3))
In response to SkylineR34
what is wrong with it? And skysaw, yes i did mean to put == instead of =
In response to Skysaw
Skysaw wrote:

call(pick(/proc/thing1, /proc/thing2, /proc/thing3))

I believe you meant call(pick(/proc/thing1, /proc/thing2, /proc/thing3))() . Call is wierd in the way that it's format is call(proc)(args).