ID:169384
 
Hello, Everybody
I'm just getting my feet wet in DM and working my way through the guide making up exercises for the chapters.
I'm on the list chapter right now and was trying to create a player verb to list all the verbs with their descriptions to the text window. I'm aware that every mob has a 'verbs' list which holds (I'm guessing here) a list of verbs (or refrences to them). But am unable to find/decipher any info in the guide about how to move through that list and output the verb name and desc.

I've been trying:
mob
player
verb
what_I_can_do()
verb/v
for(v in verbs)
usr << "[v.name] : [v.desc]"

I've also tried v().name
Neither works.
I suppose I'm wondering how can you access the verb's properties in a situation like this.

Thanks in advance for any help or advice you can give.
mob
verb
whatcanido()
for(var/v in src.verbs)
if(!v:desc)
usr<<"Name: [v:name] Desc:None"
else
usr<<"Name: [v:name] Desc:[v:desc]"

_>
In response to Nintendo
Thanks, Nintendo
That was it exactly. I'll try to puzzle out the why, now. Here the ':' is the run-time search operator, right? I couldn't use that to change a verb's name or description at run-time tho, I'm guessing.
I'll mess around with it.
Thanks, again.
In response to TheMonkeyDidIt
Don't use the bogus ':' operator when you can use the more robust '.' operator.

mob/verb/whatcanido()
set desc="Check what you can do" //Set a description for the verb
for(var/mob/M in src.verbs)
if(!M.desc) {src<<"Name: [M.name] - Desc: None"
else {src<<"Name: [M.name] - Desc: [M.desc]"
In response to Mega fart cannon
That one didn't seem to work...
In response to Mega fart cannon
Verbs are not mobs.
mob/verb/test()
var/T
for(var/V in verbs)
T=V.desc
if(!T)T="none"
src<<"Name: [V.name] - Desc: [T]"

I think that is what you meant.