ID:134302
 
Apparently text2path() doesn't accept verb paths (most likely procs too). I'm not sure how intended is that. It will work with 'text2path("/mob")', but will return false with 'text2path("/mob/verb")'. That should be fixed, as well as other procs of the family that might have this problem (ispath(), etc. didn't test them all).
Also, theres that common cross-reference error with typesof(), verb giving and stuff. After fixing text2path(), why not make typesof() be able to use it? You will call typesof() with the "text-version" of the path and it will get rid of the annoying cross-reference error. Of course if you fix text2path only people can softcode it on their own too:
proc/_typesof(path)
if(istext(path)) path=text2path(path)
if(!ispath(path)) return 0
return typesof(path)

Wasn't very sure if this should be posted in the bugs section or here, so there you have it.
text2path() works with verbs.
In response to CaptFalcon33035 (#1)
Did you test it or are you just saying it..?
It doesn't work for me. Using latest beta on Windows.
Code for testing (probably not the easiest on the eyes, but meh):
client/verb/TypeTest()
usr << {"/mob{[ispath(/mob)]}
/mob/verb{
[ispath(/mob/verb)]}
ispath(text2path("/mob")){
[ispath(text2path("/mob"))]}
ispath(text2path("/mob/verb")){
[ispath(text2path("/mob/verb"))]}
text2path("/mob/verb")){
[text2path("/mob/verb")]}"}
if(text2path("/mob/verb")==null) usr << "text2path(\"/mob/verb\") returned null.."

When I click the verb I do get the "returned null" message.
(here's the complete output I get:
/mob{1}
/mob/verb{0}
ispath(text2path("/mob")){1}
ispath(text2path("/mob/verb")){0}
text2path("/mob/verb")){}
text2path("/mob/verb") returned null..
)
So there. Also, ispath(/mob/verb) returns 0.
Waiting for some official reply, I suppose.
Kaioken wrote:
Apparently text2path() doesn't accept verb paths (most likely procs too). I'm not sure how intended is that. It will work with 'text2path("/mob")', but will return false with 'text2path("/mob/verb")'. That should be fixed, as well as other procs of the family that might have this problem (ispath(), etc. didn't test them all).

Fixing this is easier said than done. The code that converts from a string to a path already existed and the text2path() proc just reused it.

Also, theres that common cross-reference error with typesof(), verb giving and stuff. After fixing text2path(), why not make typesof() be able to use it? You will call typesof() with the "text-version" of the path and it will get rid of the annoying cross-reference error.

The cross-reference error basically means you're using it wrong in the first place. text2path() eliminates the error because it defers what you're doing to runtime, when the game can actually understand what you're trying to do. The best fix for this is to not get into those situations.

Lummox JR
In response to Lummox JR (#3)
Yeah, I know how to workaround the cross-reference error. Just that it'd be nicer with the text way. :P

So this is too complicated to fix currently. Oh well, too bad. It'll be nice to have, but I can do without. Thanks for the reply. :)
In response to Kaioken (#2)
I know from experience. My verb saving utility would not work without it. Not only that, but I just tested it again. :P

The problem is that you have to give it an exact path. Not /mob/verb, but /mob/verb/nameofverb.
In response to CaptFalcon33035 (#5)
Yes, but sometimes you will need paths such as '/xyz_random_datum/verb', for example for use with typesof(). I don't remember any other uses currently, though since typesof() accepts it (obviously), other path procs should too, for flexibillity, convienence, and what not.
In response to Kaioken (#6)
Kaioken wrote:
Yes, but sometimes you will need paths such as '/xyz_random_datum/verb', for example for use with typesof(). I don't remember any other uses currently, though since typesof() accepts it (obviously), other path procs should too, for flexibillity, convienence, and what not.

You get those paths from typesof() and send them as an argument to text2path(). It's a very simple concept.
In response to CaptFalcon33035 (#7)
You still don't get it? Re-read previous posts.
Actually, read your post:
"You get those paths from typesof() and send them as an argument to text2path(). It's a very simple concept."
Simple, and incorrect...
Er, typesof() returns a LIST ,which already contains PATH values, not text strings. Therefore there is no reason to send the value[s] it returns to text2path(), and doing so will/should fail.

As said in my previous posts, it would be nice to be able to do something like:
proc/types_of(path)
if(istext(path)) path=text2path(path)
if(!ispath(path)) return 0 //or 'return list()'
return typesof(path)

This will work for normal objects types, but not with verbs/proc 'main tree paths' ("/mob/verb"), since text2path doesn't support em. As enligthened to us by Lummox :P, it isn't so simple to fix and will probably stay that way for a while. So anyway, let this topic die now. :D
In response to Kaioken (#8)
DBZMonster wrote:
Er, typesof() returns a LIST ,which already contains PATH values, not text strings. Therefore there is no reason to send the value[s] it returns to text2path(), and doing so will/should fail.

<_<

Have you ever heard of quotations? typesof() can be used for text strings, or did you not figure this out? You simply take any given path value typesof() returns and wrap quotations and brackets around it like so:

mob/verb/GiveMeTehVerbs()
var/list/L = typesof(/mob/verb/) //Note I typecasted as a list, I know it's a list.
for(var/R in L)
src.verbs += text2path("[R]")


I do know that text2path wasn't needed there at all because you can just add the variable "R" containing the path of a verb to the user, but I couldn't think of any other simple verb that used both typesof() and text2path().

[Edit]
By the way, you were sending the wrong path in that snippet you posted. We already covered this. If you want that to work, take away ispath() because you can't just place in ispath(/mob/verb/). typesof() will return null anyway if there is no such path anyway, I believe.