po: Protocol - po-devs/pokemon-online GitHub Wiki
Introduction
The PO protocol (scheme) is enabled in channel chat, and enables additional client-side functionality specified by a developer using anchors (HTML anchor tag: ). The user must click the anchor for the functionality, so it is secure.
To be used, the developer must send an HTML message using server-side sys.sendHtmlAll
, client-side client.printHtml
(and similar functions), or manually through the network protocol (however you want to do it). It must be used inside the href attribute of an a tag (anchor). The syntax is po:method/parameter
Methods
join
po:join/channel
Parameter: channel name
This method makes the player join the supplied channel. Additionally, the client will focus on the channel if the player is already in it.
reconnect
po:reconnect
This method makes the player reconnect to the server. No parameters are used. Note, there is no solidus at the end!
watch
po:watch/battle
Parameter: battle id
This method makes the player watch the given battle. Note that Spectator Clause is still in effect and scripts can deny access as well.
watchplayer
po:watchplayer/name-or-id
Parameter: player id/player name
This method makes the player watch the given player's battle. Note that Spectator Clause is still in effect and scripts can deny access as well. Although you can both specify id or name, prefer using the player's id, because for numeric names the client will attempt to watch the battle of the player with that id.
pm
po:pm/name-or-id
Parameter: player id/player name
This method makes the player open a PM window for the given player. Although you can both specify id or name, prefer using the player's id, because for numeric names the client will attempt to open a PM window for the player with that id.
ignore
po:ignore/name-or-id
Parameter: player id/player name
This method makes the player toggle their ignore status for the given player. Although you can both specify id or name, prefer using the player's id, because for numeric names the client will attempt to toggle the ignore status the player with that id.
info
po:info/name-or-id
Parameter: player id/player name
This method makes the player open a challenge window for the given player. Although you can both specify id or name, prefer using the player's id, because for numeric names the client will attempt to open a challenge window for the player with that id.
send [2.4.0+]
po:send/message
Parameter: message
This method makes the player send a message in the channel the anchor was printed in. The client-side beforeSendMessage
will receive the message and may reject the sending of it. New lines (\n) can be used to send several messages at once.
setmsg [2.4.1+]
po:setmsg/message
Parameter: message
This method changes the text inside the player's chat line with the given message.
appendmsg [2.4.1+]
po:appendmsg/message
Parameter: message
This method adds the given message to the text inside the player's chat line.