ID:2209266
 
(See the best response by Super Saiyan X.)
just was wondering is it possible to call a verb by a string like
var/verbpicked="flight"

src.+[verbpicked]+()


or however you do strings or something similar to this?

Best response
ive seen this and tried messing with it but i could never get it to work
call(src,"/mob/verb/myverb")()
is there a way i can do it where it calls a verb based on a var?
var/skill="test"
call(src,"/mob/verb/[skill]")()


like how would i do it in that fashion is it doable?
and that code you gave me doesnt seem to do anything when i tried to get it to call a verb
If you're specifying the whole path to the verb/proc, use text2path().

mob/verb/Test(skill in list("A","B"))
call(usr, text2path("/mob/verb/[skill]"))()

mob/verb/A()
usr << "A"

mob/verb/B()
usr << "B"


Otherwise you can just do like so:
mob/verb/A()
usr << "A"

mob/verb/B()
usr << "B"

mob/verb/Test2(skill in list("A","B"))
call(usr, skill)() // notice no /mob/verb/ prefix
You actually shouldn't need text2path() in call() according to Lummox (in fact he said in a lot of places where paths are used like that a string will work, but I can't find the post)