/*Ok, this is my first bit of code, so bear with me if things get a little confusing.
  This code will add a bit to your MUD so that the players who are AFK can set
   an away message. It isn't that difficult to do, but is rather useful. The only
   problem may be in the conversion, as I am running 1stMUD, which has a 
   modified system. I don't need any credit if you use this (as it is so minor),
   but would appreciate an e-mail to let me know that someone is benefiting
   from my work. The address is ozeron@wrath.kyndig.com
*/


		// MERC.H \\
--> Find your "struct pc_data". Somewhere in there add the following line

	const char *afk;


		// RECYCLE.C\\
--> Ok, now find your "void pc_data". Add in:

	free_string(pcdata->afk);


		// SAVE.C \\
--> Locate "void fwrite_char". I put these lines right after the experience bit:

	   if (ch->pcdata->afk[0] != '\0')
            fprintf( fp, "AFK %s~\n",     ch->pcdata->afk);

--> A little further down, you should have the "bool load_char_obj".  Put this there:

	ch->pcdata->afk = str_dup ("");

--> And if you go even farther, you can add this to the bit about "case 'A'":

	KEY(" KEY("AFK", ch->pcdata->afk, fread_string(fp));


/* That Will add the data to store the away message in the pfile. Now, we need to add the function itself. */


		// ACT_COMM.C \\
--> Wherever your AFK command data is stored, edit it to make it look something like this:

	CH_CMD(do_afk)
	{
  	  char buf[MSL];

                 smash_tilde (argument);

	 if (argument[0] != '\0')  /* In the event that there is something after the "afk" command */
  	 {
  		 strcpy(buf, argument);
  		 free_string(ch->pcdata->afk);  /* Take out anything already stored */
 		 ch->pcdata->afk = str_dup(buf);
  		 chprintln(ch, "Away message set to:");  /* Show em what they set */
  		 chprintln(ch, buf);
 		 return;
  	 }
  	if (IS_SET(ch->comm, COMM_AFK)) 
        	{
                chprintln(ch, "AFK mode removed. Type 'replay' to see tells.");
                REMOVE_BIT(ch->comm, COMM_AFK);
                return;
        	}
  	else
        	{
                chprintln(ch, "You are now in AFK mode.");
                SET_BIT(ch->comm, COMM_AFK);
                return;
        	}

}

--> Now go to where your "tell" information is kept, and locate the bit about if they are AFK. Add this beneath
    the line that says "$E is AFK, but your tell will go through when $E returns.":

	act("AFK Message: $t ", ch, victim->pcdata->afk, NULL, TO_CHAR);

--> Of course, you need to add the same thing in the same place for the "reply" function too.


		// ACT_INFO.C \\
/* This bit is a little extra that I put in to allow characters to check what their away message was. */
--> Just add an "away" command that looks like this:

	CH_CMD(do_away)
	{
 		act("{WYour current away message is:{x $t", ch, ch->pcdata->afk, NULL, TO_CHAR);
	}	



/* That's all there is to it. All that's left is to add the appropriate lines in the code to make the "away" command,
    make clean, make, and copyover. Your characters can now set away messages for thier AFK status.
*/