ID:149295
 
Uhh, sorry the subject is so bad, couldn't think of any better way to phrase it. :)

I have a very simple help verb. I wanted it set up so you type help by itself and it gives an index of topics, or you type help blahblahblah to view that help topic.

Only problem is, the way I have it set up

mob/verb/help(arg1 as null|text)
if (arg1 == null)
src << blah
if (arg1 == "Commands"|"commands")
src << blah2

Well, Blah shows fine, but help commands causes
Sorry, the following is not valid: Blah
usage: help ["text"]

help "commands" works, but that's not really what I'm looking for. Is there a way to get it to accept a single word (not an entire string with spaces and junk) and not use quotes?



What's wrong with doing something like this?

<code>mob/verb/Test(topic in list("Robots","Chili","Fish")) src << "Help information on [topic]:" switch(topic) if("Robots") src << "Robots are evil." if("Chili") src << "Chili is hot." if("Fish") src << "Fish are silvery water-going creatures. </code>
In response to Foomer
Well, I'd like to avoid input and alert menus as much as possible.... But I guess that'd work.
In response to Zagreus
Would it be alright to type in a text string and have it fit the closest match in a list?
In response to Foomer
Well, that'd be a cool improvement, is there a proc you could point me to that does something like that? I've never seen it...

Your previous example works okay, except it pops up that input menu if your choice is null, I tried various different methods of adding | null to the argument area, but none seemed to work. I'm guessing it's not possible to mix both "in" and "as", so what I'm looking for would probably be a lot more complicated than a simple one or two line fix. :(
In response to Zagreus
Well, I'm not sure there is a way to avoid is quite the way you want, it's one of the annoying disadvantages of verbs and the reason why I've resorted to building my own parser.

The only alternative I've come up with is one that will let you type the verb, and accept any acceptable commands after it (finding the closest match if it can), but won't do anything if you click on the verb itself. If you're using it for any kind of game that doesn't show a verb panel, it could be what you want, if not, I'd say you're pretty much stuck until dantom decides to revamp their verbs.

Here's a little demo, you can pick it appart all you want:

<code>mob/verb/Help(topic as command_text) var/options = list("Commands","Emotes","Fishing","Robotics") topic = Match(topic,options) switch(topic) if("Commands") src << "Commands let you do stuff." if("Emotes") src << "Emotes are like acting." if("Fishing") src << "Fishing helps you catch fish." if("Robotics") src << "Use robotics to build stuff." else src << "What would you like help on?" proc/Match(message,list/list) for(var/cut=2,cut<=length(message)+1,cut++) for(var/O in list) if(findtext(copytext(O,1,cut),message)) return O return</code>
In response to Foomer
Thanks a ton! You're awesome. That helped a lot. It still doesn't work by itself, but at least those annoying quotes are gone, and I think I have an idea on how I can get it to work by itself now. Thank you very much.