ID:100645
 
Resolved
call() was still failing to look up procs by name when underscores were included in some cases, although hascall() worked fine.
BYOND Version:474
Operating System:Windows XP Pro
Web Browser:Opera 9.80
Applies to:DM Language
Status: Resolved (499.1204)

This issue has been resolved.
Descriptive Problem Summary:

When you use call like this: call(object, "procname") it doesn't work if the proc's name has an underscore in it.

Numbered Steps to Reproduce Problem:

Run the following snippet, use both verbs.

Code Snippet (if applicable) to Reproduce Problem:
#define DEBUG

mob
verb
test_my_proc()
call(src,"my_proc")(1)

test_myproc()
call(src,"myproc")(2)

proc
myproc(a)
world << a
my_proc(a)
world << a


Expected Results:

Both calls should work.

Actual Results:

It calls myproc fine, but causes this error when trying to call "my_proc":

runtime error: undefined proc or verb /mob/my_proc().

Does the problem occur:
Every time? Or how often?
In other games?
In other user accounts?
On other computers?

It happens every time.

Workarounds:

I haven't found any.
Using "my proc" or "my-proc" may be a workaround.

[edit]
Calling it as "my proc" works.
By default, the name of a proc/verb is the name of the function, except underscores are replaced with spaces. So myproc == "myproc" but my_proc == "my proc". This is pretty legacy stuff from very early on, when we thought the command parser would be a lot more integral to games. So as a short-term solution, call("my proc") should fix it. Or you can use: set name = "my_proc" in the proc declaration.

I consider this a bug because of the runtime error you are getting, though. That is blatantly wrong. And this needs to be documented better.

Probably we can have it look for the literal name as well as the expanded name.
This isn't resolved. (1202)
mob
proc/some_proc()
world << 123

Login()
..()
// "some proc" works, this does not
var proc_name = "some_proc"

// this works either way
if(hascall(src, proc_name))

// this is the line of a runtime error
call(src, proc_name)()

The hascall() goes through just fine, but call()() does not.
Lummox JR resolved issue with message:
call() was still failing to look up procs by name when underscores were included in some cases, although hascall() worked fine.