ID:1622291
 
BYOND Version:506.1247
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Chrome 35.0.1916.153
Applies to:Dream Seeker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
I was wanting to see if I could generate a list of available procs using typesof() for a given type, but since text2path() isn't working as expected, that just isn't going to happen without hard-coding the paths for each individual object type.

The strange thing is that "/someobject/proc/someproc" works but just "/someobject/proc" doesn't, which makes me consider this to be a bug, and not just a limitation of text2path().

Numbered Steps to Reproduce Problem:
1. Compile and run this code:
mob/proc/someproc()

mob/verb/checkpath()
if(text2path("[type]/proc"))
src << "text2path() worked for /mob/proc"
else
src << "text2path() failed at /mob/proc"

if(text2path("[type]/proc/someproc"))
src << "text2path() worked for /mob/proc/someproc"
else
src << "text2path() failed at /mob/proc/someproc"

2. Click the checkpath verb and see how the /proc path fails; yet it works for an individual proc.

Expected Results:
text2path() successfully generates /proc and /verb paths.

Actual Results:
text2path() returns null for /proc and /verb paths.

Workarounds:
Do something terrible like this for every single object:
mob
var
procpath = /mob/proc
verbpath = /mob/verb


I hope this gets fixed. The inconsistency is very annoying.
Here's a better workaround: don't use text2path(). Try typesof("[type]/proc") and see what happens.

I think it's a little-documented (if at all) feature that type paths can sometimes be given as text to some built-in procs.
In response to Kaiochao
That's an excellent find! I had no idea typesof() could take text as an argument. I will now be using that whether or not this bug gets fixed.

I don't think that is documented anywhere. It should at least be added to The Red Book, but I would like to see it in the official DM reference as well.
The "bug" itself here, with text2path not working with procs/verbs has been deferred/not-a-bug'd a few times, unfortunately.

http://www.byond.com/forum/?post=1424721
http://www.byond.com/forum/?post=91969
http://www.byond.com/forum/?post=85607

Maybe somebody will add it to the Red Book. i'm lazy.
In response to Super Saiyan X
Super Saiyan X wrote:
The "bug" itself here, with text2path not working with procs/verbs has been deferred/not-a-bug'd a few times, unfortunately.

I still argue that this is a bug, because text2path() does actually work with individual procs and verbs.

text2path("mob/proc/someproc") works, but text2path("/mob/proc") doesn't. Does that make any sense?

Maybe somebody will add it to the Red Book. i'm lazy.

That's a good example of why things don't improve much around here...

Would you give me permission to port The Red Book onto Nadrew's BYOND wiki? Once it's on the wiki anyone will be able to keep it updated.
id:85607 makes a good case, in that at least ispath(/mob/proc/A) should be true when A is a valid mob proc.

As for the rest of the issues, I believe they all stem from /mob/proc and /mob/verb not being either procs or instantiable types. I don't know if there's a path entry for them at all; they may just be placeholders above the actual procs and verbs. Nevertheless I think it'd be wise to make these work for consistency, so I do consider this a bug.