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.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Pretitle snippet

Pretitle snippet

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


Pages: 1 2  3  

Posted by USER007   (124 posts)  Bio
Date Tue 15 Jun 2004 04:32 AM (UTC)
Message
I downloaded a pretitle snippet and I installed it succesfully... it compiled with one error but that was an easy fix so I compiled it again and I got no errors this time. Then I started up the mud and everything went fine, I got no bug messages. I type in my name and password, right after I type in my pass it crashes. Heres what it told me:

Tue Jun 15 00:21:38 2004 :: Sock.sinaddr: 127.0.0.1, port 4726.
Tue Jun 15 00:21:39 2004 :: [*****] BUG: Auth_check: exception found for (unknow
n)@127.0.0.1.
Tue Jun 15 00:21:40 2004 :: Preloading player data for: Anavel (9K)
Tue Jun 15 00:21:40 2004 :: Creating area entry for Anavel
Segmentation fault (core dumped)

Any clues? Heres some of the code if you need it...



1. Act_info.c

Need to drop this function into the file, it is the actual
command for setting pretitle.

/* Orginal done by Azalin for ???
Converted to Smaug by Xerves 8/2/99 */
void do_pretitle( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
int value;

if ( IS_NPC(ch) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
/* Used the notitle flag to ban abuse of the command, if you want to make
your own flags and put them in, you can -- Xerves */
if ( IS_SET( ch->pcdata->flags, PCFLAG_NOTITLE ))
{
set_char_color( AT_IMMORT, ch );
send_to_char( "The Gods prohibit you from changing your title or pretitle.\n\r", ch );
return;
}

if ( ch->pcdata->pretit == '\0' )
ch->pcdata->pretit = "&G"; /* Hard-coded Color part here, change if needed -- Xerves */

if ( argument[0] == '\0' )
{
send_to_char("Syntax: pretitle show\n\r", ch);
send_to_char("Syntax: pretitle clear\n\r", ch);
send_to_char("Syntax: pretitle <text>\n\r", ch);
return;
}

if ( !str_cmp( argument, "show" ) )
{
sprintf(buf, "Your current pretitle is '%s&g'.\n\r",ch->pcdata->pretit);
send_to_char(buf,ch);/* Above is hard-coded also -- Xerves */
return;
}

if ( !str_cmp( argument, "clear" ) )
{
ch->pcdata->pretit = "&G"; /* Hard-coded Color -- Xerves */
send_to_char("Pretitle Removed.\n\r",ch);
return;
}
/* Will only allow for 25 characters in the pretitle, color code included
If you want to have a longer pretitle (or shorter) change the number below
and change the number in the arrays to match -- Xerves */
if ( strlen(argument) > 25 )
{
argument[25] = '&'; /* Hard-coded Color again */
argument[26] = 'G';
argument[27] = '\0';
}
else
{
value = strlen(argument);
argument[value] = '&';
argument[value+1] = 'G'; /* Color again */
argument[value+2] = '\0';
}

smash_tilde( argument );
ch->pcdata->pretit = str_dup( argument );
send_to_char("Done.\n\r",ch);
return;

}

In do_who find this code.......

sprintf( buf, "%*s%-15s %s%s%s%s%s%s%s%s.%s%s%s\n\r",
(fGroup ? whogr->indent : 0), "",
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) " : "",
char_name,
wch->pcdata->title,
extra_title,
clan_name,
council_name );


You need to tact up another %s right before the . (the %s.%s%s%s) that
dot.

And then before char_name, you need to put wch->pcdata->pretit

It should look like this after you get done...

sprintf( buf, "%*s%-15s %s%s%s%s%s%s%s%s%s.%s%s%s\n\r",
(fGroup ? whogr->indent : 0), "",
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) " : "",
wch->pcdata->pretit,
char_name,
wch->pcdata->title,
extra_title,
clan_name,
council_name );
Top

Posted by USER007   (124 posts)  Bio
Date Reply #1 on Tue 15 Jun 2004 04:33 AM (UTC)
Message
Second part... sorry if its too long...

IN do_whois, you need to find this code

set_pager_color( AT_GREY, ch );
pager_printf(ch, "\n\r'%s%s.\n\r",
victim->name, victim->pcdata->title);

AND change it to look like this

set_pager_color( AT_GREY, ch );
pager_printf(ch, "\n\r'%s&c&w%s%s.\n\r",
victim->pcdata->pretit, victim->name, victim->pcdata->title);

(NOTE ON ABOVE: My mud has a fun time with the &w color, so I use
&c&w for the &w code. Again, this is hard coded, and if you want
to remove the color, remove that one also)


FINALLY, in show_char_to_char_0 Find this Code

if ( victim->morph != NULL && victim->morph->morph != NULL &&
!IS_IMMORTAL( ch ) )
strcat( buf, MORPHPERS( victim, ch ) );
else
strcat( buf, PERS( victim, ch ) );
}

if ( !IS_NPC(victim) && !xIS_SET(ch->act, PLR_BRIEF) )
strcat( buf, victim->pcdata->title );

And change it to look like this


if ( victim->morph != NULL && victim->morph->morph != NULL &&
!IS_IMMORTAL( ch ) )
strcat( buf, MORPHPERS( victim, ch ) );
else
if (!IS_NPC(victim) && victim->pcdata->pretit != NULL)
{
strcat (buf, victim->pcdata->pretit );
strcat (buf, "&P");
}
strcat( buf, PERS( victim, ch ) );
}

if ( !IS_NPC(victim) && !xIS_SET(ch->act, PLR_BRIEF) )
strcat( buf, victim->pcdata->title );

2. MUD.H
In the declare_do_fun section, you need to add pretitle to it.

In the pc_data structure, you need to add this to it
char * pretit;

(I added this after the pointer for title)

3. TABLES.C
You need to add the pretitle commands into the tables. Remember, there
are two spots which it needs to be added!

4. Save.c

IN fwrite_char, you need to add this

fprintf( fp, "Pretit %s~\n", ch->pcdata->pretit ); /* Xerves 8-2-99 */

You will most likely want to put it after the one for title

In load_char_obj you need to put it in two spots, first...

Right below
ch->pcdata->bestowments = str_dup( "" );
ch->pcdata->title = STRALLOC( "" );
Add This Line
ch->pcdata->pretit = str_dup( "" ); /* Xerves 8-2-99 */

Next, down about 20 lines or so, find this

if ( !ch->pcdata->deity_name )
{
ch->pcdata->deity_name = STRALLOC( "" );
ch->pcdata->deity = NULL;
}
if ( !ch->pcdata->bio )
ch->pcdata->bio = STRALLOC( "" );

Right below it add this...

if ( !ch->pcdata->pretit )
ch->pcdata->pretit = str_dup( "" ); /* Xerves 8-2-99 */


IN fread_char, there are once again two spots...First

Right below this line..
KEY( "Practice", ch->practice, fread_number( fp ) );
Add all of this

if ( !str_cmp( word, "Ptit" ) || !str_cmp( word, "pretit"))
{
ch->pcdata->pretit = fread_string( fp );
if (ch->pcdata->pretit[0] != '.' && ch->pcdata->pretit[0] != ','
&& ch->pcdata->pretit[0] != '!' && ch->pcdata->pretit[0] != '?')
{
sprintf( buf, "%s", ch->pcdata->pretit );
STRFREE( ch->pcdata->pretit );
ch->pcdata->pretit = str_dup( buf );
}
fMatch = TRUE;
break;
}

(NOTE: The above will check to see if there is an . , ! ? in the pretitle, if
one is found, it will not save the pretitle, remove this if you want, or
feel free to add on to it )

Lastly, down about a few pages, there should be a bunch of checks to see if
titles/bios/etc exsist, it looks like this

if (!ch->pcdata->bestowments)
ch->pcdata->bestowments = str_dup( "" );
if (!ch->pcdata->title)
ch->pcdata->title = STRALLOC( "" );

You need to add right after that

if (!ch->pcdata->pretit)
ch->pcdata->pretit = str_dup( "" );

5. (Optional, if you have finger.c (the finger command) in your code)
If you still have the finger function in finger.c, you will probably want
to add pretitle support there also, if you moved the finger code, or have
your own, you might want to find it again, and add this to it.

ch_printf(ch, "&c&wSex : &G%-20s &w Race: &G%s\n\r",
victim->sex == SEX_MALE ? "Male" :
victim->sex == SEX_FEMALE ? "Female" : "Neutral",
capitalize( npc_race[victim->race] ) );
ch_printf(ch, "&c&wTitle: &G%s\n\r", victim->pcdata->title );

This is what the code I have looks like, again the &c&w is used to for &w in
my code. Anyway, you will probably want to add the Pretitle right below that

ch_printf(ch, "&c&wPreTitle: &G%s\n\r", victim->pcdata->pretit );
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Tue 15 Jun 2004 06:53 PM (UTC)
Message
So er, what does gdb say when you debug it?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by USER007   (124 posts)  Bio
Date Reply #3 on Tue 15 Jun 2004 07:19 PM (UTC)

Amended on Tue 15 Jun 2004 07:21 PM (UTC) by USER007

Message
Hmmm... that could be a problem... I don't know how to use gdb, I'll just search for the guide thats some where in this forum. Oh and I typed this yesterday if it helps any:

$ ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited

I remember someone saying to make the core file size around 163514 or somewhere around there, so that could be the problem...
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Tue 15 Jun 2004 07:36 PM (UTC)
Message
Attach gdb to the process, then crash the MUD. See the manual of gdb. (man gdb)

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by USER007   (124 posts)  Bio
Date Reply #5 on Tue 15 Jun 2004 08:51 PM (UTC)

Amended on Tue 15 Jun 2004 08:52 PM (UTC) by USER007

Message
I can't find my core file... where is it?
$ ls -lt core*
ls: core*: No such file or directory
Top

Posted by Zhamel   USA  (67 posts)  Bio
Date Reply #6 on Tue 15 Jun 2004 08:58 PM (UTC)

Amended on Tue 15 Jun 2004 09:00 PM (UTC) by Zhamel

Message
Core dumps are usually found in the area directory.

Try something like this from the src directory:

gdb smaug ../area/core

Then type 'bt' without quotes and show us what it spits out. Then we will be able to help you more.
Top

Posted by USER007   (124 posts)  Bio
Date Reply #7 on Tue 15 Jun 2004 09:05 PM (UTC)
Message
Ok heres what I got:

Tue Jun 15 17:04:20 2004 :: Preloading player data for: Anavel (9K)

Program received signal SIGSEGV, Segmentation fault.
free_char (ch=0x10384b30) at db.c:2869
2869 next = temp->next;
(gdb) bt
#0 free_char (ch=0x10384b30) at db.c:2869
#1 0x004b4053 in nanny (d=0x1038a3d8, argument=0x22f8d0 "L#900")
at comm.c:1687
#2 0x004b1073 in game_loop () at comm.c:629
#3 0x004b0686 in main (argc=1, argv=0x10021540) at comm.c:286
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #8 on Tue 15 Jun 2004 09:14 PM (UTC)
Message
free_char eh? Did you install the pretitle fix too?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by USER007   (124 posts)  Bio
Date Reply #9 on Tue 15 Jun 2004 09:43 PM (UTC)
Message
Yes it came with it... :P was I not suppose to? :D
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #10 on Tue 15 Jun 2004 10:23 PM (UTC)
Message
Anavel, you said you made a "bug fix". Perhaps your creative bug fix actually broke it. :) Just what did you change?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #11 on Tue 15 Jun 2004 10:23 PM (UTC)
Message
No, you were. I think there are some old topics on this about free_char... Try searching, I'll look around.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by USER007   (124 posts)  Bio
Date Reply #12 on Tue 15 Jun 2004 10:33 PM (UTC)
Message
Lol, I just did what the snippet told me and it compiled without any errors... and I change quite a few things to some files... so I can't post them all here cause it will spam the thread. :p
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #13 on Tue 15 Jun 2004 10:38 PM (UTC)
Message
Quote:
downloaded a pretitle snippet and I installed it succesfully... it compiled with one error but that was an easy fix so I compiled it again and I got no errors this time. Then I started up the mud and everything went fine, I got no bug messages.


So was there an error or not??

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by USER007   (124 posts)  Bio
Date Reply #14 on Tue 15 Jun 2004 11:01 PM (UTC)

Amended on Tue 15 Jun 2004 11:23 PM (UTC) by USER007

Message
I got an error cause it had a typo and I realized what it was, so then I changed it. Then everything compiled alright.
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.


96,099 views.

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

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.