From: Rasdan Subject: AFK Code Almost a year ago, I posted some AFK code. It worked, but it was kind of bad. So I decided to redo it. This is the new version. FEATURES: * Allows you to set an afk message. * Allows a message to be displayed to whoever is telling to you that you are afk, and what that message is. * Displays to the room your message when you are afk, and informs everyone in the room when you are back from AFK. #define PRF_AFK (1 << ##) /* Player is AFK */ where ## is whatever is next on your PRF listing. In char_player_data, add: char *afk_message; /* PC / NPC's AFK MESSAGE */ In char_file_u, add: char afk_message[POOF_LENGTH + 1]; ------------------------ NOTE: THIS WILL CORRUPT YOUR PFILE! --------------- With the function prototypes at the top of utils.h, add: void set_afk(struct char_data *ch, char *afk_message, int result); with the POOFIN(ch) defines, put #define AFK_DEFAULT "I am afk, not looking at keyboard" #define GET_AFK(ch) ((ch)->player.afk_message) If you want it to save in pfile, you will need to modify the character saving/loading functions in db.c In limits.c, add: void set_afk(struct char_data * ch, char *afk_message, int result) { if (!*afk_message) sprintf(buf1, "%s", AFK_DEFAULT); else sprintf(buf1, "%s", afk_message); if (strlen(buf1) > POOF_LENGTH) { send_to_char("Afk message too long, using default.\r\n", ch); sprintf(buf1, "%s", AFK_DEFAULT); } if (GET_AFK(ch)) free(GET_AFK(ch)); GET_AFK(ch) = NULL; GET_AFK(ch) = str_dup(buf1); if (result) { sprintf(buf, "$n has just gone AFK: %s", GET_AFK(ch)); act(buf, FALSE, ch, 0, 0, TO_ROOM); sprintf(buf, "You have just gone AFK: %s", GET_AFK(ch)); act(buf, FALSE< ch, 0, 0, TO_CHAR); } else { act("$n is back from AFK!", FALSE, ch, 0, 0, TO_ROOM); act("You are back from AFK!", FALSE, ch, 0, 0, TO_CHAR); } } In act.other.c, put this: ACMD(do_afk) { int result; if (IS_NPC(ch)) { send_to_char("Mobs don't have keyboards, go away.\r\n", ch); return; } skip_spaces(&argument); if (PRF_FLAGGED(ch, PRF_AFK)) { result = FALSE; REMOVE_BIT(PRF_FLAGS(ch), PRF_AFK); } else { result = TRUE; SET_BIT(PRF_FLAGS(ch), PRF_AFK); } set_afk(ch, argument, result); } In act.comm.c, in ACMD(do_tell) after else if (PRF_FLAGGED(vict, PRF_NOTELL) || ROOM_FLAGGED(vict->in_room, ROOM_SO UNDPROOF)) act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); add: else { if (PRF_FLAGGED(vict, PRF_AFK)) { sprintf(buf, "%s is AFK and may not hear your tell.\r\n", GET_NAME(vict )); send_to_char(buf, ch); sprintf(buf, "MESSAGE: %s\r\n", GET_AFK(vict)); send_to_char(buf, ch); } In act.informative.c, in list_one_char, after: if (PLR_FLAGGED(i, PLR_WRITING)) strcat(buf, " [COMPOSING]"); <---- I think it's (Composing) in stock Circl e add: if (PRF_FLAGGED(i, PRF_AFK)) strcat(buf, " [AFK]"); In do_who after if (PRF_FLAGGED(tch, PRF_NOTELL)) strcat(buf, " [NO-TELLS]"); <---- Think it is (No-Tell) in stock Circl e if (PRF_FLAGGED(tch, PRF_AFK)) strcat(buf, " [AFK]"); In comm.c, in make_prompt, before: if (PRF_FLAGGED(d->character, PRF_DISPHP)) sprintf(prompt, "%s%s<%dhp ", prompt, CBBLU(d->character,C_SPR),GET_HIT(d->character)); add: if (PRF_FLAGGED(d->character, PRF_AFK)) sprintf(prompt, "%s%s[AFK]%s", prompt, CBCYN(d->character, C_SPR), CCNRM(d->character, C_SPR));