Page MenuHomeFeedback Tracker

customChat command does not work
Feedback, NormalPublic

Description

Hello,

when creating a custom channel and using the customChat command, there is no message shown. If you open the chat manually.
You can post in the custom channel.

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce
  1. Open Editor and place a unit
  2. Start into a local multiplayer lobby
  3. Select unit
  4. Start game
  5. Open debug console and set of the following command

_channel = radioChannelCreate [[0.9,0.1,0.1,1],"Admin","Admin",[],true];
_channel radioChannelAdd [player];
_channel radioChannelSetCallSign format ["MEH0", "MEH"];
player customChat [_channel, "ADADADA"];

  1. Check the chat

Event Timeline

mrzorn added a subscriber: mrzorn.Oct 11 2024, 7:09 PM
diwako added a subscriber: diwako.Oct 11 2024, 7:12 PM

Yes, since 2.18

works in internal, try profiling should be fixed there too

dedmen changed the task status from New to Feedback.Oct 23 2024, 4:44 PM

Can confirm it works in SP until you use the command radioChannelRemove and wait before you add to the channel again.

The custom chat does not work at all when hosted through listen server through 3den.

Code I tried it with with local execution, similar to working code prior to 2.18

// post init
if (isNil "diw_chatChannel") then {
    diw_chatChannel = radioChannelCreate [[0.9,0.1,0.1,1], "Chat", "Chat", [], true];
    publicVariable "diw_chatChannel"; // not needed for test
};

// simulate FPARMA usecase for receiving whispered messages
[] spawn {
    // get whisper message sent
    diw_chatChannel radioChannelAdd [player];
    diw_chatChannel radioChannelSetCallsign "Some schmuck";
    player customChat [diw_chatChannel, format ["Hey this works!! %1", time]];
    diw_chatChannel radioChannelRemove [player];
    sleep 1; // get another message
    diw_chatChannel radioChannelAdd [player];
    diw_chatChannel radioChannelSetCallsign "Some schmuck";
    player customChat [diw_chatChannel, format ["This doesn't!! %1", time]];
    diw_chatChannel radioChannelRemove [player];
    sleep 1;
    comment "see if new channel works, for some reason // breaks here";
    private _channel = radioChannelCreate [[0.9,0.1,0.1,1],"Admin","Admin",[],true];
    _channel radioChannelAdd [player];
    _channel radioChannelSetCallSign format ["MEH0", "MEH"];
    player customChat [_channel, "Hey I work! 1"];
    player customChat [_channel, "Hey I work! 2"];
    _channel radioChannelRemove [player];
    _channel radioChannelAdd [player];
    player customChat [_channel, "Hey I work! 3"];
    _channel radioChannelRemove [player];
    sleep 1;
    _channel radioChannelAdd [player];
    player customChat [_channel, "Aaaand borke it 1"];
    player customChat [_channel, "Aaaand borke it 2"];
};

If you wait after adding or removing player before sending chat it works. I am going too see if this can be improved

BIS_fnc_KK added a comment.EditedOct 25 2024, 6:11 PM

Ok the problem is that after player is removed from the channel, this channel is muted so customchat doesnt work, when player is added back the channel is made audible again but not immediately, this is why adding sleep before customchat works. I will force it to update quicker

Revision: 152319

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.Oct 25 2024, 6:41 PM

Just saying, the code snippet i posted earlier is working code prior to 2.18. Gruppe Adler and FPArma had functioning whispers like that, there was no waiting after adding or removing the player to the custom chat what so ever, all that code runs unscheduled as well.

https://github.com/fparma/fparma-mods/blob/32abb128af8600ecd654df263efe21bde9f6e9d9/addons/common/XEH_preInitClient.sqf#L49-L52

diwako added a comment.Nov 4 2024, 2:02 PM

Retested with current profiling branch version: 2.18.152307

Hosted MP through 3den, the chat message does not show at all still.

Running the same script i have posted above (see link below) the issue still appears while testing in singleplayer
https://feedback.bistudio.com/T185296#2690883

The context why the used script snipped is used to test and no new one that waits a frame after adding the player to the channel, is existing code from multiple units and mods that worked like that since at least 2018.

These mods and scripts create one channel, publicVariable that one, so every player has the same channel and add and remove the player on a local basis to display messages.
Usually done so in adding the player, sending message and then removing the player, all on the same frame.

Since version 2.18 the behavior has changed, existing mods that utilize this feature will not work like this as they do not add the player to the channel and then wait a frame to display the message.
Waiting of any kind can cause race conditions, maybe there are 2 messages coming in one frame after another (unlikely, but as an example), it might cause that the later message gets lost.

Either declare that the behavior has changed since 2.18, thus breaking mods that need this feature and tell them to update. Or retain the behavior.

Retested with current profiling branch version: 2.18.152307

Fixed in Revision: 152319