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
➜ Displaying Closed Exits (useful code?) -fixed a typo
Displaying Closed Exits (useful code?) -fixed a typo
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gatewaysysop2
USA (146 posts) Bio
|
Date
| Sat 05 Jul 2003 06:08 PM (UTC) Amended on Sat 26 Jul 2003 07:24 PM (UTC) by Gatewaysysop2
|
Message
| Hey all,
I spent a while last night going through the SML archives looking for a way to get closed exits to display on autoexits as [direction] as well as having them show up under the 'exits' comand output as "Direction - Closed". This is opposed to stock SMAUG where they are not shown in either case unless opened.
Below is what I came up with, 90% of which is drawn off something Xerves (I believe) posted on the SML as a response to someone elses query a long time back. I tweaked this using examples I found in a few places and I finally got it working right. I've tested this with exits that lead to dark rooms, hidden exits, etc. and it appears to work just fine.
I had the initial problem that closed doors leading to rooms flagged 'dark' would display as "Too dark to tell" rather than saying it was "Closed" in that direction. It is my thinking that you shouldn't be able to tell that it's too dark on the other side of a closed door, so I changed that. This way, no matter what's on the other side, if the door is closed it simply says "Closed - Direction".
Again, I take no credit here since this is really just a compilation of the work of others into a configuration that I found the most desirable.
In act_info.c , replace the stock do_exits with:
void do_exits( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
EXIT_DATA *pexit;
bool found;
bool fAuto;
set_char_color( AT_EXITS, ch );
buf[0] = '\0';
fAuto = !str_cmp( argument, "auto" );
if ( !check_blind(ch) )
return;
strcpy( buf, fAuto ? "Exits:" : "Obvious exits:\n\r" );
found = FALSE;
for ( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
{
if ( pexit->to_room
&& (!IS_SET(pexit->exit_info, EX_WINDOW)
|| IS_SET(pexit->exit_info, EX_ISDOOR))
&& !IS_SET(pexit->exit_info, EX_HIDDEN) )
{
found = TRUE;
if ( fAuto )
{
strcat( buf, " " );
if (IS_SET(pexit->exit_info, EX_CLOSED))
strcat(buf, "[");
strcat( buf, dir_name[pexit->vdir] );
if (IS_SET(pexit->exit_info, EX_CLOSED))
strcat(buf, "]");
}
else
{
sprintf( buf + strlen(buf), "%-5s - %s\n\r",
capitalize( dir_name[pexit->vdir] ),
room_is_dark( pexit->to_room )
&& !IS_SET(pexit->exit_info, EX_CLOSED)
? "Too dark to tell"
: IS_SET(pexit->exit_info, EX_CLOSED)
? "Closed" : pexit->to_room->name);
}
}
}
if ( !found )
strcat( buf, fAuto ? " none.\n\r" : "None.\n\r" );
else
if ( fAuto )
strcat( buf, ".\n\r" );
send_to_char( buf, ch );
return;
}
|
"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence | Top |
|
Posted by
| Rhayne
(14 posts) Bio
|
Date
| Reply #1 on Mon 03 Sep 2012 05:06 AM (UTC) |
Message
| When copy/pasting the code I was getting a compile error:
Compiling o/act_info.o....
o/act_info.o: In function `do_look':
/host/JD/smaugfuss19/src/act_info.c:1285: undefined reference to `do_exits'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make: *** [all] Error 2
Changed char *argument to const char *argument and it compiled and is working beautifully. Very helpful code, thanks. | 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.
13,326 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top