ID:172804
 
Is it possible to change the name of a verb at runtime? If so, could someone enlighten me as to how?
Nope.
In response to Garthor (#1)
Sure there is...

mob/verb/Myverb()
set name="My new verb"


You still use the normal path while coding however: src.verbs+=mob/verb/Myverb()
In response to Nick231 (#2)
Except that's not at runtime.
In response to Foomer (#3)
Wouldn't it be at runtime if a verb pointed to the MyVerb() proc?
In response to Foomer (#3)
True... thinking backwards. Will still pretty much do what he wants it to do, just compile-time rather than runtime.
In response to Phanes04 (#4)
No.
In response to Nick231 (#5)
Nick231 wrote:
True... thinking backwards. Will still pretty much do what he wants it to do, just compile-time rather than runtime.

No, it would not do what he wants and for the reason you stated (it's done at compile time). I wondered this same thing about verbs myself when I started out, and I thought it unfortunate that I could not change their names.

Being able to change a verb's name would be useful since I could do something like this:
mob/verb
Target(mob/M in view())
target=M
ChangeVerbSetting(/mob/verb/Attack,name,"Attack [M.name]")
Attack()
M.hp-=1
if(M.hp<=0)del(M)


Sure, for that example I could just call the attack verb "Attack Target", but there are times at which I had wished I could do something like that example. You could go with objects in a statpanel and use their Click() and have it work similar to a verb, but it would be nice if you could do it to a real verb.
In response to Loduwijk (#7)
There currently is a system in place for renaming verbs dynamically, but it doesn't work. It'll be fixed for an upcoming version.

It looks like this:

mob/verb/old_verb()
usr << "blah"
mob/verb/add_new_verb(Name as text)
verbs += new /mob/verb/old_verb(src,Name)