Posted by
| Dace K
Canada (169 posts) Bio
|
Message
| Hey. been trying to make a recursive trance that re-reruns itself after its timer expires.. but after the first timer, it completely exits the function - and I can't figure out why.
Here's a look:
void do_trance( CHAR_DATA *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
/*while (ch->substate != SUB_TIMER_DO_ABORT)
{*/
switch( ch->substate )
{
default:
if ( IS_NPC(ch) && IS_AFFECTED( ch, AFF_CHARM ) )
{
send_to_char( "You can't concentrate enough for that.\n\r", ch );
return;
}
if ( ch->mount )
{
send_to_char( "You can't do that while mounted.\n\r", ch );
return;
}
act( AT_MAGIC, "You sink into a deep trance, contemplating your inner soul.", ch, NULL, NULL, TO_CHAR );
act( AT_MAGIC, "$n falls into $mself, shutting out the rest of the world.", ch, NULL, NULL, TO_ROOM );
ch->alloc_ptr = str_dup( arg );
add_timer( ch, TIMER_DO_FUN, UMIN(skill_table[gsn_trance]->beats / 10, 3), do_trance, 1 );
return;
case 1:
if ( !ch->alloc_ptr )
{
send_to_char( "Your trance was interrupted!\n\r", ch );
bug( "do_trance: alloc_ptr NULL", 0 );
return;
}
/*pager_printf( ch, "Timer Value: %d\n\r", get_timer(ch, TIMER_DO_FUN) );*/
/*strcpy( arg, ch->alloc_ptr );
DISPOSE( ch->alloc_ptr );*/
break;
case SUB_TIMER_DO_ABORT:
DISPOSE( ch->alloc_ptr );
ch->substate = SUB_NONE;
send_to_char( "You come out of your trance...\n\r", ch );
act( AT_ACTION, "$n's eyes flash open!", ch, NULL, NULL, TO_ROOM );
return;
}
if ( can_use_skill(ch, number_percent(),gsn_trance ) )
{
learn_from_success( ch, gsn_trance );
act( AT_MAGIC, "You find new depths of power within yourself, and bring it out to the surface.", ch, NULL, NULL, TO_CHAR );
ch->mana+=55;
if (ch->mana > ch->max_mana)
ch->mana = ch->max_mana;
}
else
{
learn_from_failure( ch, gsn_trance );
act( AT_MAGIC, "You fail to find any depths of hidden power within yourself.", ch, NULL, NULL, TO_CHAR );
}
add_timer( ch, TIMER_DO_FUN, UMIN(skill_table[gsn_trance]->beats / 10, 3), do_trance, 1 );
return;
}
Any ideas? |
ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com
Drop by the area archives and find something for your mud. http://areaarchives.servegame.com | Top |
|