Jump to content

Cmd: Difference between revisions

KKosty4ka (talk | contribs)
Created page with "cmd is a feature of OWOT that allows scripts to exchange string messages. ==Using cmd in scripts== Receiving cmd messages: <syntaxhighlight lang="javascript"> // Start receiving cmd messages w.broadcastReceive(); // cmd message event w.on("cmd", e => { /* Process the message here. Properties: kind = always "cmd" data = the actual text of the cmd message sender = the sender's channel id..."
 
mNo edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 25: Line 25:


Sending [[cmd]] messages: <syntaxhighlight lang="javascript">
Sending [[cmd]] messages: <syntaxhighlight lang="javascript">
// send a message with the text "hi" without including the username and Uvias ID
// send a message with the text "hi" without the username and Uvias ID
w.broadcastCommand("hi", false);
w.broadcastCommand("hi", false);


// send a message with the text "hi" with including the username and Uvias ID
// send a message with the text "hi" with the username and Uvias ID
w.broadcastCommand("hi", true);
w.broadcastCommand("hi", true);
// are the same as above
network.cmd("hi", false);
network.cmd("hi", true);
</syntaxhighlight>
</syntaxhighlight>
==<code>com:</code> and <code>comu:</code> links==
[[cmd]] messages can also be sent with special links. This allows for interactive scripts.<br>
For example:
* The link <code>com:hi</code> will send a "hi" cmd message without the username and Uvias ID.
* The link <code>comu:hi</code> will send a "hi" cmd message with the username and Uvias ID.


==Limitations==
==Limitations==
Line 40: Line 51:
==References==
==References==
<references />
<references />
[[Category:Documentation]]
[[Category:Scripts]]
[[Category:Tutorials]]