ID:1933010
 
(See the best response by Kaiochao.)
If you give a player a verb that has been renamed, how do you remove it from them?

mob
verb
giveVerb(name as text)
new /mob/custom/verb/tmp/Custom(src, "[name]")

removeVerb()
verbs -= /mob/custom/verb/tmp/Custom


The example above doesn't remove the verb. If I don't rename the verb and keep the original name ("Custom") then it'll work.
Best response
mob
var tmp
added_verb

verb
give_verb(verb_name as text)
added_verb = new /mob/custom/verb/Custom (src, verb_name)

remove_verb()
verbs -= added_verb
Thank you, works perfectly.
Is there any reason why what he had originally wouldn't work aside from the /tmp slipped in?

Why would you need to assign a variable for that, a list maybe if there were large amounts of them you wanted to remove, I'm using

                removeVerb()
src.verbs -= /mob/player/client/verbs/verb/Revert


In a couple of places, and it seems to function perfectly well.
In response to Rushnut
The only difference between his verb and yours is the modified name. A verb with a different name can't be removed by its type, apparently.

I'm not sure why there's a tmp, but it doesn't seem to be affecting anything. I recommend removing it because it's not valid syntax.
In response to Kaiochao
If it isn't saved by its path, then what is a verb saved by?
In response to Rushnut
Verb instance? Verb appearance? It can't be saved by path if it has a modified variable, so something else goes into the verbs list instead. Kinda like overlays, I'm guessing. I don't know exactly.

If it is like overlays, then subtracting by a matching verb should work (and it does):
new /mob/secret/verb/blah (src, "bloop")
verbs -= new /mob/secret/verb/blah (src, "bloop")
In response to Kaiochao
mob
verb
say()
what_are_verbs()
for(var/v in verbs)
world<<v


Outputs

/mob/verb/what_are_verbs
/mob/verb/say


So I'd assume they're saved by their path?
In response to Rushnut
mob/verb/test()
for(var/verb in verbs)
var mob/verb/v = verb
src << "[v.name] ([v]): [v.desc]"

So verbs aren't datums, or else "[v]" would expand to "[v.name]".
In response to Kaiochao
But they have the variable "name" assigned, doesn't that mean they have to be datums?
In response to Rushnut
Rushnut wrote:
But they have the variable "name" assigned, doesn't that mean they have to be datums?

They're objects, but not datums.
They are some sort of internal type that isn't a verb.
So, if someone had a game with old verbs to be removed you could do something like this

mob
var/legacy_verbs = list("old_verb","legs","toast")
proc/remove_verbs()
for(var/verb/v in src.verbs)
if(v:name in legacy_verbs)del(v)

And remove them all safely.
...I'm not sure that you should use del on a verb. Or using the in keyword in a loop like that.
In response to Rushnut
I think that's a savefile versioning issue.