Using the following function to generate a string prefix for a sendChat message: function getWhisperTarget(to) {
var whisper = '';
if (to) {
whisper = '/w "' + getObj('player', to).get('displayname') + '" ';
}
return whisper;
}
Attempting, for example, sendChat('System', getWhisperTarget(msg.playerid) + 'Test Message'); results in the following in the API console: {"who":"error","type":"error","content":"Unable to find a player or character with name: \"brian\""} Trace debugging confirms the name that I'm trying to whisper to is "Brian".