AFKMud 1.64 ASCII Automapper Snippet
By Zarius (jeff@mindcloud.com)

Original code taken from Dystopia codebase

License: Keep header on file and I ask that if you like the snippet, let me know.  

Disclaimer: Bug free code is a myth, so I'm not surprised if there are many in here.  If you
find any, please email and I'd be happy to fix the code and credit the finder.  Also I'm
sure it can be made more efficient, so don't email and ask me why I used such and such, when I
should have used such and such.  Feel free to post your comments on http://www.mindcloud.com.

Description:  This adds an optional ascii automapper that hangs out left of the room desc
showing the surrounding sectors and whatnot.  Looks like this.  It will not show when you are
on an overland map, however (why should it?)

Difficulty: Easy (I assume you know how to add flags and whatnot though)

+-----------+ [Exits: South Southeast Southwest]
|           | Greetings Immortal, Welcome to this training area. 
|           | Please take the time here to learn the commands, so a higher 
|           | level Imm doesn't feel the need to 'educate' you. Wizhelp is 
|           | still your best friend, in particular, because it will display 
|     X     | what level a command is at, so you can go to the right section. 
|    /|\    | To rush ahead to a section, merely say aloud the Level of 
|   O O O   | command you are after. 
|  /|\      | 
| O O O     | 
+-----------+ 

Installation:  Installation is fairly easy, however I've left most of the sector types out of the
mapper.c file.  If you want to add the others, you'll have to add them yourself.  Pretty sure I 
added all the steps.

Step 1.  Backup your code
Step 1a. See Step 1
Step 2.  Copy mapper.c and mapper.h to your src directory and add make appropriate changes to makefile
Step 3.  In mud.h

Find: PLR_Unused

Change to: PLR_AUTOMAP

Step 4.  Find plr_flags in build.c and replace "UNUSED" to automap
Step 5.  At top of act info add 

#define "mapper.h"

Step 6.  in act_info.c find do_config and make appropriate entries (I trust you can do this on your own)
Step 7.  Find do_look function, above the function add this function

char * roomdesc( CHAR_DATA *ch )
{
	static char outbuf[MSL];
	/* Build a room desc moved here -- Zarius */
	outbuf[0] = '\0';

	if(!IS_PLR_FLAG( ch, PLR_BRIEF ))
	{
		mudstrlcat( outbuf, color_str(AT_RMDESC, ch ), MSL); /* Set the color */
		if( MXP_ON( ch ) )
			mudstrlcat( outbuf, MXP_TAG_ROOMDESC, MSL );

		/* Day */
		if( time_info.hour >= sysdata.hoursunrise && time_info.hour <= sysdata.hoursunset )
		{
			if( ch->in_room->roomdesc && ch->in_room->roomdesc[0] != '\0' )
				mudstrlcat( outbuf, ch->in_room->roomdesc, MSL );
		}
		else /* Night */
		{
			if( ch->in_room->nitedesc && ch->in_room->nitedesc[0] != '\0' )
				mudstrlcat( outbuf, ch->in_room->nitedesc, MSL );
			else
			{
				if( ch->in_room->roomdesc && ch->in_room->roomdesc[0] != '\0' )
					mudstrlcat( outbuf, ch->in_room->roomdesc, MSL );
			}
		}
		if( MXP_ON( ch ) )
		mudstrlcat( outbuf, MXP_TAG_ROOMDESC_CLOSE, MSL );
	}
	return outbuf;
}

Step 8.  

Find: 

      if( IS_PLR_FLAG( ch, PLR_AUTOEXIT ) )
	    do_exits( ch, "auto" );
	    
Change to:

		/* Added AUTOMAP check because it shows them next to the map now if its active */
		if( IS_PLR_FLAG( ch, PLR_AUTOEXIT ) && !IS_PLR_FLAG( ch, PLR_AUTOMAP ) ) 
		do_exits( ch, "auto" );
		
Step 9:

Find: 

	set_char_color( AT_RMDESC, ch );

	/* view desc or nitedesc --  Dracones */
	if( !IS_PLR_FLAG( ch, PLR_BRIEF ) )
	{
         if( MXP_ON( ch ) )
            send_to_char( MXP_TAG_ROOMDESC, ch );

	   if( time_info.hour >= sysdata.hoursunrise && time_info.hour <= sysdata.hoursunset )
  	      send_to_char( ch->in_room->roomdesc, ch );
         else
         {
	      if( ch->in_room->nitedesc && ch->in_room->nitedesc[0] != '\0' )
  	         send_to_char( ch->in_room->nitedesc, ch );
	      else
  	         send_to_char( ch->in_room->roomdesc, ch );
	   }
         if( MXP_ON( ch ) )
            send_to_char( MXP_TAG_ROOMDESC_CLOSE, ch );
	}
	
Change to:

		if( IS_PLR_FLAG( ch, PLR_AUTOMAP ))
			draw_map( ch, roomdesc( ch ) );
		else
			send_to_char( roomdesc( ch ), ch );
		
		
Optional step

I created a command to show the map in case users didn't want to see it all the time

CMDF do_showmap( CHAR_DATA *ch, char *argument )
{
	draw_map(ch, roomdesc( ch ));
	return;
}

Thats it, Compile clean and make

If you have trouble, post to the zarius snippet forum on http://www.mindcloud.com
