Re: [CIRCLE] [CODE] AFK

From: Mark Komus (umkomusm@cc.UManitoba.CA)
Date: 12/04/96


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 on.\r\n",
 "AFK flag is now off.\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.

Mark Komus				Mark_Komus@mbnet.mb.ca
2nd Year Computer Science (Honours)	umkomusm@cc.umanitoba.ca
University of Manitoba			http://www.mbnet.mb.ca/~mkomus/



+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST