Welcome to the Builder Academy

Question Communication

More
02 Feb 2018 19:36 #7523 by JTP
Replied by JTP on topic Communication
All i Can see for history is adding it to structs.h as define hist_ and a total number of hist

I cant see anywhere else where i would need to change anything. That just almost Seem to easy

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

More
02 Feb 2018 22:55 - 03 Feb 2018 00:19 #7524 by JTP
Replied by JTP on topic Communication
Ahh found history_type...all ok now
Last edit: 03 Feb 2018 00:19 by JTP.

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

More
03 Feb 2018 00:34 - 03 Feb 2018 00:54 #7525 by JTP
Replied by JTP on topic Communication
Ok down to last problem...i only want this communications to be used by people who learned it...thats easy enough.

But then i want people who havent learned it, to get a different messge then those that also have learned it..

Here it is, but as you can see, that i see 5 messages from sender, where i should never see the hi one, and ofc just only get 1 of the others...history shows the right one and just 1 as it should...Hope one of you can solve this:
Code:
109h 100m 222v > Testchar seems to try tell you something that you dont understand. Testchar tele: hi Testchar seems to try tell you something that you dont understand. Testchar seems to try tell you something that you dont understand. Testchar seems to try tell you something that you dont understand. 109h 100m 222v > history all 16:38 Testchar seems to try tell you something that you dont understand. ACMD(do_tele) { skip_spaces(&argument); if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_tele)) { send_to_char(ch, "You have no idea how.\r\n"); return; } if (!*argument) send_to_char(ch, "Yes, but WHAT do you want to tele?\r\n"); else { char buf[MAX_INPUT_LENGTH + 14], *msg; struct char_data *vict; if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) parse_at(argument); for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room) if (!IS_NPC(vict) && !GET_SKILL(vict, SKILL_TELE)) { snprintf(buf, sizeof(buf), "$n\tc seems to try tell you something that you dont understand."); msg = act(buf, FALSE, ch, 0, 0, TO_ROOM | DG_NO_TRIG); } else { snprintf(buf, sizeof(buf), "$n\tc tele\tn: %s", argument); msg = act(buf, FALSE, ch, 0, 0, TO_ROOM | DG_NO_TRIG); } for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room) if (vict != ch && GET_POS(vict) > POS_SLEEPING) add_history(vict, msg, HIST_TELE); if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); else { sprintf(buf, "\tcYou tele\tn: %s", argument); msg = act(buf, FALSE, ch, 0, 0, TO_CHAR | DG_NO_TRIG); add_history(ch, msg, HIST_TELE); } } /* Trigger check. */ speech_mtrigger(ch, argument); speech_wtrigger(ch, argument); }
Last edit: 03 Feb 2018 00:54 by JTP.

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

More
03 Feb 2018 01:00 #7526 by JTP
Replied by JTP on topic Communication
I know that Im using 2 for (vict

But only Way i Could get it to compile. If i remove the first one, Then Ofc Im using vict before its initialised.

If i remove the 2nd, Then oddly the first add_history complains that msg might be Used uninitialised.

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

More
03 Feb 2018 01:05 #7527 by Fizban
Replied by Fizban on topic Communication
At a glance
Code:
for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room) if (!IS_NPC(vict) && !GET_SKILL(vict, SKILL_TELE)) { snprintf(buf, sizeof(buf), "$n\tc seems to try tell you something that you dont understand."); - msg = act(buf, FALSE, ch, 0, 0, TO_ROOM | DG_NO_TRIG); + msg = act(buf, FALSE, ch, 0, 0, TO_VICT | DG_NO_TRIG);

You were sending the message to the room inside of a for loop, so everyone was receiving it once for each character present.

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

More
03 Feb 2018 03:18 #7528 by JTP
Replied by JTP on topic Communication
Hmm that instead gave 4

Testchar tele: hi
Testchar tele: hi
Testchar tele: hi
Testchar tele: hi

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

Time to create page: 0.217 seconds