|
|||||||
This is a discussion on "Removal of the Holy Magic Symbols" in the Top Mud Sites MUD Coding forum : I am trying to remove the need of the Holy Magic Symbols from my circle mud. But how can i make so that regardless if the spell has 1, 2, 3 or more words it should know where to end and find the "target" Many thanks ierodules /GoaX Mud... |
|
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our MUD community today! If you have any problems with the registration process or your account login, please contact us. If you are a registered member of the old TMS forums, please click here
|
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
New Member
Join Date: Dec 2003
Posts: 6
![]() |
I am trying to remove the need of the Holy Magic Symbols from my circle mud. But how can i make so that regardless if the spell has 1, 2, 3 or more words it should know where to end and find the "target"
Many thanks ierodules /GoaX Mud |
|
|
|
|
|
#2 |
|
Member
|
Though I've not done this myself, What you need to do is something along these lines.
Current setup: do_cast uses strtok to find the abbreviated spell name between two ''s: [code] /* get; blank, spell name, target name */ s = strtok(argument, "'"); if (s == NULL) { send_to_char(ch, "Cast what where?\r\n"); return; } s = strtok(NULL, "'"); if (s == NULL) { send_to_char(ch, "Spell names must be enclosed in the Holy Magic Symbols; '\r\n"); return; } t = strtok(NULL, "\0"); /* spellnum = search_block(s, spells, 0); */ spellnum = find_skill_num(s); if ((spellnum < 1) || (spellnum > MAX_SPELLS)) { send_to_char(ch, "Cast what?!?\r\n"); return; }[/quote] Try this on for size: [code] skip_spaces(&argument); if (!*argument) { send_to_char(ch, "Cast what where?\r\n"); return; } spellnum = find_skill_num(argument); if ((spellnum < 1) || (spellnum > MAX_SPELLS)) { /* * if we didn't find it, maybe the last word is a target name * .. let's split this argument at the last space. */ t = strrchr(argument, ' '); if (!t) { send_to_char(ch, "Cast what?!?\r\n"); return; } t++ = '\0'; /* NULL-terminate argument */ spellnum = find_skill_num(argument); if ((spellnum < 1) || (spellnum > MAX_SPELLS)) { send_to_char(ch, "Cast what?!?\r\n"); return; } } [/quote] I hope this helps. |
|
|
|
![]() |
| Thread Tools | |
Removal of the Holy Magic Symbols - Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| More Subtle Magic | NotL337 | Advanced MUD Concepts | 9 | 07-30-2006 02:59 AM |
| Holy Crap | soljax | Tavern of the Blue Hand | 15 | 12-19-2003 01:00 AM |
| The Holy Grail- Free MU* Hosting | Faye | MUD Administration | 2 | 08-27-2002 04:53 AM |
| candle magic | Burr | Advanced MUD Concepts | 5 | 06-21-2002 10:50 PM |
| random magic | Burr | Advanced MUD Concepts | 0 | 06-14-2002 03:09 PM |
|
|