PennMUSH Community

Ticket #7644 (new suggested feature)

Opened 2 months ago

Last modified 2 months ago

Error messages for namelist()

Reported by: KimikoMuffin Assigned to:
Priority: minor Milestone:
Keywords: Cc:
Visibility: Public

Description

An optional second argument for namelist(), containing a list of dbrefs, sends an error message to the dbrefs, much like Page does. Maybe a third argument for the format of the error message, like so:

"[namelist(#1 Javelin "ringo spar" bogus,%#,No such creature as "%0".)]

No such creature as "bogus".

You say, "#1 #7 #56 #-1"

Attachments

namelist-arg.patch.txt (3.8 kB) - added by Talvo on 07/21/08 12:52:38.
Patch for namelist(<list>[,<obj>/<attr>])

Change History

(follow-up: ↓ 2 ) 07/01/08 13:04:51 changed by Talvo

A second arg specifying a (possibly anonymous) attribute to be called with each failing element might be better? People could still do something like #lambda/pemit(%#\,No such creature as "%%0".) then, but could do other things if they wanted to. (Passing all the failed matches as a list would be better still, IMHO, but there's no safe character that can be used as a delimiter...)

(in reply to: ↑ 1 ) 07/20/08 09:56:37 changed by KimikoMuffin

Hmm, good point on the "anonymous attribute" ...

What if | (pipe character) was used as a delimiter? I'm pretty sure that can't be used in names ... Or is that just becuase I have "only_ascii_in_names" set to "Yes"?

(follow-up: ↓ 4 ) 07/20/08 11:34:00 changed by Talvo

It can't be used in names, no - but that's part of the problem. What they're entering isn't necessarily a valid name (in fact, if it gets to the error message part then it's definately not a valid name). namelist(foo bar|baz boing) is a valid way to call the function, with "bar|baz" being one of the three invalid/unmatched names given.

(in reply to: ↑ 3 ) 07/20/08 11:51:11 changed by KimikoMuffin

Good point -- I'm too used to using it to delimit lists which are *not* entered by users but, say, taking a list of dbrefs from some other source (i.e. the result of a search() or lvplayers() or whatever) and turning it into a list of names which is then passed into itemize() or something ...

07/21/08 12:52:38 changed by Talvo

  • attachment namelist-arg.patch.txt added.

Patch for namelist(<list>[,<obj>/<attr>])