AFK Code [by Mark Komus]
Snippet Posted Wednesday, August 12th @ 11:23:39 PM, by George Greer in the Commands dept.
Added Dec 5, 1996. Click the link below to read it or download it.

From: Mark Komus <umkomusm@cc.UManitoba.CA>
Subject: AFK Code

Here's a quick addition I came up with that gives a basic AFK command.
It basically adds an (AFK) after the persons name on the who list, and
tells anyone who tells someone that is afk, that they are afk.  The line
numbers might not be exact to stock circle because I have added some
other things as well, but they should be close.

In structs.h around line 202 after #define PRF_ROOMFLAGS add:
#define PRF_AFK (1 << 22)
The 22 should be the next number up from the list.

In act.other.c around line 825 add after Autoexits enables... add:
{"AFK flag is now off.\r\n",
 "AFK flag is now on.\r\n"}

Also in that file around line 885 case SCMD_AUTOEXIT add:
case SCMD_AFK:
  result = PRF_TOG_CHK(ch, PRF_AFK);
  if (PRF_FLAGGED(ch, PRF_AFK))
    act("$n has gone AFK.", TRUE, ch, 0, 0, TO_ROOM);
  else
    act("$n has come back from AFK.", TRUE, ch, 0, 0, TO_ROOM);
  break;

In interpreter.c around line 220 after { "accuse", add:
{ "afk", POS_DEAD, do_gen_tog, 0, SCMD_AFK },

In interpreter.h around line 113 after #define SCMD_AUTOEXIT add:
#define SCMD_AFK 17  (or whatever number is next in the list)

The following will let you toggle the AFK flag on and off.  So far I've
also added a change to tells so if you tell someone in AFK they get a
message back saying so and so if AFK, and also changed the do_who command
so beside their name you see (AFK).  The following do that.

In act.comm.c around line 130 after else if (PRF_FLAGGED(vict, PRF_NOTELL
add:
else if (PRF_FLAGGED(vict, PRF_AFK))
  act("$E's afk right now, try again later.",
       FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);

That will add the extra bit to tells, to change who is:
In act.informative.c around line 1027 after strcat(buf, " (KILLER)"); add:
if (PRF_FLAGGED(tch, PRF_AFK))
  strcat(buf, " (AFK)");


If you have any trouble with it just email me and I'll see if I can help.



<< Affects screen for spell affects [by Jon Barrett] | Reply | View as text | Flattened | AFK Code -- Another method [by Rasdan] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.