Hey all, Here is my version of an AFK command. 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. Here it is: In structs.h, #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); with the POOFIN(ch) defines, put #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) { if (strlen(afk_message) > POOF_LENGTH) afk_message[POOF_LENGTH] = '\0'; if (GET_AFK(ch) != NULL) free(GET_AFK(ch)); GET_AFK(ch) = str_dup(afk_message); } In act.other.c, put this: ACMD(do_afk) { long result; if (IS_NPC(ch)) return; skip_spaces(&argument); if (!*argument) { result = PRF_TOG_CHK(ch, PRF_AFK); GET_AFK(ch) = "I am AFK!"; } else { result = PRF_TOG_CHK(ch, PRF_AFK); set_afk(ch, argument); } if (result) { sprintf(buf, "%s has just gone AFK: %s\r\n", GET_NAME(ch), GET_AFK(ch)); send_to_room(buf, ch->in_room); } else { sprintf(buf, "%s is back from AFK!\r\n", GET_NAME(ch)); send_to_room(buf, ch->in_room); } return; } In act.comm.c, in ACMD(do_tell) after else if (PRF_FLAGGED(vict, PRF_NOTELL) || ROOM_FLAGGED(vict->in_room, ROOM_SOUNDPROOF)) 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 Circle 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 Circle 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)); That should be it! As always, if you have any questions at all, contact me at: thomajam@ucs.orst.edu Rasdan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= James C. Thomas Jr. thomajam@ucs.orst.edu rasdan@necromium.com If ya want to build, or code, check out: finality.mudservices.com 5555 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | | Or send 'info circle' to majordomo@cspo.queensu.ca | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST