Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Question regarding CHAR_DATA's

Question regarding CHAR_DATA's

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #15 on Sat 11 Dec 2004 12:20 AM (UTC)
Message
I don't see how the 'old code' could work in the first place because it starts out with an else if - but where's the if?

It does have a victim = ch at the top, but if you look carefully you'll see that victim gets changed right afterwards - the victim = ch seems to be a useless statement.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #16 on Sat 11 Dec 2004 01:29 AM (UTC)
Message
The reason that it was working before and not now was this part
victim = who_fighting(ch)
This was reseting victim to the proper setting. You can put something like that back in.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #17 on Sat 11 Dec 2004 02:00 AM (UTC)

Amended on Sat 11 Dec 2004 02:01 AM (UTC) by David Haley

Message
The error I pointed out is one of syntax, not semantics:

void do_handseal( CHAR_DATA *ch, char *argument)
{
     char arg1[MAX_INPUT_LENGTH];
     // char arg2[MAX_INPUT_LENGTH];

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

     CHAR_DATA *victim;
     victim = ch;

     // Where is the opening if statement here?
     else if ( arg1[0] == '\0' )
     {
          send_to_char("&YWhat would u like to perform?\n\r", ch);
          return;
     }
     ...
It shouldn't have even compiled to begin with.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #18 on Sat 11 Dec 2004 02:09 AM (UTC)

Amended on Sat 11 Dec 2004 02:13 AM (UTC) by Greven

Message
Very true, I was simply refering to this
void do_handseal( CHAR_DATA *ch, char *argument)
{
char arg1[MAX_INPUT_LENGTH];
//char arg2[MAX_INPUT_LENGTH];

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

CHAR_DATA *victim;
victim = ch;

    if ( arg1[0] == '\0' )
    {
		send_to_char("&YWhat would u like to perform?\n\r", ch);
		return;
    }
    if ( !str_cmp( arg1, "mfbtobs" ) )
    {
		ch->victim_ptr = victim;
		do_chidori(ch, argument);
		return;
    }
}
All I meant was to get this to work would be to initialize(with the appropraite checks, of course) victim to who_fighting(ch) instead of ch. Though setting up ch->victim_ptr to who_fighting(ch) would be pointless here, and should just be done and checked in do_chidori anyways.


As to how the other was working... yeah, your right, it shouldn't have been. Looks like these are not full functions anyways, as the one above really does very little anyways except call do_chidori. I would assume, possibly erroneously, that there is more that is not posted.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #19 on Sat 11 Dec 2004 09:41 AM (UTC)
Message
Yea, it misses a small part. I removed it because it took up quite a few lines, but doesn't affect the call to do_chidori. All it did was remove some affects if you had them on you
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #20 on Sat 11 Dec 2004 10:00 AM (UTC)
Message
If you're going to paste code, you should probably paste all of it so that we don't have to play guessing games with what you left out. :-) If you omit stuff, who knows if it might be doing something wrong that we should know about as we read your code?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #21 on Sat 11 Dec 2004 12:21 PM (UTC)
Message
Ok, here's the full code as it is right now. Right now, I only get the 'They aren't here' messages, because the victim is NULL.

void do_chidori( CHAR_DATA *ch, char *argument/*, CHAR_DATA *victim*/)
{
	CHAR_DATA *victim = ch->victim_ptr;
//	CHAR_DATA *victim;
	switch (ch->substate)
	{
	default:
		if (ch->level <= 50)
		{
		send_to_char("You cannot perform Chidori\n\r", ch);
		return;
		}
		if ( (victim = get_char_world( ch, argument ) ) == NULL )
		{
			send_to_char( "They aren't here.\n\r", ch );
			return;
		}
		if ( argument[0] == '\0' && (victim = who_fighting(ch)) == NULL )
		{
        ch_printf( ch, "You can't seem to focus for Chidori.\n\r" );
        return;
		}
		else if ( argument[0] != '\0' && (victim = get_char_room(ch, argument)) == NULL )
		{
        send_to_char( "You can't seem to focus for Chidori.\n\r", ch );
        return;
		}
		if ( ch == victim)
		{
		ch_printf( ch, "Using Chidori on yourself? Are you suicidal?\n\r");
		return;
		}
		act(AT_WHITE, "You quickly do some handseals for your jitsu.&R", ch, victim, NULL, TO_CHAR);
		add_timer( ch, TIMER_DO_FUN, 1, do_chidori, 1 );
		return;
	case 1:
		act( AT_RED, "\n\rYou raise your hand out infront of yourself and focus your chakra.", ch, NULL, victim, TO_CHAR);
		act( AT_RED, "\n\r$n raises $s hands and focuses $s chakra.", ch, NULL, victim, TO_CANSEE);
		add_timer( ch, TIMER_DO_FUN, 1, do_chidori, 2 );
		return;
	case 2:
		act( AT_RED, "\n\rYour chakra flows all over your body. &YCHIDORI&r!!! victim $N", ch, NULL, victim, TO_CHAR);
        act( AT_RED, "\n\r$n's chakra flows all over $s body. &YCHIDORI&r!!!", ch, NULL, victim, TO_CANSEE);
		add_timer( ch, TIMER_DO_FUN, 1, do_chidori, 3);
		return;
	case 3:
		damage( ch, victim, 150, TYPE_LIGHTNING );
		ch->mana -= 75;
		add_timer( ch, TIMER_DO_FUN, 1, do_chidori, 4);
		return;
	case 4:
		act( AT_WHITE, "&wYou lower your hand." , ch, NULL, victim, TO_CHAR);
		act( AT_WHITE, "&w$n lowers $s hand." , ch, NULL, victim, TO_CANSEE);
		return;
	}
	return;
}

void do_handseal( CHAR_DATA *ch, char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];

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

CHAR_DATA *victim;
victim = who_fighting(ch);

//victim = ch->victim;
    if ( arg1[0] == '\0' && (xIS_SET(ch->affected_by, AFF_SHARINGAN) ) )
    {
		send_to_char("You place your palms together.\n\r&WYour eyes return to normal as you stop using Sharingan.\n\r", ch);
		act(AT_GREEN, "$n places $s palms together.\n\r$n's chakra fades as $e stops using sharingan", ch, NULL, NULL,TO_CANSEE );
		xREMOVE_BIT(ch->affected_by, AFF_SHARINGAN);
		ch->mod_str = 0;
		ch->mod_dex = 0;
		ch->mod_lck = 0;
		ch->mod_wis = 0;
		ch->mod_int = 0;
		ch->mod_con = 0;
		return;
    }
    else if ( arg1[0] == '\0' )
    {
		send_to_char("&YWhat would u like to perform?\n\r", ch);
		return;
    }
	if ( !str_cmp( arg1, "mfotb" ) )
    {
		do_sharingan(ch, argument);
		return;
    }

	else if ( !str_cmp( arg1, "mfbtobs" ) )
    {
		ch->victim_ptr = victim;
		do_chidori(ch, argument);
		return;
    }
}
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #22 on Sat 11 Dec 2004 12:48 PM (UTC)
Message
That's because argument is null... this is a timer function, remember . . . you don't always have data in the char*argument to the function! you have to retrieve victim from those temporary pointers you created, or, from the who_fighting call.

Besides... your argument handling in do_handseal is wrong. Look at what you do with arg2 and argument, and think about what the value of 'argument' is as you pass it in to the do_chidori function...

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #23 on Sat 11 Dec 2004 01:12 PM (UTC)
Message
I changed those things, and it is working fine now :)
Thanks alot =)
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


61,942 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.