Login
User Name:

Password:



Register

Forgot your password?
Object Reader for SmaugFUSS Created for 1.9.9
Aug 6, 2026 6:33 am
By Angst
do_advance
Jun 27, 2026 10:32 am
By Remcon
Time spamming LOP1.6
Jun 17, 2026 4:03 pm
By Remcon
A Bash Startup Script
Feb 7, 2026 3:49 pm
By eldhamud
Force Skills
Jan 1, 2026 3:58 pm
By Elwood
SWFotEFUSS 1.5.4
Author: Various
Submitted by: Samson
SWRFUSS 1.4.4
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.9
Author: Various
Submitted by: Samson
AFKMud 3.0.0
Author: AFKMud Team
Submitted by: Samson
SillyMUD 1.2a
Author: J. Brothers, J. Sievert, et al
Submitted by: Samson
Users Online
Anthropic, Sogou, Bing, Amazonbot, Yandex

Members: 0
Guests: 30
Stats
Files
Topics
Posts
Members
Newest Member
518
3,814
19,729
594
CeciliaMac

» SmaugMuds » General » Coding » Skill/Timer bugs
Forum Rules | Mark all | Recent Posts

Skill/Timer bugs
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 27, 2004 8:54 am   Last edited Nov 24, 2007 5:11 pm by Samson
Go to the top of the page
Go to the bottom of the page

DjNiVeK
Fledgling
GroupMembers
Posts12
JoinedDec 14, 2003

 
I put this on a different forum aswell, but haven't got an answer on that yet, so yea, all help is welcome

I don't know much about timers, but what I just coded in gives me 3(6) bugs, but I don't know why or how. I tried a lot already, like making different do_functions for it, but it still didn't work. It probably is something easy, but yea...I can't figure it out lol.
I'll explain the idea for the code first:
I want to make it so that skills take up some time to use and their opponent can counter it with their skills.

I get the following errors:

magic.c: In function 'spell_water_dragon_blast':
magic.c:7338: error: syntax error before "ch_ret"
magic.c:7340: error: case label not within a switch statement
magic.c:7344: error: syntax error before "ch_ret"
magic.c:7347: error: case label not within a switch statement
magic.c:7351: error: syntax error before "ch_ret"
magic.c:7354: error: case label not within a switch statement

The code of the skill:
ch_ret spell_water_dragon_blast( int sn, int level, CHAR_DATA *ch, void *vo )
{
    CHAR_DATA *victim = (CHAR_DATA *) vo;
    int dam;

    level	= UMAX(0, level);
    level	= UMIN(150, level);
    dam  = number_range( 1, 7 )*number_range( 50, 75 );

    act( AT_MAGIC, "You start performing seals", ch, NULL, NULL, TO_CHAR);
    act( AT_MAGIC, "$n starts performing seals", ch, NULL, NULL, TO_CHAR);
    add_timer( ch, TIMER_NONE, 1, ch_ret spell_water_dragon_blast, 1 )
    ch->alloc_ptr = str_dup( staticbuf );
   case 1:
    act( AT_MAGIC, "...ox tiger bird monkey rat ox...", ch, NULL, NULL, TO_CHAR);
    act( AT_MAGIC, "...ox tiger bird monkey rat ox...", ch, NULL, NULL, TO_ROOM);
    DISPOSE( ch->alloc_ptr );
    add_timer( ch, TIMER_NONE, 2, ch_ret spell_water_dragon_blast, 2 )
    ch->alloc_ptr = str_dup( staticbuf );
   case 2:
    act( AT_MAGIC, "You yell: '...Bird! Suiton Suiryuudan no Jutsu!'", ch, NULL, NULL, TO_CHAR);
    act( AT_MAGIC, "$n yells: '...Bird! Suiton Suiryuudan no Jutsu!'", ch, NULL, NULL, TO_ROOM);
    DISPOSE( ch->alloc_ptr );
    add_timer( ch, TIMER_NONE, 3, ch_ret spell_water_dragon_blast, 3 )
    ch->alloc_ptr = str_dup( staticbuf );
   case 3:
    act( AT_MAGIC, "A large dragon made completely of water rises up and charges at $N", ch, NULL, NULL, TO_ROOM);
    act( AT_MAGIC, "A large dragon made completely of water rises up and charges at $N", ch, NULL, NULL, TO_CHAR);
    DISPOSE( ch->alloc_ptr );
    if ( IS_AFFECTED( victim, AFF_SHARINGAN ) )
    {
	if( victim->pcdata->learned[sn] )
	{
	return damage( ch, victim, dam, sn );
	}
        if( victim->mana pcdata->learned[sn] = 20;
        victim->mana -= 150;
	act( AT_FIRE, "Your sharingan starts spinning at a fast rate!\r\n", victim, NULL, NULL, TO_CHAR);
	act( AT_YELLOW, "You just copied Water Dragon Blast!\r\n", victim, NULL, NULL, TO_CHAR );
	act( AT_FIRE, "$n's sharingan starts spinning!\r\n", victim, NULL, NULL, TO_ROOM );
	return damage( ch, victim, dam, sn );
    }

    if ( saves_spell_staff( level, victim ) )
	dam /= 2;
    return damage( ch, victim, dam, sn );
}

Post is unread #2 Feb 27, 2004 2:46 pm   Last edited Nov 24, 2007 5:11 pm by Samson
Go to the top of the page
Go to the bottom of the page

cynshard
Apprentice
GroupMembers
Posts95
JoinedNov 19, 2003

 
I haven't spent much time looking at skills but your problem seems to be that you aren't using case statements properly.
The general syntax of a switch is like this
switch (var)
{
     case 1:
     stuff...
     break;
     case 2:
     stuff...
     break:
     default:
     stuff...
     break;
}


where if var == 1 it does the stuff after case 1.

Post is unread #3 Mar 22, 2004 6:06 pm   
Go to the top of the page
Go to the bottom of the page

Odis
Fledgling
GroupMembers
Posts46
JoinedMar 8, 2005

 
I'm pretty sure the syntax error is from the way you use add_timer.

add_timer( ch, TIMER_NONE, 1, ch_ret spell_water_dragon_blast, 1 );

Should be:

add_timer( ch, TIMER_NONE, 1, spell_water_dragon_blast, 1 );

The previous post is also correct. A switch as far as I can tell isn't even declared. Follow the form he stated.

Pages:<< prev 1 next >>