Welcome to the Builder Academy

Question Newbie Messages Snippet

More
01 Aug 2012 22:43 #507 by bakarus
Replied by bakarus on topic Re: Newbie Messages Snippet
As fate would have it, it was in act.informative.c, the problem was a curly brace issue, the check_newbie function was accidentally placed inside a curly brace for a function above it, which caused the problem, once it was fixed everything compiled fine with no issues, thanks again Liko for bearing with me and all the help and patience :)

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

More
04 Aug 2012 00:04 - 04 Aug 2012 00:18 #523 by Halenbane
Thank you for the snippet Liko, I used it for some direction when I did my newbie messages. I noticed afterwards my logs were filling up very fast, 1.6Gigs in no time. It seems it was running a check on players as well as NPC's for the newbie flag, a small check solved this problem.

For anyone that needs it , here are the minor changes.

In act.informative.c

Code:
for (i = character_list; i; i = next_char) { next_char = i->next; + if (!IS_NPC(i)) { if (PRF_FLAGGED(i, PRF_NEWBIE) && !PLR_FLAGGED(i, PLR_WRITING)) { // Also add another curly at the end of the function } } } + }
Last edit: 04 Aug 2012 00:18 by Halenbane.

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

More
04 Aug 2012 05:36 #527 by Liko

Halenbane wrote: Thank you for the snippet Liko, I used it for some direction when I did my newbie messages. I noticed afterwards my logs were filling up very fast, 1.6Gigs in no time. It seems it was running a check on players as well as NPC's for the newbie flag, a small check solved this problem.

For anyone that needs it , here are the minor changes.

In act.informative.c

Code:
for (i = character_list; i; i = next_char) { next_char = i->next; + if (!IS_NPC(i)) { if (PRF_FLAGGED(i, PRF_NEWBIE) && !PLR_FLAGGED(i, PLR_WRITING)) { // Also add another curly at the end of the function } } } + }


Nice find. I didn't notice mainly because only about 7 NPC's are programmed into the mud. It wasn't filling up as fast for me. I've updated the file with the find.

Randian(0.0.0)
Owner/Developer

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

More
04 Aug 2012 14:34 #529 by Vatiken
If this snippet is for PC's only then it would be FAR more efficient to use the descriptor list instead of the character list. Using tbamud.com as an example, using the character list would mean cycling through 16968 different PCs/NPCs to send a message to only the 3 players on-line.

tbaMUD developer/programmer

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

More
04 Aug 2012 19:34 #530 by Liko
I'm going to re-write this today instead of just porting it over.

Randian(0.0.0)
Owner/Developer

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

More
05 Aug 2012 22:50 - 06 Aug 2012 08:23 #541 by Liko
Hey guys,

I rewrote the check_newbie function instead of just porting it. Here is the updated coded.
Code:
void check_newbie(void) { struct descriptor_data *d; int message; for (d = descriptor_list; d; d = d->next) { if(IS_PLAYING(d)) { if(PRF_FLAGGED(d->character, PRF_NEWBIE) && !PLR_FLAGGED(d->character, PLR_WRITING)) { message = rand_number(1,4); if(message == 1) send_to_char(d->character, "\tD[\tRNewbie Help\tD: \twRemember to check monster's corpse for loot!\tD]\tn\r\n"); if(message == 2) send_to_char(d->character, "\tD[\tRNewbie Help\tD: \twYou can turn of the newbie help by typing \tctoggle 'newbie'\tD]\tn\r\n"); if(message == 3) send_to_char(d->character, "\tD[\tRNewbie Help\tD: \twRemember to stock up on potions.\tD]\tn\r\n"); if(message == 4) send_to_char(d->character, "\tD[\tRNewbie Help\tD: You can check the latest game updates by typing \tcupdate\tD]\tn\r\n"); } } } }

Let me know if any issues arise from it or improvements. Also this code shows no errors in the error log so far. :)

Randian(0.0.0)
Owner/Developer
Last edit: 06 Aug 2012 08:23 by Liko.

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

Time to create page: 0.245 seconds