
I'm working on a complete overhaul of a couple of my scripts and was redoing how they handle sending messages to players. I was going to simply use msg.who to have the script reply directly to the player/GM sending the message, but I've run into a snag that seems like a poor design decision rather than a true bug. The GM's default speaking as option is set to: GM's display name + " (GM)"
Which would be "Scott C. (GM)" for me. The problem is that when the GM sends a message as themselves, the api logs the msg.who as "Scott C. (GM)", but my in game display name is just "Scott C." This causes the following code to log a chat error to the API console log and not send a message: on('chat:message',(msg)=>{
sendChat('Chat tester','/w "'+msg.who+'" This message is a test.');
}
Error Generated:
{"who":"error","type":"error","content":"Unable to find a player or character with name: Scott C. (GM)"} It seems like if a name is an option in the speaking-as dropdown selection, it should also be a valid whisper target. -Scott