[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  issues with junking a familiar on logout (first post now irrelevent like whoa)

issues with junking a familiar on logout (first post now irrelevent like whoa)

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


Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Mon 02 Jul 2007 12:43 PM (UTC)

Amended on Mon 02 Jul 2007 12:53 PM (UTC) by Gogoicarus

Message
pardon me, i'm going to use lines of dashes to break this into more bite-sized chunks for anyone reading. i'm a little here-and-there with my thinking at the moment. i just got off work where i spend all day speaking a non native language and my head is still not quite back on straight.

our command list has stopped loading. recently, we added two new PLR flags (PLR_RP and PLR_SUNFISH). after implimenting the code which would activate PLR_RP similarly to PLR_AFK as a do_roleplay, this error started up. this is what i get in the logs:

Mon Jul 2 06:04:24 2007 :: Loading commands
Mon Jul 2 06:04:24 2007 :: [*****] BUG: Fread_command: no match: #COMMAND

after tracking this down to tables.c's void fread_command( FILE *fp ), i figured it had to do with the PLR_RP / PLR_SUNFISH codes. the odd thing is, the only codes which are 'forgotten' by this bug are do_run and do_revert...all others survived just fine.

-------------------------------------

in any case, here's the code from 'do_roleplay' that might be causing the issue.

/* the RP flag */
void do_roleplay( CHAR_DATA *ch, char *argument )
{
if ( IS_NPC(ch) )
return;

if xIS_SET(ch->act, PLR_RP)
{
xREMOVE_BIT(ch->act, PLR_RP);
send_to_char( "You are no longer flagged Roleplaying.\n\r", ch );
act(AT_GREY,"$n stopped Roleplaying.", ch, NULL, NULL, TO_CANSEE);
}
else
{
xSET_BIT(ch->act, PLR_RP);
send_to_char( "You are now flagged as Roleplaying.\n\r", ch );
act(AT_GREY,"$n has started Roleplaying.", ch, NULL, NULL, TO_CANSEE);
return;
}

}

------------------------------------------

here's the snippet from mud.h with the player flags too, just in case i'm missing something crucial. i looked around to see if there's a max allowed player flag but i couldn't find any hint of such a max. then again...this is smaug, with such classic comments as /* delete this later */, so who knows. it could exist hidden away somewhere.

/*
* ACT bits for players.
*/
typedef enum
{
PLR_IS_NPC,PLR_BOUGHT_PET, PLR_SHOVEDRAG, PLR_AUTOEXIT, PLR_AUTOLOOT,
PLR_AUTOSAC, PLR_BLANK, PLR_OUTCAST, PLR_BRIEF, PLR_COMBINE, PLR_PROMPT,
PLR_TELNET_GA, PLR_HOLYLIGHT, PLR_WIZINVIS, PLR_ROOMVNUM, PLR_SILENCE,
PLR_NO_EMOTE, PLR_ATTACKER, PLR_NO_TELL, PLR_LOG, PLR_DENY, PLR_FREEZE,
PLR_THIEF, PLR_KILLER, PLR_LITTERBUG, PLR_ANSI, PLR_RIP, PLR_NICE, PLR_FLEE,
PLR_AUTOGOLD, PLR_AUTOMAP, PLR_AFK, PLR_INVISPROMPT, PLR_RP, PLR_SUNFISH
} player_flags;


any help at all would be welcomed with abject grovelling. i'm exhausted and our main coder has completely crashed from exhaustion these past few days.


-----------------------------------
here are the commands.dat entries for all three, in case it's something simplex i'm just stupidly overlooking. they *are* in alphabetical order in commands.dat.

#COMMAND
Name run~
Code do_run
Position 112
Level 0
Log 0
End

#COMMAND
Name roleplay~
Code do_roleplay
Position 100
Level 4
Log 0

#COMMAND
Name revert~
Code do_revert
Position 104
Level 0
Log 0
End

all of these do_whatevers are declared in tables.c and mud.h in the proper places.
-----------------------------

here's where some more data is located for sunfish and roleplay, just so you can see what we were doing, in case this is somehow related to the problem.

in act_info.c's do_who....

invis_str[0] = '\0';
/* sprintf( buf, "%*s%-15s %s%s%s%s%s%s%s%s.%s%s%s\n\r", */
sprintf( buf, "%*s%-12s %-12s %s%s%s%s%s%s%s%s%s%s.%s%s%s\n\r",
(fGroup ? whogr->indent : 0), "",
rank,
class,
invis_str,
(wch->desc && wch->desc->connected) ? "[WRITING] " : "",
xIS_SET(wch->act, PLR_AFK) ? "[AFK] " : "",
xIS_SET(wch->act, PLR_ATTACKER) ? "(ATTACKER) " : "",
xIS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "",
xIS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "",
xIS_SET(wch->act, PLR_RP) ? "[RP] " : "",
(xIS_SET(wch->act, PLR_SUNFISH) && ch != wch) ? "(SUNFISH) " : "",
char_name,
wch->pcdata->title,
extra_title,
clan_name,
council_name );


and that's it. nothing fancy or amazing or ground breaking, so why is it breaking smaug?


Star wars 'is a good movie.'
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #1 on Mon 02 Jul 2007 01:10 PM (UTC)
Message
Quote:
#COMMAND
Name run~
Code do_run
Position 112
Level 0
Log 0
End

#COMMAND
Name roleplay~
Code do_roleplay
Position 100
Level 4
Log 0

#COMMAND
Name revert~
Code do_revert
Position 104
Level 0
Log 0
End


The roleplay command is missing the "End" string at the end of the command. See how the other two have it?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Reply #2 on Mon 02 Jul 2007 01:20 PM (UTC)

Amended on Mon 02 Jul 2007 01:22 PM (UTC) by Gogoicarus

Message
right, i just caught that and was coming to edit the post. this is what happens when you're wiped out by marauding 4th graders and little sleep, lemme tell you.

thanks a ton. perhaps you can help with another problem i have, if you've got time.

we recently installed the summon familiar snippet by gothar. all's well, except if a player with a familiar logs out, the whole modified mob thing doesn't go well with their player file and sort of throws up and crashes everything.

we attempted to add a code which would junk the familiar, but it sort of succeeded in junking us whenever ANYONE would log out.

------------------
in act_comm.c's do_quit, right below blodkai's dismount check...


/* Kill off familiars */
if ( strncmp ( ch->pcdata->pet->name, "familiar", strlen("familiar") ) )
extract_char( ch->pcdata->pet, TRUE );
ch->pcdata->pet = NULL;
act( AT_SAY, "Your familiar vanishes in a whisp of smoke.", ch, NULL, NULL, TO_CHAR );
act( AT_BYE, "$n's familiar vanishes in a whisp of smoke.", ch, NULL, NULL, TO_CANSEE );
}


obviously something is going screwy in that ifcheck, because the core dump turned me with this:


Loaded symbols for /lib/libnss_files.so.2
#0 0x0805e9a8 in do_quit (ch=0x88ee8b8, argument=0xbffff6a4 "")
at act_comm.c:1986
1986 if ( strncmp ( ch->pcdata->pet->name, "familiar", strlen("familiar") ) )

i'll include familiar.c's contents in a followup...

i'd originally thought to include the mob index and somehow use the familiar vnum in the check but the main coder was braindead frazzled (7am on no sleep for him) and i'm a beginner at all this and at best could only come up with several brand new ways to mushroom cloud our 'minime' test MUD.

Star wars 'is a good movie.'
[Go to top] top

Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Reply #3 on Mon 02 Jul 2007 01:20 PM (UTC)
Message
here's the familiar.c, if it assists in any way.

#include "mud.h"

/* from magic.c */
void failed_casting( struct skill_type *skill, CHAR_DATA *ch,
CHAR_DATA *victim, OBJ_DATA *obj );

ch_ret spell_familiar( int sn, int level, CHAR_DATA *ch, void *vo )
{
MOB_INDEX_DATA *pMobIndex;
CHAR_DATA *mount;
SKILLTYPE *skill = get_skilltype(sn);

if ( ch->pcdata->pet != NULL )
{
send_to_char("You already have a companion.\n\r",ch);
failed_casting( skill, ch, NULL, NULL );
return rSPELL_FAILED;
}
if(ch->position == POS_FIGHTING)
{
send_to_char("You can't study the ritual while in combat!\n\r",ch);
failed_casting( skill, ch, NULL, NULL );
return rSPELL_FAILED;
}

if ( ( pMobIndex = get_mob_index(MOB_VNUM_FAMILIAR) ) == NULL )
{
send_to_char( "The familiar mob doesn't exist.\n\r", ch );
return rSPELL_FAILED;
}
/* can't cast the spell in these sectors */
if(ch->in_room->sector_type == SECT_INSIDE
|| ch->in_room->sector_type == SECT_WATER_SWIM
|| ch->in_room->sector_type == SECT_WATER_NOSWIM
|| ch->in_room->sector_type == SECT_AIR )
{
send_to_char("There is not enough magical energy here.\n\r",ch);
failed_casting( skill, ch, NULL, NULL );
return rSPELL_FAILED;
}

mount = create_mobile( pMobIndex );

mount->level = 1; /* no powerlevel mobs for you! */
mount->mana = mount->max_mana = 0;
mount->hit = mount->max_hit = number_fuzzy((ch->max_hit / 2)+ch->mod_cha);
mount->armor = number_fuzzy(ch->armor - 10);
mount->hitroll = number_fuzzy(ch->level / 30);
mount->damroll = number_fuzzy(ch->level / 30);

/* free up the old mob names */
STRFREE(mount->description);
STRFREE(mount->name);
STRFREE(mount->short_descr);
STRFREE(mount->long_descr);

/* terrain */
switch(ch->in_room->sector_type)
{
case(SECT_CITY): /* pigeon */
case(SECT_FIELD):
mount->description =
str_dup("You see a blankly staring pigeon. It coos at you a bit.\n\r"
"You can feel the dirt and disease crawling off this beast.\n\r");
mount->short_descr = str_dup("a big pigeon");
mount->long_descr = str_dup("A clueless looking pigeon is here.\n\r");
mount->name = str_dup("familiar pigeon");
xSET_BIT(mount->attacks,DAM_CLAW);
break;
case(SECT_FOREST): /* howler */
case(SECT_HILLS):
mount->description =
str_dup("You see a bristled Howler, its fur standing straight up on \n\r"
"its shoulders as it stares intensely about with its elongated\n\r"
"snout and vaguely simian face.\n\r");
mount->short_descr = str_dup("a bristled howler");
mount->long_descr = str_dup("A bristled howler sniffs about.\n\r");
mount->name = str_dup("familiar howler");
xSET_BIT(mount->attacks,DAM_BITE);
break;
case(SECT_MOUNTAIN): /* wrix */
mount->description =
str_dup(" You see a graceful Wrix pacing in small circles, snarling.\n\r"
"Its cloven hooves clack against the stones and its cold eyes\n\r"
"seem to pierce your soul.\n\r");
mount->short_descr = str_dup("a wrix");
mount->long_descr = str_dup("A wrix snarls as it paces back and forth.\n\r");
mount->name = str_dup("familiar wrix");
xSET_BIT(mount->attacks,DAM_BITE);
break;
case(SECT_DESERT): /* sandworm */
mount->description =
str_dup("You see a large white sandworm wiggling in the light.\n\r"
"A red spot on one end makes you guess it is a mouth.\n\r"
"A loud moan comes from the direction of that red spot.\n\r");
mount->short_descr = str_dup("a sandworm");
mount->long_descr = str_dup("A white sandworm peers from the ground.\n\r");
mount->name = str_dup("familiar sandworm");
xSET_BIT(mount->attacks,DAM_SUCTION);
default:
send_to_char("You can't do that!", ch);
break;

}
/* player seen stuff here */
do_sit(ch,"");
char_to_room( mount, ch->in_room );
act( AT_MAGIC,"You begin to chant and call to $N!.",ch,NULL,mount,TO_CHAR);
act( AT_MAGIC,"$n begins to chant and calls to $N!", ch, NULL, mount, TO_ROOM );
WAIT_STATE(ch, 2 * PULSE_MOBILE);
add_follower( mount, ch );
mount->leader = ch;
ch->pcdata->pet = mount;
do_stand(ch,"");

xSET_BIT(mount->act, ACT_PET);
xSET_BIT(mount->affected_by, AFF_CHARM);
ch->move -= (mount->level / 2); /* physically draining lose of move */
return rNONE;
}

Star wars 'is a good movie.'
[Go to top] top

Posted by Zeno   USA  (2,871 posts)  [Biography] bio
Date Reply #4 on Mon 02 Jul 2007 01:47 PM (UTC)

Amended on Mon 02 Jul 2007 03:09 PM (UTC) by Zeno

Message
Indeed, you're better off using the vnum to check it rather than the name (note that your ifcheck for the name is wrong, take a look at how !strcmp is used elsewhere for the correct syntax).

For the vnum, the code is something like this:
if ( ch->pcdata && ch->pcdata->pet && ch->pcdata->pet->pIndexData->vnum == MOB_VNUM_HERE )


[EDIT] Although... pets should save. What is the backtrace of the crash when you quit (without purging the pet)?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Gogoicarus   Japan  (15 posts)  [Biography] bio
Date Reply #5 on Tue 03 Jul 2007 09:35 PM (UTC)
Message
we're not exactly certain. we know that it's the fault of the familiar code, because the crashes happen (seemingly at random) when people who are using familiars log in or out.

this is the purge we're using now:
/* Kill off familiars */
if ( ch->pcdata->pet &&(ch->pcdata->pet->pIndexData->vnum == MOB_VNUM_FAMILIAR ){
extract_char( ch->pcdata->pet, TRUE );
ch->pcdata->pet = NULL;
act( AT_SAY, "Your familiar vanishes in a whisp of smoke.", ch, NULL, NULL, TO_CHAR );
act( AT_BYE, "$n's familiar vanishes in a whisp of smoke.", ch, NULL, NULL, TO_CANSEE );
}

it appears to be working all fine and dandy now though. thankth for the assistance 8D

Star wars 'is a good movie.'
[Go to top] 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.


12,993 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]