30 Jul, 2009, Xrakisis wrote in the 1st comment:
Votes: 0
Hi,
I installed the rom casting snippet, SoldierSide Magic System. Im having one problem..

c 'identify' shield
You begin to cast a spell. (type 'stop' to cancel)

<16592/25655hp 12657/15580m 3817/33265mv (621870exp)>
You move into a dance like motion as you speak the ancient tongue!

<16592/25655hp 12657/15580m 3817/33265mv (621870exp)>
You move into a dance like motion as you speak the ancient tongue!
The awesome power of magic flows to your finger-tips!
You don't know any spells of that name.

it says "You don't know any spells of that name." for every spell i try to cast..


if (ch->casting_spell == '\0' || ch->casting_spell == FALSE)
{

if (arg1[0] == '\0')
{
send_to_char ("Cast which what where?\n\r", ch);
return;
}

if ((sn = find_spell (ch, arg1)) < 1
|| skill_table[sn].spell_fun == spell_null
|| (!IS_NPC (ch)
&& ((ch->level < skill_table[sn].skill_level[ch->class]
&& ch->level2 < skill_table[sn].skill_level[ch->class2]
&& ch->level3 < skill_table[sn].skill_level[ch->class3])
|| ch->pcdata->learned[sn] == 0)))
{
send_to_char ("You don't know any spells of that name.\n\r", ch);
return;
}



if ((sn = find_spell(ch,arg1)) < 1
|| skill_table[sn].spell_fun == spell_null
|| (!IS_NPC(ch) && (ch->level < skill_table[sn].skill_level[ch->class]
|| get_skill(ch, sn) < 1)))

{
send_to_char( "You don't know any spells of that name.\n\r", ch );
return;
}
30 Jul, 2009, Xrakisis wrote in the 2nd comment:
Votes: 0
opps.. my bad.. forgot to allow for ch->class2 and ch->class3 in the part from the snip..
30 Jul, 2009, Xrakisis wrote in the 3rd comment:
Votes: 0
odd.. ok. maybie that wasnt the problem.. still happening.
30 Jul, 2009, Koron wrote in the 4th comment:
Votes: 0
I did a similar magic system. I would suggest checking the validity of the spell before players try to cast it–if they don't know the spell, they certainly don't know the ancient tongue for it, right? So, I compared all that fun stuff first and then stored the spell information in ch->casting. Try adding debug information at various places. What is sn at the time of that comparison? Have it tell you. Don't worry about spamming yourself, spam is helpful. (Just remember to delete these lines after you've fixed it.)
30 Jul, 2009, Kline wrote in the 5th comment:
Votes: 0
I've also done a similar system, and as Koron said, you just need to check that they know the spell/it exists before starting the sequence. Here's my do_cast if you'd like a frame of reference. It just checks for the spell, sends a little output, then sets the timer and adds to the list for the spell to go off later.

void do_cast( CHAR_DATA *ch, char *argument )
{
char tmp[100];
char buf[MSL];
char *color;
int sn = -1;
float mod_time;

tmp[0] = '\0';
one_argument(argument,tmp);

if( IS_CASTING(ch) )
{
send_to_char("You are already casting a spell. Move or use @@Rstop@@N to cancel.\r\n",ch);
return;
}

if( (sn = skill_lookup(tmp)) < 0 )
{
send_to_char("Wiggle swiggle biggle?\r\n",ch);
return;
}

switch( skill_table[sn].target )
{
default: color = "@@N"; break;
case TAR_IGNORE: color = "@@p"; break;
case TAR_CHAR_OFFENSIVE: color = "@@e"; break;
case TAR_CHAR_DEFENSIVE: color = "@@l"; break;
case TAR_CHAR_SELF: color = "@@r"; break;
case TAR_OBJ_INV: color = "@@y"; break;
}
snprintf(buf,MSL,"$n's eyes begin %sglowing@@N as $e begins to utter magical incantations!",color);
act(buf,ch,NULL,NULL,TO_ROOM);
ch_printf(ch,"You begin casting %s%s@@N.\r\n",color,skill_table[sn].name);

mod_time = skill_table[sn].beats;

if( IS_SET(race_table[ch->race].race_flags,RACE_MOD_FAST_CAST) )
mod_time *= 0.85;

free_string(ch->casting->arg);
ch->casting->arg = str_dup(argument);
ch->casting->time = mod_time;
ch->casting->max_time = (mod_time * sysdata.max_pushback);
cast_list.push_back(ch);

return;
}
30 Jul, 2009, Erok wrote in the 6th comment:
Votes: 0
Xrakisis said:
<16592/25655hp 12657/15580m 3817/33265mv (621870exp)>

Going off on a little tangent here…

Is there a preference for raw status numbers? I decided to convert them to a percentage and, if color is enabled, to display them in green, yellow, or red…

e.g., <55 100 100>

I show the same figures after each damage report to a mob so you can see its status, and head for the hills if you need to…

e.g., You slash a hob-goblin with your short sword <25 100 60>

The tidy numbers appeal to me, and I can't (yet) be bothered to provide numerous prompt customization options. But are most users going to prefer something else?
30 Jul, 2009, Kline wrote in the 7th comment:
Votes: 0
Whatever you decide, use it across the board. If you're only going to show me % based amounts for my health but give me healing spells that heal flat values, that's confusing and misleading to see "greater heal of uberness" only bump my life by 1% because I have too much life at that point. If you search there's been a few threads about big/small numbers and various ways to display the messages with them, particularly for combat.
30 Jul, 2009, David Haley wrote in the 8th comment:
Votes: 0
You could just make it configurable: have a user table from color category to actual color. Then let them specify the color for "status_bad", "status_medium", "status_good", etc.

In general I actually really dislike the MUD imposing colors upon me. It is far preferable IMO to let the user specify colors for message categories.
30 Jul, 2009, Mabus wrote in the 9th comment:
Votes: 0
Koron said:
Try adding debug information at various places. What is sn at the time of that comparison? Have it tell you. Don't worry about spamming yourself, spam is helpful. (Just remember to delete these lines after you've fixed it.)

I often do that. I just make sure to end all such lines with //debug, and then it is easy to walk a find down a page and comment the lines out afterward.
31 Jul, 2009, Bojack wrote in the 10th comment:
Votes: 0
Try this, just take sn = find_spell (ch, arg1) that out of the if statement and put that above it it like this:
sn = find_spell (ch, arg1);
if ( (find_spell (ch, arg1)) < 1
|| skill_table[sn].spell_fun == spell_null
|| (!IS_NPC (ch))
|| (ch->pcdata->learned[sn] == 0)
&& ((ch->level < skill_table[sn].skill_level[ch->class]
&& ch->level2 < skill_table[sn].skill_level[ch->class2]
&& ch->level3 < skill_table[sn].skill_level[ch->class3])) )
31 Jul, 2009, Xrakisis wrote in the 11th comment:
Votes: 0
I did what you said Bojack.. but im gettin this..

Program received signal SIGSEGV, Segmentation fault.
0x080beb11 in do_cast (ch=0x409285e0, argument=0x40927323 "'tesseract' seer") at magic.c:330
330 if (find_spell(ch,arg1) < 1
(gdb) bt
#0 0x080beb11 in do_cast (ch=0x409285e0, argument=0x40927323 "'tesseract' seer") at magic.c:330
#1 0x080bd071 in interpret (ch=0x409285e0, argument=0x40927323 "'tesseract' seer") at interp.c:636
#2 0x08076bc5 in substitute_alias (d=0x40926f00, argument=0x40927321 "c 'tesseract' seer") at alias.c:67
#3 0x08080137 in game_loop_unix (control=5) at comm.c:844
#4 0x0807faeb in main (argc=2, argv=0xbffff6e4) at comm.c:460
31 Jul, 2009, Kline wrote in the 12th comment:
Votes: 0
Is arg1 actually being assigned as anything? You would need to "print arg1" from that backtrace.
31 Jul, 2009, Koron wrote in the 13th comment:
Votes: 0
Info locals is also a fun tool, though to be honest I don't think I've solved too many crises with it.
0.0/13