Welcome to the Builder Academy

Question Communication

More
03 Feb 2018 08:53 - 03 Feb 2018 09:10 #7529 by JTP
Replied by JTP on topic Communication
Copied do_say and tried to make it only viewable by those in a room that has learned it.
The for (vict .... was already Used there.
Last edit: 03 Feb 2018 09:10 by JTP.

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

More
03 Feb 2018 12:44 - 03 Feb 2018 12:58 #7530 by Fizban
Replied by Fizban on topic Communication
Code:
ACMD(do_say) { skip_spaces(&argument); if (!*argument) send_to_char(ch, "Yes, but WHAT do you want to say?\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); snprintf(buf, sizeof(buf), "$n\tn says, '%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_SAY); if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); else { sprintf(buf, "You say, '%s'", argument); msg = act(buf, FALSE, ch, 0, 0, TO_CHAR | DG_NO_TRIG); add_history(ch, msg, HIST_SAY); } }

That is do_say, the only thing in a for loop is the part that adds to everyone's history. The act is not in a for loop like it is in your code.

You can't send TO_ROOM, or else everyone will see it - regardless of whether they know the language/skill, so you do need to send it TO_VICT inside of a loop instead.

Making it so only people that know telepathy can use the skill would leave it functioning mostly like say, making it only understandable by those trained in it though makes it more like a multi-targeted tell.
Last edit: 03 Feb 2018 12:58 by Fizban.

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

More
03 Feb 2018 12:59 #7531 by JTP
Replied by JTP on topic Communication
Yea but when i changed room to vict, this is what i Got 4 times :

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


But i should have gotten 1: Testchar seems to try tell you something.....

So changing room to vict wasnt enough :(

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

More
03 Feb 2018 17:12 - 03 Feb 2018 17:15 #7532 by JTP
Replied by JTP on topic Communication
And when its TO_ROOM and someone used this comm, in a room with char that havent learned it:

Testchar seems to try tell you something that you dont understand.
Testchar tele: hi
Testchar tele: hi
Testchar tele: hi
Testchar tele: hi


Should only see the first line and not the 4 with hi




If 2 chars in the same room have do_tele the "receiver" gets 5:

Testchar tele: hi
Last edit: 03 Feb 2018 17:15 by JTP.

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

More
03 Feb 2018 17:17 - 03 Feb 2018 17:29 #7533 by Fizban
Replied by Fizban on topic Communication
You have

msg = act(buf, FALSE, ch, 0, 0, TO_ROOM | DG_NO_TRIG);

In two spots, it looks like you only changed it in one of them.

It has to be changed in both the spots where it sends a message if they d understand as well as if they don't.

Anything in a loop that is TO_ROOM is going to result in duplicated messages.
Last edit: 03 Feb 2018 17:29 by Fizban.

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

More
03 Feb 2018 17:29 #7534 by JTP
Replied by JTP on topic Communication
When both is TO_VICT then only the one who types tele hi see that..

others in room, no matter if they do or dont have it learned, they dont see any messages at all :(

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

Time to create page: 0.223 seconds