ID:162359
 
What a great feature :D

As it is though, there is one major quirk that I have with it. It will not turn a text to a verb path. Meaning, you can not turn "/mob/verb" into /mob/verb. Is there any way to do this? As it is, I'm trying to make the game index all /mob type verbs (meaning all in sub path as well) into a list for debugging purposes.

Any ideas?
Look up typesof() in the reference (F1 in Dream Maker).
In response to Popisfizzy
I want it to index everything so that I don't have to go through each thing individually. As it is this is what I had thought of:

proc/Verbs(L)
for(var/M in typesof(L))
if(L==M) continue
Verbs(M)
var/list/verbList=list()
for(var/M in typesof(text2path("[L]/verb"))) verbList+=M
return verbList


Where upon calling Verbs(/mob) the value returned would be the list of indexed verbs.
In response to Feenux
How about clients already have a verbs list variable?
In response to Feenux
I thought you wanted a list of the verbs under /mob. Now you want a list of verbs under the player? Look up client.verbs or mob.verbs for verbs that belong to the player. As for indexing...

proc/ReturnIndex_mob_verb_assoc()
var/list/mob_types = typesof(/mob)
var/list/verb_assoc = list()
for(var/r in mob_types)
verb_assoc[r] = typesof(text2path("[r]/verb/"))
return verb_assoc


Let's examine this code. What is returned is a list of all types of mobs and the verbs defined under them. mob_types is a list of every type of mob and verbs_assoc is the actual list we want. We loop through every mob and set the specific type of mob to his verbs. Then the list is returned to the parent procedure.

Using the procedure is very simple. Say we are making a permanent recording of this because these values won't change during runtime anyway.

var/list/mob_verb_assoc 

proc/define_mob_verb_assoc()
mob_verb_assoc = ReturnIndex_mob_verb_assoc()


Now we want to recall the verbs for x type. We just use the following:
mob/proc/getVerbs()
if(!mob_verb_assoc || !(src.type in mob_verb_assoc)) return
var/list/myVerbs = mob_verb_assoc[src.type]


getVerbs accesses the data in the list through the key of the mob's type. That will return all of the verbs you require in path format. This type of thing can be really useful for those cross-reference errors dealing with typesof() lines. Good luck, and add better error handling. :P
In response to CaptFalcon33035
If you check the code in my second comment, you'll notice that my code is generally the same as your ReturnIndex_mob_verb_assoc(). I'm not trying to index verbs from the player, I'm trying to index every verb under type /mob and all sub types. From what I have attempted, text2path() proc does not seem to recognize verb types.

text2path("/mob/verb/") will return null because it can not find the path. I have even tried "/mob/verb" and it will not work.
In response to Feenux
If you've been paying any attention at all, you'd know that you just can't stick something in there like "/mob/verb/" in there and expect to get a true result (in terms of a boolean value). There is no such verb as "/mob/verb." If you'd check the code in your second comment, you'd notice that they are by no means the same. They are oh so very different.

What did you think Fizzy was suggesting?
In response to CaptFalcon33035
Either A) I'm the biggest joke in coding history, or I'm absolutely right and you haven't actually looked at the code.

So, let me get this straight... you're saying that:
for(var/M in typesof(text2path("/mob/verb"))) verbs+=M

should not work? Might I ask why? Because my logic keeps telling me it should. In all rights and respects it should be the same as
for(var/M in typesof(/mob/verb)) verbs+=M


The reason there is no error handling is because it's only a test, now when I actually code it into something it will have error handling. And, nothing personal, but have you even checked your own code to see if it worked? Sorry, if it sounds like I'm being mean, or unappreciative, I'm just frustrated. And so you know:
if(text2path("/mob/verb")) src<<"Test"
if(text2path("/mob/verb/")) src<<"Test"

Neither will send "Test" to src since the returned value is NULL. Which again is why I'm saying text2path doesn't work with verbs (from what I have seen and tried)
In response to Feenux
I would think they would be the same, but from what I have seen, apparently a verb path is not treated like other paths. To reference verbs you either have to type in the path directly. Or refer to it as a text string. As in the example, I posted from my answer to your other post.

Example
In response to Asielen
Thanks very much, didn't even think to try that.
In response to Feenux
I was dead wrong, actually. You're absolutely right.

I made a mistake in the code provided. Remember how I stated that text2path() will produce a null value when sent a verb path without any actual verb (i.e. text2path("/mob/verb/"))? Well, that line in the for loop was not to include text2path() at all. Kaioken once showed me that typesof() accepts string arguments, as well! Just pass the plain text, without the text2path() procedure, into the typesof() and it will work flawlessly, methinks.

Change
    for(var/r in mob_types)
verb_assoc[r] = typesof(text2path("[r]/verb/"))


to
    for(var/r in mob_types)
verb_assoc[r] = typesof("[r]/verb/")


And I apologize for being an ass.