25 Nov, 2011, arholly wrote in the 1st comment:
Votes: 0
Hello:
I've got a problem with a ritual command. What it does is the player does the movements involved with a ritual and then "intones" the ritual (along with any arguments for the ritual) but when they do the final intone command, it hangs just that player. The original coder, whom I contacted, said they thought it might be overwriting the buffer, but they never got around to really looking at. Can anyone see anything in here which they would be able to help with? I will also supply the ritual I know it hangs on (though it does it with all rituals). Any help would be appreciated greatly.
void do_rituals( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *obj;
void *vo;
int sn, rn;
int target;

target_name = one_argument( argument, arg1 );
one_argument( target_name, arg2 );

if(ch->power_timer > 0)
{
send_to_char("Your powers have not rejuvenated yet.\n\r", ch);
return;
}

if ( arg1[0] == '\0' )
{
send_to_char( "Which action are you trying to perform?\n\r", ch );
do_function(ch, &do_rituals, "list actions");
return;
}

if(!str_prefix("cancel", arg1))
{
send_to_char("You stop performing the ritual.\n\r", ch);
clear_rite(ch);
return;
}

if(!str_prefix(arg1, "list"))
{
if(arg2[0] == '\0')
{
send_to_char("Are you trying to list the actions or rites?\n\r",ch);
return;
}

if(!str_prefix(arg2, "actions"))
{
send_to_char("Available ritual actions are:\n\r", ch);
for(sn = 0; rite_actions[sn].name != NULL; sn++)
{
if(sn%4==0) send_to_char("\n\r", ch);
sprintf(arg2, "%14s", rite_actions[sn].name);
send_to_char(arg2, ch);
}
send_to_char("\n\r", ch);
return;
}

if(!str_prefix(arg2, "rites"))
{
rn = 1;
send_to_char("Available rituals are:\n\r", ch);
for(sn = 0; ritual_table[sn].name != NULL; sn++)
{
if(rite_available(sn, ch))
{
sprintf(arg2, "%14s", ritual_table[sn].name);
send_to_char(arg2, ch);
rn++;
}
if(rn%4==0) send_to_char("\n\r", ch);
}
send_to_char("\n\r", ch);
send_to_char("In order to use any of the above rituals,", ch);
send_to_char(" you need to know the proper actions.\n\r", ch);
send_to_char("There is no automated method of learning rites.)\n\r",
ch);
return;
}

send_to_char("Are you trying to list the actions or rites?\n\r",ch);
return;
}

if((rn = riteaction_lookup(arg1)) >= 0 && rn < MAX_RITE_ACTIONS)
{
if(ch->ritepoint >= MAX_RITE_STEPS)
{
send_to_char("You can't add any more steps to this ritual!\n\r",ch);
send_to_char("(Use 'ritual intone' to complete it.)\n\r",ch);
return;
}

act(rite_actions[rn].to_char, ch, NULL, NULL, TO_CHAR, 1);
act(rite_actions[rn].to_room, ch, NULL, NULL, TO_ROOM, 0);
ch->riteacts[ch->ritepoint] = rn;
ch->ritepoint++;
WAIT_STATE( ch, rite_actions[rn].beats );
return;
}

if(str_prefix(arg1, "intone"))
{
send_to_char("That is not a valid action.\n\r", ch);
return;
}

if((rn = rite_lookup(ch)) < 0)
{
send_to_char("Nothing happens.\n\r", ch);
clear_rite(ch);
return;
}

if ((sn = find_spell(ch,ritual_table[rn].name)) < 1)
{
send_to_char( "Your actions seem to mean nothing… yet…\n\r", ch );
return;
}

if (skill_table[sn].spell_fun == spell_null)
{
send_to_char( "Your actions seem to mean nothing…\n\r", ch );
return;
}

if ((!IS_NPC(ch) && !skill_table[sn].available[ch->race]))
{
send_to_char( "Your actions seem to mean nothing to you…\n\r", ch );
return;
}

/*
* Locate targets.
*/
victim = NULL;
obj = NULL;
vo = NULL;
target = TARGET_NONE;

switch ( skill_table[sn].target )
{
default:
bug( "Do_ritual: bad target for sn %d.", sn );
return;

case TAR_IGNORE:
break;

case TAR_CHAR_DEFENSIVE:
if ( arg2[0] == '\0' )
{
victim = ch;
}
else
{
if ( ( victim = get_char_room( ch, target_name ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
}

vo = (void *) victim;
target = TARGET_CHAR;
break;

case TAR_CHAR_SELF:
if ( arg2[0] != '\0' && !is_name( target_name, ch->name ) )
{
send_to_char("You cannot perform this ritual for another.\n\r", ch);
return;
}

vo = (void *) ch;
target = TARGET_CHAR;
break;

case TAR_OBJ_INV:
if ( arg2[0] == '\0' )
{
send_to_char( "What should the ritual be performed upon?\n\r", ch );
return;
}

if ( ( obj = get_obj_carry( ch, target_name, ch ) ) == NULL )
{
send_to_char( "You are not carrying that.\n\r", ch );
return;
}

vo = (void *) obj;
target = TARGET_OBJ;
break;

case TAR_OBJ_CHAR_OFF:
if (arg2[0] == '\0')
{
if ((victim = ch->fighting) == NULL)
{
send_to_char("Perform the ritual on whom or what?\n\r",ch);
return;
}

target = TARGET_CHAR;
}
else if ((victim = get_char_room(ch,target_name)) != NULL)
{
target = TARGET_CHAR;
}

if (target == TARGET_CHAR) /* check the sanity of the attack */
{

if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master == victim )
{
send_to_char( "You can't do that on your master.\n\r",
ch );
return;
}

vo = (void *) victim;
}
else if ((obj = get_obj_here(ch,target_name)) != NULL)
{
vo = (void *) obj;
target = TARGET_OBJ;
}
else
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
break;

case TAR_OBJ_CHAR_DEF:
if (arg2[0] == '\0')
{
vo = (void *) ch;
target = TARGET_CHAR;
}
else if ((victim = get_char_room(ch,target_name)) != NULL)
{
vo = (void *) victim;
target = TARGET_CHAR;
}
else if ((obj = get_obj_carry(ch,target_name,ch)) != NULL)
{
vo = (void *) obj;
target = TARGET_OBJ;
}
else
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
break;
}

/* FIX - Put in tests into spells (abil calls/skill calls) */

WAIT_STATE( ch, ritual_table[sn].beats );
clear_rite(ch);

(*skill_table[sn].spell_fun) ( sn, ch->trust, ch, vo,target);

if ((skill_table[sn].target == TAR_CHAR_OFFENSIVE
|| (skill_table[sn].target == TAR_OBJ_CHAR_OFF && target == TARGET_CHAR))
&& victim != ch)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;

for ( vch = ch->in_room->people; vch; vch = vch_next )
{
vch_next = vch->next_in_room;
if ( victim == vch && victim->fighting == NULL )
{
strike( victim, ch );
break;
}
}
}

return;
}

Ritual I know it hangs on:
void rite_introduction( int sn, int level, CHAR_DATA *ch, void *vo, int target)
{
CHAR_DATA *vch;

if( count_words(target_name) < 1 || count_words(target_name) > 20)
{
send_to_char("You must send a message of 20 words or less.\n\r", ch);
return;
}

for ( vch = char_list; vch != NULL; vch = vch->next )
{
if(ch->clan == vch->clan)
act("$N projects an introduction, '$t'",
vch, target_name, ch, TO_CHAR, 1);
}

ch->power_timer = 2;
}

Thanks,
Arholly
Random Picks
0.0/1