Top Mud Sites Forum Return to TopMudSites.com
  Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Read-only archive
The Top Mud Sites forum is closed.
Posting, registration and logins are disabled.

 
Old 03-15-2004, 11:10 AM   #1
xanthic
New Member
 
Join Date: Dec 2003
Posts: 6
xanthic is on a distinguished road
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
 
Old 03-15-2004, 02:03 PM   #2
welcor
Member
 
Join Date: Apr 2002
Location: Aarhus, Denmark, Europe
Posts: 59
welcor is on a distinguished road
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.
 



Removal of the Holy Magic Symbols - Similar Threads
Thread Thread Starter Forum Replies Last Post
The Holy Grail- Free MU* Hosting Faye MUD Administration 4 07-30-2012 06:29 PM
More Subtle Magic NotL337 Advanced MUD Concepts 9 07-30-2006 01:59 AM
Holy Crap soljax Tavern of the Blue Hand 15 12-19-2003 12:00 AM
candle magic Burr Advanced MUD Concepts 5 06-21-2002 09:50 PM
random magic Burr Advanced MUD Concepts 0 06-14-2002 02:09 PM


All times are GMT -4.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2022