Welcome to the Builder Academy

Question IAW (in another window) AFK copy

More
14 Dec 2014 23:05 - 14 Dec 2014 23:16 #5139 by dracmas
I know it isn't much at all, but I feel bad when I'm not able to give back for all the work you guys put into the codebase. I've switched around trying other's out
but keep coming back because it's just that good to work with, even if I'm bad at coding lol.

Anyways, IAW just means your logged in on the mud, at the computer, just not paying attention to the mud. Whereas AFK I'd put as being at work, or out mowing the lawn or something. Attaching what I have from my git. Also know it's just copy and paste work, but it's all I'm good at so far sorry :/
Code:
27  src/act.h @@ -213,19 +213,20 @@ ACMD(do_gen_tog); #define SCMD_CLS 17 #define SCMD_BUILDWALK 18 #define SCMD_AFK 19 -#define SCMD_AUTOLOOT 20 -#define SCMD_AUTOGOLD 21 -#define SCMD_AUTOSPLIT 22 -#define SCMD_AUTOSAC 23 -#define SCMD_AUTOASSIST 24 -#define SCMD_AUTOMAP 25 -#define SCMD_AUTOKEY 26 -#define SCMD_AUTODOOR 27 -#define SCMD_COLOR 28 -#define SCMD_SYSLOG 29 -#define SCMD_WIMPY 30 -#define SCMD_PAGELENGTH 31 -#define SCMD_SCREENWIDTH 32 +#define SCMD_IAW 20 +#define SCMD_AUTOLOOT 21 +#define SCMD_AUTOGOLD 22 +#define SCMD_AUTOSPLIT 23 +#define SCMD_AUTOSAC 24 +#define SCMD_AUTOASSIST 25 +#define SCMD_AUTOMAP 26 +#define SCMD_AUTOKEY 27 +#define SCMD_AUTODOOR 28 +#define SCMD_COLOR 29 +#define SCMD_SYSLOG 30 +#define SCMD_WIMPY 31 +#define SCMD_PAGELENGTH 32 +#define SCMD_SCREENWIDTH 33 /* do_quit */ ACMD(do_quit); 26  src/act.informative.c @@ -358,6 +358,8 @@ static void list_one_char(struct char_data *i, struct char_data *ch) send_to_char(ch, " (buildwalk)"); if (!IS_NPC(i) && PRF_FLAGGED(i, PRF_AFK)) send_to_char(ch, " \x1B[1;33m[AFK]\x1B[0;0m"); + if (!IS_NPC(i) && PRF_FLAGGED(i, PRF_IAW)) + send_to_char(ch," \x1B[1;33m[IAW]\x1B[0;0m"); if (GET_POS(i) != POS_FIGHTING) { if (!SITTING(i)) @@ -1322,6 +1324,8 @@ ACMD(do_who) send_to_char(ch, " (Buildwalking)"); if (PRF_FLAGGED(tch, PRF_AFK)) send_to_char(ch, " \x1B[1;33m[AFK]\x1B[0;0m"); + if (PRF_FLAGGED(tch, PRF_IAW)) + send_to_char(ch, " \x1B[1;33m[IAW]\x1B[0;0m"); if (PRF_FLAGGED(tch, PRF_NOGOSS)) send_to_char(ch, " (nogos)"); if (PRF_FLAGGED(tch, PRF_NOWIZ)) @@ -1898,6 +1902,9 @@ ACMD(do_toggle) {"afk", PRF_AFK, 0, "AFK is now Off.\r\n", "AFK is now On.\r\n"}, + {"iaw", PRF_IAW, 0, + "IAW is now Off.\r\n", + "IAW is now On.\r\n"}, {"autoloot", PRF_AUTOLOOT, 0, "Autoloot disabled.\r\n", "Autoloot enabled.\r\n"}, @@ -2004,6 +2011,10 @@ ACMD(do_toggle) " Screenwidth: %-3d " " AFK: %-3s\r\n" + " Pagelength: %-3d " + " Screenwidth: %-3d " + " IAW: %-3s\r\n" + " Autokey: %-3s " " Autodoor: %-3s " " Color: %s \r\n ", @@ -2040,6 +2051,10 @@ ACMD(do_toggle) GET_SCREEN_WIDTH(ch), ONOFF(PRF_FLAGGED(ch, PRF_AFK)), + GET_PAGE_LENGTH(ch), + GET_SCREEN_WIDTH(ch), + ONOFF(PRF_FLAGGED(ch, PRF_IAW)), + ONOFF(PRF_FLAGGED(ch, PRF_AUTOKEY)), ONOFF(PRF_FLAGGED(ch, PRF_AUTODOOR)), types[COLOR_LEV(ch)]); @@ -2126,6 +2141,15 @@ ACMD(do_toggle) send_to_char(ch, "You have mail waiting.\r\n"); } break; + case SCMD_IAW: + if ((result = PRF_TOG_CHK(ch, PRF_IAW))) + act("$n is online but viewing another window.", TRUE, ch, 0, 0, TO_ROOM); + else{ + act("$n has returned from being IAW.", TRUE, ch, 0, 0, TO_ROOM); + if (has_mail(GET_IDNUM(ch))) + send_to_char(ch, "You have mail waiting.\r\n"); + } + break; case SCMD_WIMPY: if (!*arg2) { if (GET_WIMP_LEV(ch)) { @@ -2421,6 +2445,8 @@ ACMD(do_whois) if (PRF_FLAGGED(victim, PRF_AFK)) send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), GET_SEX(victim) == SEX_NEUTRAL ? "it" : (GET_SEX(victim) == SEX_MALE ? "he" : "she"), CCNRM(ch, C_NRM)); + if (PRF_FLAGGED(victim, PRF_IAW)) + send_to_char(ch, "%s%s is iaw right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), GET_SEX(victim) == SEX_NEUTRAL ? "it" : (GET_SEX(victim) == SEX_MALE ? "he" : "she"), CCNRM(ch, C_NRM)); } else if (hours > 0) send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours/24, hours%24); 12  src/act.other.c @@ -704,6 +704,8 @@ ACMD(do_gen_tog) "Buildwalk On.\r\n"}, {"AFK flag is now off.\r\n", "AFK flag is now on.\r\n"}, + {"IAW flag is now off.\r\n", + "IAW flag is now on.\r\n"}, {"Autoloot disabled.\r\n", "Autoloot enabled.\r\n"}, {"Autogold disabled.\r\n", @@ -806,6 +808,16 @@ ACMD(do_gen_tog) send_to_char(ch, "You have mail waiting.\r\n"); } break; + case SCMD_IAW: + result = PRF_TOG_CHK(ch, PRF_IAW); + if (PRF_FLAGGED(ch, PRF_IAW)) + act("$n has gone IAW.", TRUE, ch, 0, 0, TO_ROOM); + else { + act("$n has come back from IAW.", TRUE, ch, 0, 0, TO_ROOM); + if (has_mail(GET_IDNUM(ch))) + send_to_char(ch, "You have mail waiting.\r\n"); + } + break; case SCMD_AUTOLOOT: result = PRF_TOG_CHK(ch, PRF_AUTOLOOT); break; 4  src/act.wizard.c @@ -2844,6 +2844,7 @@ ACMD(do_show) { "wis", LVL_BUILDER, BOTH, NUMBER }, /* 55 */ { "questpoints", LVL_GOD, PC, NUMBER }, { "questhistory", LVL_GOD, PC, NUMBER }, + { "iaw", LVL_BUILDER, PC, BINARY }, /* 58 */ { "\n", 0, BOTH, MISC } }; @@ -3257,6 +3258,9 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c qvnum, GET_NAME(vict)); } break; + case 58: /* iaw */ + SET_OR_REMOVE(PRF_FLAGS(vict), PRF_IAW); + break; } default: send_to_char(ch, "Can't set that!\r\n"); 6  src/comm.c @@ -1189,6 +1189,12 @@ static char *make_prompt(struct descriptor_data *d) len += count; } + if (PRF_FLAGGED(d->character, PRF_IAW) && len < sizeof(prompt)) { + count = snprintf(prompt + len, sizeof(prompt) - len, "IAW "); + if (count >= 0) + len += count; + } + if (GET_LAST_NEWS(d->character) < newsmod) { count = snprintf(prompt + len, sizeof(prompt) - len, "(news) "); 1  src/constants.c @@ -244,6 +244,7 @@ const char *preference_bits[] = { "CLS", "BLDWLK", "AFK", + "IAW", "AUTOLOOT", "AUTOGOLD", "AUTOSPLIT", 1  src/interpreter.c @@ -87,6 +87,7 @@ cpp_extern const struct command_info cmd_info[] = { { "aedit" , "aed" , POS_DEAD , do_oasis_aedit, LVL_GOD, 0 }, { "alias" , "ali" , POS_DEAD , do_alias , 0, 0 }, { "afk" , "afk" , POS_DEAD , do_gen_tog , 0, SCMD_AFK }, + { "iaw" , "iaw" , POS_DEAD , do_gen_tog , 0, SCMD_IAW }, { "areas" , "are" , POS_DEAD , do_areas , 0, 0 }, { "assist" , "as" , POS_FIGHTING, do_assist , 1, 0 }, { "ask" , "ask" , POS_RESTING , do_spec_comm, 0, SCMD_ASK }, 4  src/prefedit.c @@ -852,6 +852,10 @@ void prefedit_Restore_Defaults(struct descriptor_data *d) if (PREFEDIT_FLAGGED(PRF_AFK)) REMOVE_BIT_AR(PREFEDIT_GET_FLAGS, PRF_AFK); + /* PRF_IAW - Off */ + if (PREFEDIT_FLAGGED(PRF_IAW)) + REMOVE_BIT_AR(PREFEDIT_GET_FLAGS, PRF_IAW); + /* PRF_AUTOLOOT - On */ if (!PREFEDIT_FLAGGED(PRF_AUTOLOOT)) SET_BIT_AR(PREFEDIT_GET_FLAGS, PRF_AUTOLOOT); 19  src/structs.h @@ -263,16 +263,17 @@ #define PRF_CLS 23 /**< Clear screen in OLC */ #define PRF_BUILDWALK 24 /**< Build new rooms while walking */ #define PRF_AFK 25 /**< AFK flag */ -#define PRF_AUTOLOOT 26 /**< Loot everything from a corpse */ -#define PRF_AUTOGOLD 27 /**< Loot gold from a corpse */ -#define PRF_AUTOSPLIT 28 /**< Split gold with group */ -#define PRF_AUTOSAC 29 /**< Sacrifice a corpse */ -#define PRF_AUTOASSIST 30 /**< Auto-assist toggle */ -#define PRF_AUTOMAP 31 /**< Show map at the side of room descs */ -#define PRF_AUTOKEY 32 /**< Automatically unlock locked doors when opening */ -#define PRF_AUTODOOR 33 /**< Use the next available door */ +#define PRF_IAW 26 /**< IAW flag */ +#define PRF_AUTOLOOT 27 /**< Loot everything from a corpse */ +#define PRF_AUTOGOLD 28 /**< Loot gold from a corpse */ +#define PRF_AUTOSPLIT 29 /**< Split gold with group */ +#define PRF_AUTOSAC 30 /**< Sacrifice a corpse */ +#define PRF_AUTOASSIST 31 /**< Auto-assist toggle */ +#define PRF_AUTOMAP 32 /**< Show map at the side of room descs */ +#define PRF_AUTOKEY 33 /**< Automatically unlock locked doors when opening */ +#define PRF_AUTODOOR 34 /**< Use the next available door */ /** Total number of available PRF flags */ -#define NUM_PRF_FLAGS 34 +#define NUM_PRF_FLAGS 35 /* Affect bits: used in char_data.char_specials.saved.affected_by */ /* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */ 22  lib/text/help/help.hlp @@ -437,7 +437,7 @@ P) Perm Affects: @cNOBITS@n 21) UNUSED DO NOT USE. 22) CHARM DO NOT USE. -#31 +#0 AFK Usage : afk @@ -448,16 +448,7 @@ come back from AFK you will be notified if you have mail waiting. See also: TOGGLE, WHO -#31 -IAW - -Usage : iaw - -Lets other players know you are on the computer but away from the mud. The [IAW] -flag will be displayed in your prompt and under who after your name and title. -When you come back from IAW you will be notified if you have mail waiting. - -#0 +#1 AGE How old your character is. Your age begins at creation and continues whether @@ -3963,6 +3954,15 @@ Enter choice : See Also: HSEDIT, SHOW-HOUSES #31 +IAW + +Usage : iaw + +Lets other players know you are on the computer but away from the mud. The [IAW] +flag will be displayed in your prompt and under who after your name and title. +When you come back from IAW you will be notified if you have mail waiting. + +#1 IDENTIFY Usage : cast 'identify' <target>
Attachments:
Last edit: 14 Dec 2014 23:16 by dracmas. Reason: didnt post code? Added txt file.

Please Log in or Create an account to join the conversation.

More
14 Dec 2014 23:13 #5141 by Parnassus

dracmas wrote: 27  src/act.h
...
26  src/act.informative.c
...
12  src/act.other.c
...
4  src/act.wizard.c

?

Please Log in or Create an account to join the conversation.

More
14 Dec 2014 23:17 - 14 Dec 2014 23:21 #5142 by dracmas
Sorry, wow I'm appologising way too much lately.

Attached a file. I'm getting used to using git among other things, so
hope that I'll be able to do more than just diddles in the future :)

Edit again: Messed up the helpfile :/ just so you know to modify accordingly. Mine I origionally set the lvl to #31 so lower lvls couldn't view it. Git hub newbie thing.
Last edit: 14 Dec 2014 23:21 by dracmas. Reason: Explaining goof.

Please Log in or Create an account to join the conversation.

More
14 Dec 2014 23:24 #5143 by Parnassus
I think it's really good that you're trying because this is an interesting idea. Even though I don't code, I find that snippets help me understand more. I'm also sure that it gets easier as you go along.

However, now it says:
27  src/act.h
which still seems odd to me. Also, for a snippet, shouldn't there be a mention of where to put it?

As a builder, I find that errors now help me learn to avoid other errors later.

Please Log in or Create an account to join the conversation.

More
14 Dec 2014 23:30 - 14 Dec 2014 23:34 #5144 by dracmas
I was copying and pasting from the git I'm working with.
The 27  part is of no importance. The edited files are shown like what you see in src/act.h
lines I've changed will have -code removing some part of the code in one line and +code that adds in the IAW parts. Didn't get the helpfile part right, but other than that it toggles on and off like AFK does. Clones should anyways lol.

Edit: I used grep to find all instances of AFK so I could do the switch. I'm doing all I can to try to add in what my old mud had in it when they shut down. Just going to take a long while lol. Hard coded customizable prompt is next on my list (No DG used)
Last edit: 14 Dec 2014 23:34 by dracmas. Reason: another explination so no double post.

Please Log in or Create an account to join the conversation.

More
14 Dec 2014 23:45 #5146 by Parnassus
Thanks for the explanation :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.206 seconds