Private Messages

Send a simple PM:

player.showpm("Hello!");

Send a PM with name and head icon:

player.showpm("Hello!", {name:"Mario", isadmin:true, isonline:true, head:"head2", hat:"hat5"});

Send a PM and react to the reply of the player:

let sender = {name:"Puzzle", isonline:true};
player.showpm("What is 2+2? Tell me the answer!", sender, function(player, msg) {
  if (msg == "4")
    player.showpm("That's correct!", sender);
  else
    player.showpm("Sorry that's wrong!", sender);
});

Send a PM with story as invitation (using the optional third data parameter):

player.showpm(message, null, {type:"invitation", storyid:1807});

Send a PM with map markers:

player.showpm("Hello!", {head:"1", name:"Go here to find food!"}, {mapmarkers:[
  { "x":375, "y":193, "text":"Trash", "icon":"job_trash-bottle.png", "blink":true}
]});

Send a PM on touch which automatically opens, by setting show:true in the data parameter. Additional advantage: the player can easily translate the text:

function onPlayerTouchsme(pl) {
    pl.showpm("Did you know you can change your name with /setname?",
        {head:"1", name:"Guide"},
        {show:true});
}