Re: [CODE] Spell Parser

From: Chris Jacobson (fear@technologist.com)
Date: 04/10/99


On 4/10/99 5:31 AM, Richard P. Bandura (alpha4@capital.net) stated:

>I'm trying to remove the annoying little 'Holy symbols' from the spells on
>my mud. Problem is, since the mud uses tokens and looks for ' then spell
>name then ' then target....i'm getting rather confused, frustrated etc.
>Spells longer than one word cannot be cast (unless they're the first
>double-worded spell on the list like create food, cure blindness etc). I'd
>been thinking perhaps of using the namelist for in-room
>mobs/players/objects, and taking the last argument as the target, but I've
>been told that this won't work. Has anyone  ever found himself where I am
>now? Ideas, suggestions, anything would be appreciated.

A 'hack' probably, but - take the first arg, and look thru the list - if
the spell is multiworded, look at the second, third, etc args to compare
the spell.  If only one option is available, record that option.  If it
is an ambiguous spell (more than one match), use the first one found (by
simply doing: if (spellFound == 0) spellFound = index; else if
(!ambiguous) ambiguous = true; ).

Next, find the number of args that match the spell name, and dispose
those args.

That's roughly the method of doing it.  I can't provide code since I
don't use spells on my system (although if I did I would have eliminated
the single-quote nameblock requirement using this process).

- Chris Jacobson


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST