sCommand is any sort of input from the player. It isn't restricted to quit. this is some of the output on got with some debug lines.
q
Command: q
qui
Command: qui
quit
Command: quit
QUIT
Command: quit
Those are all the things I typed. Again I was hoping to be able to check against anything and be able to match quit without having to check to see if it contains a q first. Am I wrong in the assumption that (sscanf("quit", sCommand + "%*s")) means try and match what sCommand equals plus anything(%*s) to quit?
"Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum" <10353@lyskom.lysator.liu.se> wrote:
Are you sure sCommand contains what you expect it to? This works fine
for me:
> sscanf("quit", "qu%*s");
(1) Result: 1
>
Although I probably would have used
if(has_prefix("quit", sCommand))
instead.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
>2004-01-10 10:27:
>Subject: sscanf()
>--------------------------------------------------------------------
>Hello it seems as if I am having a tiny little problem with sscanf(). I am trying to match the input given to a string via sscanf. It's a simple little deal but the format I am using obviously isn't working although it has in the past. Here is the code snippet:
>
>if(sscanf("quit", sCommand + "%*s"))
>
>Now what I am trying to accomplish is to see if the player typed anything pertaining to the word quit. I.E q, qu, qui
or even quit itself....Yes why not do a simple if/else. Well because there will be other commands that can be executed that will be longer. Am I setting this up wrong? It has worked in the past outside of pike but still in LPC. I even tried search("quit", sCommand) and that seemed to only return -1 no matter what I typed. Thanks in advance all.
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
>
>
> / Brevb?raren
>
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes