Error during compile... :/

Posted by USER007 on Thu 27 Nov 2003 12:41 AM — 5 posts, 20,512 views.

#0
I got this snippet for my mud and its the the altanos compass display thing and heres what it told me to do:

Installation Instructions
-------------------------

1. Open act_info.c and locate function do_look

Find the following near the beginning:

char arg [MAX_INPUT_LENGTH];
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
char arg3 [MAX_INPUT_LENGTH];

Add the following directly beneath that:

char dir_n[50];
char dir_e[50];
char dir_s[50];
char dir_w[50];
char dir_u[50];
char dir_d[50];
char dir_ne[50];
char dir_nw[50];
char dir_se[50];
char dir_sw[50];
char dir_sm[50];
char *exitcolor;

Then locate the following code:

if ( !ch->desc )
return;

Directly ABOVE that, add the following:

strcpy( dir_n, "&z-" );
strcpy( dir_e, "&z-" );
strcpy( dir_s, "&z-" );
strcpy( dir_w, "&z-" );
strcpy( dir_u, "&z-" );
strcpy( dir_d, "&z-" );
strcpy( dir_ne, "&z -" );
strcpy( dir_nw, "&z- " );
strcpy( dir_se, "&z -" );
strcpy( dir_sw, "&z- " );
strcpy( dir_sm, "&z-" );

Then locate the following code:

/* 'look' or 'look auto' */
set_char_color( AT_RMNAME, ch );
send_to_char( ch->in_room->name, ch );
send_to_char( "\n\r", ch );

Replace that block with the following:

/* 'look' or 'look auto' */
for( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
{
if( ( pexit->to_room
&& !IS_SET (pexit->exit_info, EX_HIDDEN)
&& !IS_SET (pexit->exit_info, EX_SECRET))
|| (IS_SET (pexit->exit_info, EX_SECRET)
&& !IS_SET (pexit->exit_info, EX_CLOSED)))
{
exitcolor = "&Y";
if( IS_SET( pexit->exit_info, EX_WINDOW ) )
exitcolor = "&C";
if( IS_SET( pexit->exit_info, EX_SECRET ) )
exitcolor = "&b";
if( IS_SET( pexit->exit_info, EX_CLOSED ) )
exitcolor = "&z";
if( IS_SET( pexit->exit_info, EX_LOCKED ) )
exitcolor = "&R";

if( pexit->vdir == DIR_NORTH )
sprintf( dir_n, "%sN", exitcolor );

if( pexit->vdir == DIR_EAST )
sprintf( dir_e, "%sE", exitcolor );

if( pexit->vdir == DIR_SOUTH )
sprintf( dir_s, "%sS", exitcolor );

if( pexit->vdir == DIR_WEST )
sprintf( dir_w, "%sW", exitcolor );

if( pexit->vdir == DIR_UP )
sprintf( dir_u, "%sU", exitcolor );

if( pexit->vdir == DIR_DOWN )
sprintf( dir_d, "%sD", exitcolor );

if( pexit->vdir == DIR_NORTHEAST )
sprintf( dir_ne, "%sNE", exitcolor );

if( pexit->vdir == DIR_NORTHWEST )
sprintf( dir_nw, "%sNW", exitcolor );

if( pexit->vdir == DIR_SOUTHEAST )
sprintf( dir_se, "%sSE", exitcolor );

if( pexit->vdir == DIR_SOUTHWEST )
sprintf( dir_sw, "%sSW", exitcolor );
}
}

if( xIS_SET( ch->act, PLR_COMPASS ) )
{
send_to_char( "\n\r", ch );

set_char_color( AT_RMNAME, ch );
ch_printf( ch, "%-50s", ch->in_room->name );

strcat( dir_nw, " " );
ch_printf_color( ch, " %s", dir_nw );
strcat( dir_n, " " );
ch_printf_color( ch, " %s", dir_n );
ch_printf_color( ch, " %s\n\r", dir_ne );
send_to_char( "&z-<----------------------------------------------->- ", ch );
strcat( dir_w, "" );
ch_printf_color( ch, " %s", dir_w );
send_to_char( "&z<-", ch );
strcat( dir_u, "&z-(&Y&W*&z)" );
ch_printf_color( ch, "%s", dir_u );
strcat( dir_d, "&z-" );
send_to_char( "&z-", ch );
ch_printf_color( ch, "%s", dir_d );
send_to_char( "&z>", ch );
ch_printf_color( ch, "%s\n\r", dir_e );
send_to_char( " ", ch );
strcat( dir_sw, " " );
ch_printf_color( ch, " %s", dir_sw );
strcat( dir_s, " " );
ch_printf_color( ch, " %s", dir_s );
ch_printf_color( ch, " %s", dir_se );
send_to_char( "\n\r\n\r", ch );
}
else
{
set_char_color( AT_RMNAME, ch );
send_to_char( ch->in_room->name, ch );
send_to_char( "\n\r", ch );
}

Then locate function do_config and find the following:

ch_printf( ch, "%-12s %-12s %-12s %-12s\n\r %-12s %-12s %-12s %-12s",
IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? "[+] PAGER"
: "[-] pager",
IS_SET( ch->pcdata->flags, PCFLAG_GAG ) ? "[+] GAG"
: "[-] gag",
xIS_SET(ch->act, PLR_BRIEF ) ? "[+] BRIEF"
: "[-] brief",
xIS_SET(ch->act, PLR_COMBINE ) ? "[+] COMBINE"
: "[-] combine",
xIS_SET(ch->act, PLR_BLANK ) ? "[+] BLANK"
: "[-] blank",
xIS_SET(ch->act, PLR_PROMPT ) ? "[+] PROMPT"
: "[-] prompt",
xIS_SET(ch->act, PLR_ANSI ) ? "[+] ANSI"
: "[-] ansi",
xIS_SET(ch->act, PLR_RIP ) ? "[+] RIP"
: "[-] rip" );
#1
Part 2

Change it to read as follows:

ch_printf( ch, "%-12s %-12s %-12s %-12s\n\r %-12s %-12s %-12s %-12s\n\r %-12s",
IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? "[+] PAGER"
: "[-] pager",
IS_SET( ch->pcdata->flags, PCFLAG_GAG ) ? "[+] GAG"
: "[-] gag",
xIS_SET(ch->act, PLR_BRIEF ) ? "[+] BRIEF"
: "[-] brief",
xIS_SET(ch->act, PLR_COMBINE ) ? "[+] COMBINE"
: "[-] combine",
xIS_SET(ch->act, PLR_BLANK ) ? "[+] BLANK"
: "[-] blank",
xIS_SET(ch->act, PLR_PROMPT ) ? "[+] PROMPT"
: "[-] prompt",
xIS_SET(ch->act, PLR_ANSI ) ? "[+] ANSI"
: "[-] ansi",
xIS_SET(ch->act, PLR_RIP ) ? "[+] RIP"
: "[-] rip",
xIS_SET(ch->act, PLR_COMPASS ) ? "[+] COMPASS"
: "[-] compass" );

Then locate the following code:

else if ( !str_prefix( arg+1, "ansi" ) ) bit = PLR_ANSI;
else if ( !str_prefix( arg+1, "rip" ) ) bit = PLR_RIP;

Directly below that, add the following line:

else if ( !str_prefix( arg+1, "compass" ) ) bit = PLR_COMPASS;

2. Open mud.h and locate the player_flags

Add PLR_COMPASS to the list.

3. Open build.c and locate the plr_flags array

Add "compass" to the list in the same position that corresponds to where you added
PLR_COMPASS in mud.h

4. Make clean, recompile.


I did what it said and heres what the errors I got:
Owner@Starblazer ~/smaug_nick/src
$ make
make smaug
make[1]: Entering directory `/home/Owner/smaug_nick/src'
gcc -c -O -g3 -Wall -Wuninitialized -DSMAUG act_info.c
act_info.c: In function `show_list_to_char':
act_info.c:253: error: `dir_n' undeclared (first use in this function)
act_info.c:253: error: (Each undeclared identifier is reported only once
act_info.c:253: error: for each function it appears in.)
act_info.c:254: error: `dir_e' undeclared (first use in this function)
act_info.c:255: error: `dir_s' undeclared (first use in this function)
act_info.c:256: error: `dir_w' undeclared (first use in this function)
act_info.c:257: error: `dir_u' undeclared (first use in this function)
act_info.c:258: error: `dir_d' undeclared (first use in this function)
act_info.c:259: error: `dir_ne' undeclared (first use in this function)
act_info.c:260: error: `dir_nw' undeclared (first use in this function)
act_info.c:261: error: `dir_se' undeclared (first use in this function)
act_info.c:262: error: `dir_sw' undeclared (first use in this function)
act_info.c:263: error: `dir_sm' undeclared (first use in this function)
act_info.c: In function `do_look':
act_info.c:957: warning: unused variable `dir_sm'
act_info.c: In function `do_config':
act_info.c:4029: error: syntax error before ')' token
make[1]: *** [act_info.o] Error 1
make[1]: Leaving directory `/home/Owner/smaug_nick/src'
make: *** [all] Error 2


Any one know how to fix it? And sorry for the long post. :p
Amended on Thu 27 Nov 2003 12:43 AM by USER007
USA #2
It would help if you added the stuff to the right place, i.e. if you followed directions... it says add to do_look, not to show_list_to_char . . . you should learn to read the compiler error messages, and compare with the instructions you're given. Not trying to be mean, just trying to teach you to help yourself, especially for such absolutely trivial problems.
#3
Ok I'll do what you told me to do with the do_look and if it doesn't work I'll post again. :p
USA #4
No no no, don't do what I say to do, do what the *snippet* says to do. :) When they give you precise instructions like that follow them to the letter. Of course, the better solution is to understand what the instructions are telling you so that you can debug in case things go wrong... but, well, that's for later. :)