ID:271792
 
Is there a way to assign a text string picked out of a list by pick()(all possible are also names of procs) and perform the proc that matches the text chosen?
I think the only way to do that would be to make an if() statement.
In response to Kaiochao2536
I'm not looking forward to having to type out a 25 option switch() statement. Are you sure there's no other way?
You can do call() and probably text2path() the string if it needs to be (I forgot if it can accept just string)
In response to Top player
var/procedure = pick(/mob/proc/xx,/mob/proc/yy,/mob/proc/zz) // this could actually be pick("xx", "yy", "zz") as well. call will find the procedure with the name entered.
call(src,procedure)()


src would be a mob, of course.
procedure will pick a procedure from the list, and then call (look it up in the reference) will execute the procedure with src as the source object.
In response to Keeth
Yeh, I forgot about call().