<snapdata remixID="13497547"><project name="Game Controller" app="Snap! 9.0, https://snap.berkeley.edu" version="2"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAAAiVJREFUeF7t0sEJACAAAzHdf+gKLnGfdIHCkbttxxSIClwAo/JufwEAQUgLAJjmdw4gA2kBANP8zgFkIC0AYJrfOYAMpAUATPM7B5CBtACAaX7nADKQFgAwze8cQAbSAgCm+Z0DyEBaAMA0v3MAGUgLAJjmdw4gA2kBANP8zgFkIC0AYJrfOYAMpAUATPM7B5CBtACAaX7nADKQFgAwze8cQAbSAgCm+Z0DyEBaAMA0v3MAGUgLAJjmdw4gA2kBANP8zgFkIC0AYJrfOYAMpAUATPM7B5CBtACAaX7nADKQFgAwze8cQAbSAgCm+Z0DyEBaAMA0v3MAGUgLAJjmdw4gA2kBANP8zgFkIC0AYJrfOYAMpAUATPM7B5CBtACAaX7nADKQFgAwze8cQAbSAgCm+Z0DyEBaAMA0v3MAGUgLAJjmdw4gA2kBANP8zgFkIC0AYJrfOYAMpAUATPM7B5CBtACAaX7nADKQFgAwze8cQAbSAgCm+Z0DyEBaAMA0v3MAGUgLAJjmdw4gA2kBANP8zgFkIC0AYJrfOYAMpAUATPM7B5CBtACAaX7nADKQFgAwze8cQAbSAgCm+Z0DyEBaAMA0v3MAGUgLAJjmdw4gA2kBANP8zgFkIC0AYJrfOYAMpAUATPM7B5CBtACAaX7nADKQFgAwze8cQAbSAgCm+Z0DyEBaAMA0v3MAGUgLAJjmdw4gA2kBANP8zgFkIC0AYJrf+QOC496obByqTwAAAABJRU5ErkJggg==</thumbnail><scenes select="1"><scene name="Game Controller"><notes></notes><palette><category name="MQTT" color="143,0,100,1"/></palette><hidden></hidden><headers></headers><code></code><blocks><block-definition s="costume from text %&apos;text&apos; size %&apos;size&apos;" type="reporter" category="looks"><header></header><code></code><translations>de:Kostüm aus Text _ Größe _&#xD;pt:um traje com o texto _ de tamanho _&#xD;ca:vestit amb el text _ i mida _&#xD;</translations><inputs><input type="%s">A</input><input type="%n">72</input></inputs><script><block s="doDeclareVariables"><list><l>costume</l><l>x</l><l>y</l><l>dir</l><l>cst</l><l>trails</l><l>pen state</l></list></block><block s="doSetVar"><l>x</l><block s="xPosition"></block></block><block s="doSetVar"><l>y</l><block s="yPosition"></block></block><block s="doSetVar"><l>dir</l><block s="direction"></block></block><block s="doSetVar"><l>cst</l><block s="reportGet"><l><option>costume</option></l></block></block><block s="doSetVar"><l>pen state</l><block s="getPenDown"></block></block><block s="up"></block><block s="doGotoObject"><l><option>center</option></l></block><block s="setHeading"><l>90</l></block><block s="doSwitchToCostume"><l><option>Turtle</option></l></block><block s="doSetVar"><l>trails</l><block s="reportPenTrailsAsCostume"></block></block><block s="clear"></block><block s="gotoXY"><block s="reportAttributeOf"><l><option>left</option></l><l>Stage</l></block><l>0</l></block><block s="write"><block var="text"/><block var="size"/></block><block s="gotoXY"><block s="reportAttributeOf"><l><option>left</option></l><l>Stage</l></block><l>0</l></block><block s="doSetVar"><l>costume</l><block s="reportPenTrailsAsCostume"></block></block><block s="clear"></block><block s="doApplyExtension"><l>obj_name(obj, name)</l><list><block var="costume"/><block s="reportJoinWords"><list><block var="text"/></list></block></list></block><block s="doGotoObject"><l><option>center</option></l></block><block s="doSwitchToCostume"><block var="trails"/></block><block s="doStamp"></block><block s="doSwitchToCostume"><block var="cst"/></block><block s="gotoXY"><block var="x"/><block var="y"/></block><block s="setHeading"><block var="dir"/></block><block s="doIf"><block var="pen state"/><script><block s="down"></block></script><list></list></block><block s="doReport"><block var="costume"/></block></script></block-definition><block-definition s="costume %&apos;cst&apos; with background RGBA %&apos;rgb&apos; padding %&apos;padding&apos;" type="reporter" category="looks"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true"><options>§_costumesMenu</options></input><input type="%n">200</input><input type="%n">2</input></inputs><script><block s="doDeclareVariables"><list><l>old</l><l>clr</l><l>new</l><l>x</l><l>y</l><l>dir</l><l>trails</l><l>flat</l><l>old size</l><l>old pen state</l></list></block><block s="doSetVar"><l>x</l><block s="xPosition"></block></block><block s="doSetVar"><l>y</l><block s="yPosition"></block></block><block s="doSetVar"><l>dir</l><block s="direction"></block></block><block s="doSetVar"><l>old</l><block s="reportGet"><l><option>costume</option></l></block></block><block s="doSetVar"><l>clr</l><block s="getPenAttribute"><l><option>r-g-b-a</option></l></block></block><block s="doSetVar"><l>flat</l><block s="reportGlobalFlag"><l><option>flat line ends</option></l></block></block><block s="doSetVar"><l>old size</l><block s="getPenAttribute"><l><option>size</option></l></block></block><block s="doSetVar"><l>old pen state</l><block s="getPenDown"></block></block><block s="up"></block><block s="doGotoObject"><l><option>center</option></l></block><block s="doSetVar"><l>trails</l><block s="reportPenTrailsAsCostume"></block></block><block s="clear"></block><block s="gotoXY"><block s="reportMonadic"><l><option>neg</option></l><block s="reportVariadicSum"><list><block s="reportQuotient"><block s="reportGetImageAttribute"><l><option>width</option></l><block var="cst"/></block><l>2</l></block><block var="padding"/></list></block></block><l>0</l></block><block s="setHeading"><l>90</l></block><block s="doSetGlobalFlag"><l><option>flat line ends</option></l><l><bool>true</bool></l></block><block s="setSize"><block s="reportVariadicSum"><list><block s="reportGetImageAttribute"><l><option>height</option></l><block var="cst"/></block><block s="reportVariadicProduct"><list><block var="padding"/><l>2</l></list></block></list></block></block><block s="setPenColorDimension"><l><option>r-g-b(-a)</option></l><block var="rgb"/></block><block s="down"></block><block s="setXPosition"><block s="reportMonadic"><l><option>neg</option></l><block s="xPosition"></block></block></block><block s="up"></block><block s="doSwitchToCostume"><block var="cst"/></block><block s="doGotoObject"><l><option>center</option></l></block><block s="gotoXY"><block s="reportMonadic"><l><option>neg</option></l><block s="reportGet"><l><option>center x</option></l></block></block><block s="reportMonadic"><l><option>neg</option></l><block s="reportGet"><l><option>center y</option></l></block></block></block><block s="doStamp"></block><block s="doGotoObject"><l><option>center</option></l></block><block s="doSetVar"><l>new</l><block s="reportPenTrailsAsCostume"></block></block><block s="doApplyExtension"><l>obj_name(obj, name)</l><list><block var="new"/><block s="reportIfElse"><block s="reportListContainsItem"><block s="reportTextSplit"><block s="reportAttributeOf"><l><option>costume name</option></l><l>Sprite</l></block><l><option>word</option></l></block><l>button</l></block><block s="reportAttributeOf"><l><option>costume name</option></l><l>Sprite</l></block><block s="reportJoinWords"><list><block s="reportAttributeOf"><l><option>costume name</option></l><l>Sprite</l></block><l> button</l></list></block></block></list></block><block s="clear"></block><block s="doGotoObject"><l><option>center</option></l></block><block s="doSwitchToCostume"><block var="trails"/></block><block s="doStamp"></block><block s="doSwitchToCostume"><block var="old"/></block><block s="gotoXY"><block var="x"/><block var="y"/></block><block s="setHeading"><block var="dir"/></block><block s="setPenColorDimension"><l><option>r-g-b(-a)</option></l><block var="clr"/></block><block s="doSetGlobalFlag"><l><option>flat line ends</option></l><block var="flat"/></block><block s="setSize"><block var="old size"/></block><block s="doIf"><block var="old pen state"/><script><block s="down"></block></script><list></list></block><block s="doReport"><block var="new"/></block></script><scripts><script x="255" y="186.19999999999996"><custom-block s="costume %s with background RGBA %n padding %n"><custom-block s="costume %s with background RGBA %n padding %n"><custom-block s="costume from text %s size %n"><l>Snap!</l><l>36</l></custom-block><l>200</l><l>10</l></custom-block><l>100</l><l>2</l></custom-block></script><comment x="248.685546875" y="121.03333333333337" w="106" collapsed="false">Use this block to make &quot;clickable&quot; buttons:</comment></scripts></block-definition><block-definition s="bottom circular button" type="command" category="looks"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doSwitchToCostume"><l>Circle</l></block><block s="setScale"><l>40</l></block></script></block-definition><block-definition s="bar button" type="command" category="looks"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doSwitchToCostume"><block s="reportNewCostumeStretched"><l>Square</l><l>500</l><l>150</l></block></block></script></block-definition><block-definition s="create button %&apos;name&apos;" type="command" category="control"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doTellTo"><block s="newClone"><l><option>myself</option></l></block><block s="reifyScript"><script><block s="doSetVar"><l><option>my name</option></l><block var="#1"/></block></script><list><l>#1</l></list></block><list><block var="name"/></list></block></script></block-definition><block-definition s="main button" type="command" category="looks"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doSwitchToCostume"><l>Circle</l></block><block s="setScale"><l>60</l></block></script></block-definition><block-definition s="ask %&apos;question&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s">what&apos;s your name?</input></inputs><script><block s="doAsk"><block var="question"/></block><block s="doReport"><block s="getLastAnswer"></block></block></script></block-definition><block-definition s="notify %&apos;message&apos;" type="command" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s">Alert!</input></inputs><script><block s="doTellTo"><block s="reportGet"><l><option>stage</option></l></block><block s="reifyScript"><script><block s="doAsk"><block s="reportNewList"><list><block s="reportApplyExtension"><l>ide_translate(text)</l><list><block var="message"/></list></block><block s="reportNewList"><list><block s="reportApplyExtension"><l>ide_translate(text)</l><list><l>Ok</l></list></block></list></block></list></block></block></script><list></list></block><list></list></block></script></block-definition><block-definition s="prompt %&apos;title&apos; options %&apos;options&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s">choose!</input><input type="%mult%s"></input></inputs><script><block s="doReport"><custom-block s="ask %s"><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="title"/><l></l></list></block><block var="options"/><block s="reportNewList"><list><block s="reportApplyExtension"><l>ide_translate(text)</l><list><block var="title"/></list></block><block var="options"/></list></block></block></custom-block></block></script></block-definition><block-definition s="submenu %&apos;title&apos; items %&apos;items&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s">title</input><input type="%mult%s"></input></inputs><script><block s="doReport"><block s="reportNewList"><list><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="title"/><l></l></list></block><l>menu</l><block s="reportApplyExtension"><l>ide_translate(text)</l><list><block var="title"/></list></block></block><block var="items"/></list></block></block></script></block-definition><block-definition s="divider" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block-definition><block-definition s="menu item icon %&apos;icon&apos; label %&apos;text&apos; value %&apos;value&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true"><options>§_objectsMenu</options></input><input type="%s">option</input><input type="%s"></input></inputs><script><block s="doReport"><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="icon"/><l></l></list></block><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="text"/><l></l></list></block><block var="value"/><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="value"/><l></l></list></block><block var="text"/><block s="reportNewList"><list><block var="text"/><block var="value"/></list></block></block></block><block s="reportNewList"><list><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="text"/><l></l></list></block><block s="reportIfElse"><block s="reportIsA"><block var="icon"/><l><option>text</option></l></block><block s="reportObject"><block var="icon"/></block><block var="icon"/></block><block s="reportNewList"><list><block s="reportIfElse"><block s="reportIsA"><block var="icon"/><l><option>text</option></l></block><block s="reportObject"><block var="icon"/></block><block var="icon"/></block><block var="text"/></list></block></block><block var="value"/></list></block></block></block></script></block-definition><block-definition s="menu item speech ballon %&apos;orientation&apos; message %&apos;message&apos; value %&apos;value&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">left<options>left&#xD;right</options></input><input type="%s">hey!</input><input type="%s"></input></inputs><script><block s="doReport"><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="value"/><l></l></list></block><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="orientation"/><l>right</l></list></block><block s="reportNewList"><list><l></l><block var="message"/></list></block><block s="reportNewList"><list><block var="message"/></list></block></block><block s="reportNewList"><list><block s="reportIfElse"><block s="reportVariadicEquals"><list><block var="orientation"/><l>right</l></list></block><block s="reportNewList"><list><l></l><block var="message"/></list></block><block s="reportNewList"><list><block var="message"/></list></block></block><block var="value"/></list></block></block></block></script></block-definition><block-definition s="menu examples" type="command" category="sensing"><comment x="0" y="0" w="212" collapsed="false">open my definition to look at examples how to use the menu blocks</comment><header></header><code></code><translations></translations><inputs></inputs><scripts><script x="10" y="79.00000000000001"><block s="doAsk"><l>what&apos;s your name?</l></block></script><script x="10" y="118.00000000000001"><custom-block s="ask %s"><l>what&apos;s your name?</l></custom-block></script><script x="10" y="151"><custom-block s="notify %s"><l>Alert!</l></custom-block></script><script x="10" y="190"><custom-block s="prompt %s options %mult%s"><l>choose!</l><list><l>foo</l><l>bar</l><l>baz</l></list></custom-block></script><script x="10" y="223"><custom-block s="prompt %s options %mult%s"><l>choose!</l><block s="reportGet"><l><option>costumes</option></l></block></custom-block></script><script x="10" y="261"><custom-block s="submenu %s items %mult%s"><l>more</l><list><l>frob</l><l>quux</l><l>garply</l></list></custom-block></script><script x="10" y="294"><custom-block s="prompt %s options %mult%s"><l>choose!</l><list><l>foo</l><l>bar</l><custom-block s="divider"></custom-block><custom-block s="submenu %s items %mult%s"><l>more</l><list><l>frob</l><custom-block s="submenu %s items %mult%s"><l></l><list><l>fred</l><l>test</l></list></custom-block><custom-block s="divider"></custom-block><l>quux</l><l>garply</l></list></custom-block><l>baz</l></list></custom-block></script><script x="10" y="377.8333333333334"><custom-block s="menu item icon %s label %s value %s"><l></l><l>option</l><l></l></custom-block></script><script x="10" y="411.8333333333334"><custom-block s="prompt %s options %mult%s"><l>choose!</l><list><custom-block s="menu item icon %s label %s value %s"><l>monkey</l><l>monkey</l><block s="reportObject"><l>monkey</l></block></custom-block><custom-block s="menu item icon %s label %s value %s"><l>Octo</l><l></l><l>42</l></custom-block><custom-block s="menu item icon %s label %s value %s"><l></l><l>choice</l><l>yay!</l></custom-block><custom-block s="divider"></custom-block><custom-block s="submenu %s items %mult%s"><l>more</l><list><custom-block s="menu item icon %s label %s value %s"><l>Alonzo</l><l>Alonzo</l><block s="reportObject"><l>Alonzo</l></block></custom-block><custom-block s="menu item icon %s label %s value %s"><l></l><l>foo</l><l>bar</l></custom-block></list></custom-block></list></custom-block></script><script x="10" y="565.8333333333335"><custom-block s="menu item speech ballon %s message %s value %s"><l>left</l><l>hey!</l><l></l></custom-block></script><script x="10" y="599.8333333333335"><custom-block s="prompt %s options %mult%s"><l>choose!</l><list><custom-block s="menu item speech ballon %s message %s value %s"><l>left</l><l>hey!</l><l></l></custom-block><custom-block s="menu item speech ballon %s message %s value %s"><l>right</l><l>wassup?</l><l></l></custom-block><custom-block s="menu item speech ballon %s message %s value %s"><l>left</l><block s="reportObject"><l>Alonzo</l></block><l></l></custom-block><custom-block s="menu item speech ballon %s message %s value %s"><l>right</l><l>so?</l><block s="reportGet"><l><option>costumes</option></l></block></custom-block></list></custom-block></script></scripts></block-definition><block-definition s="$cloudOutline MQTT connect to %&apos;broker&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="416.6666666666666" collapsed="false">Connect to a broker&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;1. username (some brokers need this)&#xD;2. password (some brokers need this)&#xD;3. keepalive (default time is 60 seconds but some brokers need a shorter time)&#xD;4. connection callback (ringed set of scripts to be run when connection is made or remade)&#xD;&#xD;Note: The connection callback doesn&apos;&apos;t have to be the 4th option - it just has to be the last (or only) option.&#xD;&#xD;ADVANCED: The brokers offered in the menu are accessed using default ports and  basepaths (if needed).  If accessing other brokers, the complete urls should be formed like this:&#xD;&#xD;siteURL:port/basepath &#xD;e.g mqtt.eclipseprojects.io:443/mqtt&#xD;&#xD;It is possible to have more than one connection to the same broker, for instance, using two different user/pass accounts simultaneously. To do this, add a connection id at the end of the broker:&#xD;&#xD;e.g mqtt.eclipseprojects.io:443/mqtt|1&#xD;</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%mult%s"></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doIf"><block s="reportNot"><block s="reportJoinWords"><block var="options"/></block></block><script><block s="doSetVar"><l>options</l><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doDeclareVariables"><list><l>connection status</l><l>callback</l></list></block><block s="doSetVar"><l>connection status</l><l>connecting</l></block><block s="doSetVar"><l>callback</l><l></l></block><block s="doIf"><block s="reportIsA"><block s="reportListItem"><l><option>last</option></l><block var="options"/></block><l><option>command</option></l></block><script><block s="doSetVar"><l>callback</l><block s="reportListItem"><l><option>last</option></l><block var="options"/></block></block><block s="doDeleteFromList"><l><option>last</option></l><block var="options"/></block></script><list></list></block><block s="doSetVar"><l>options</l><block s="reportListAttribute"><l><option>json</option></l><block s="reportNewList"><list><block s="reportNewList"><list><l>username</l><block s="reportListItem"><l>1</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>password</l><block s="reportListItem"><l>2</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>keepalive</l><block s="reportListItem"><l>3</l><block var="options"/></block></list></block></list></block></block></block><block s="doApplyExtension"><l>mqt_connect(broker,callback,options)</l><list><block var="broker"/><block var="callback"/><block var="options"/></list></block><block s="doWaitUntil"><block s="reportNot"><block s="reportVariadicEquals"><list><block var="connection status"/><l>connecting</l></list></block></block></block><block s="doIf"><block s="reportNot"><block s="reportVariadicEquals"><list><block var="connection status"/><l>connected</l></list></block></block><script><block s="doApplyExtension"><l>err_error(msg)</l><list><block var="connection status"/></list></block></script><list></list></block></script></block-definition><block-definition s="$cloudOutline MQTT subscribe to %&apos;broker&apos; topic %&apos;topic&apos; $nl on each message run %&apos;callback&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="239.99999999999977" collapsed="false">Subscribe to a topic on a broker&#xD;&#xD;Make sure you have already run an MQTT connect block before using this one&#xD;&#xD;You should add a script to be run inside he grey ring.&#xD;&#xD;It will be run each time a message is received&#xD;&#xD;If you click on the arrow on the grey ring twice, you can use #1 and #2 inside your script.&#xD;&#xD;#1 will contain the received payload&#xD;&#xD;#2 will contain the received topic name&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;There is only 1 option at present&#xD;1. Buffer mode (boolean) Default (false) - payload is returned as text&#xD;&#xD;If true, payload returned as single column list of values in the range of 0 to 255..  </comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%cmdRing"></input><input type="%mult%s"></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doIf"><block s="reportNot"><block s="reportJoinWords"><block var="options"/></block></block><script><block s="doSetVar"><l>options</l><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doSetVar"><l>options</l><block s="reportListAttribute"><l><option>json</option></l><block s="reportNewList"><list><block s="reportNewList"><list><l>mode</l><block s="reportListItem"><l>1</l><block var="options"/></block></list></block></list></block></block></block><block s="doApplyExtension"><l>mqt_sub(broker,topic,callback,options)</l><list><block var="broker"/><block var="topic"/><block var="callback"/><block var="options"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT publish to %&apos;broker&apos; topic %&apos;topic&apos; payload %&apos;payload&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="310" collapsed="false">Publish a message to an MQTT broker&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;1. qos (quality of service 0,1 or 2)&#xD;&#xD;2. retain flag (boolean)&#xD;&#xD;3. Buffer mode (boolean).    Default (false) - the payload is published as text&#xD;&#xD;If set to true then payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text.&#xD;&#xD;</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%mlt">hello</input><input type="%mult%s"></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doIf"><block s="reportNot"><block s="reportJoinWords"><block var="options"/></block></block><script><block s="doSetVar"><l>options</l><block s="reportNewList"><list></list></block></block></script><list></list></block><block s="doSetVar"><l>options</l><block s="reportListAttribute"><l><option>json</option></l><block s="reportNewList"><list><block s="reportNewList"><list><l>qos</l><block s="reportListItem"><l>1</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>retain</l><block s="reportListItem"><l>2</l><block var="options"/></block></list></block><block s="reportNewList"><list><l>mode</l><block s="reportListItem"><l>3</l><block var="options"/></block></list></block></list></block></block></block><block s="doIf"><block s="reportNot"><block s="reportListItem"><l>2</l><block s="reportListItem"><l>3</l><block s="reportTextSplit"><block var="options"/><l><option>json</option></l></block></block></block></block><script><block s="doIf"><block s="reportIsA"><block var="payload"/><l><option>list</option></l></block><script><block s="doSetVar"><l>payload</l><block s="reportListAttribute"><l><option>json</option></l><block var="payload"/></block></block></script><list></list></block><block s="doIf"><block s="reportIsA"><block var="payload"/><l><option>number</option></l></block><script><block s="doSetVar"><l>payload</l><block s="reportJoinWords"><list><block var="payload"/></list></block></block></script><list></list></block></script><list></list></block><block s="doApplyExtension"><l>mqt_pub(broker,topic,payload,options)</l><list><block var="broker"/><block var="topic"/><block var="payload"/><block var="options"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT unsubscribe from %&apos;broker&apos; topic %&apos;topic&apos;" type="command" category="MQTT"><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doApplyExtension"><l>mqt_unsub(broker,topic)</l><list><block var="broker"/><block var="topic"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT disconnect from %&apos;broker&apos;" type="command" category="MQTT"><header></header><code></code><translations></translations><inputs><input type="%s">all<options>all&#xD;broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input></inputs><script><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqtt.js</l></list></block><block s="doApplyExtension"><l>src_load(url)</l><list><l>libraries/mqttExtension.js</l></list></block><block s="doApplyExtension"><l>mqt_disconnect(broker)</l><list><block var="broker"/></list></block></script></block-definition><block-definition s="$cloudOutline MQTT response %&apos;broker&apos; topic %&apos;topic&apos; $nl reply %&apos;reply&apos; $nl $options-1-192-192-192 %&apos;$options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="292.22207031250036" collapsed="false">1. Subscribe buffer mode (boolean) Default (false) - received payload is returned as text. &#xD;&#xD;If true, subscribed, received payload returned as single column list of values in the range of 0 to 255..  Default (false) - it is returned as text&#xD;&#xD;2.  Published buffer mode (boolean).  Default (false) - the payload is published as text.&#xD;&#xD;If set to true then published payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name/#</input><input type="%repRing"></input><input type="%mult%s"></input></inputs><script><block s="doDeclareVariables"><list><l>resp</l><l>callbackTopic</l><l>error</l></list></block><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="topic"/><block s="reifyScript"><script><block s="doIf"><block s="reportVariadicGreaterThan"><list><block s="reportApplyExtension"><l>txt_indexof(sub, txt)</l><list><l>/@</l><block var="received topic"/></list></block><l>0</l></list></block><script><block s="doApplyExtension"><l>err_try(cmd, catch, err)</l><list><block s="reifyScript"><script><block s="doSetVar"><l>resp</l><block s="evaluate"><block var="reply"/><list><block var="received payload"/><block var="received topic"/></list></block></block></script><list></list></block><block s="reifyScript"><script><block s="doSetVar"><l>resp</l><block s="evaluate"><block var="reply"/><list></list></block></block></script><list></list></block><block var="error"/></list></block><block s="doApplyExtension"><l>err_reset</l><list></list></block><block s="doSetVar"><l>callbackTopic</l><block s="reportListItem"><l><option>last</option></l><block s="reportTextSplit"><block var="received topic"/><l>@</l></block></block></block><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="callbackTopic"/><block var="resp"/><list><l></l><l></l><block s="reportListItem"><l>2</l><block var="$options"/></block></list></custom-block></script><list></list></block></script><list><l>received payload</l><l>received topic</l></list></block><list><block s="reportListItem"><l>1</l><block var="$options"/></block></list></custom-block></script></block-definition><block-definition s="$cloudOutline MQTT request %&apos;broker&apos; topic %&apos;topic&apos; $nl response topic %&apos;rtopic&apos; payload %&apos;payload&apos; $nl on response run %&apos;callback&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="command" category="MQTT"><comment x="0" y="0" w="243" collapsed="false">The options are not required but can be filled if needed.&#xD;&#xD;1. Subscribe buffer mode (boolean) Default (false) - received payload is returned as text. &#xD;&#xD;If true, subscribed, received payload returned as single column list of values in the range of 0 to 255..  &#xD;&#xD;2. Inform response topic (boolean): If true, the response topic is added at the end of the call topic after @ sign. The default condition (true) response topic is added.&#xD;&#xD;3.  Published buffer mode (boolean).  Default (false) - the payload is published as text.&#xD;&#xD;If set to true then published payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%s">name2</input><input type="%mlt">hello</input><input type="%cmdRing"></input><input type="%mult%s"></input></inputs><script><block s="doDeclareVariables"><list><l>error</l><l>informTopic</l><l>topicCall</l></list></block><block s="doSetVar"><l>informTopic</l><block s="reportIfElse"><block s="reportIsA"><block s="reportListItem"><l>2</l><block var="options"/></block><l><option>Boolean</option></l></block><block s="reportListItem"><l>2</l><block var="options"/></block><block s="reportBoolean"><l><bool>true</bool></l></block></block></block><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><block var="broker"/><block s="reportJoinWords"><list><block var="rtopic"/></list></block><block s="reifyScript"><script><block s="doApplyExtension"><l>err_try(cmd, catch, err)</l><list><block s="reifyScript"><script><block s="doRun"><block var="callback"/><list><block var="received payload"/><block var="received topic"/></list></block></script><list></list></block><block s="reifyScript"><script><block s="doRun"><block var="callback"/><list></list></block></script><list></list></block><block var="error"/></list></block></script><list><l>received payload</l><l>received topic</l></list></block><list><block s="reportListItem"><l>1</l><block var="options"/></block></list></custom-block><block s="doIfElse"><block var="informTopic"/><script><block s="doSetVar"><l>topicCall</l><block s="reportJoinWords"><list><block var="topic"/><l>/</l><block s="reportJoinWords"><list><l>@</l><block var="rtopic"/></list></block></list></block></block></script><script><block s="doSetVar"><l>topicCall</l><block var="topic"/></block></script></block><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="topicCall"/><block var="payload"/><list><l></l><l></l><block s="reportListItem"><l>3</l><block var="options"/></block></list></custom-block></script></block-definition><block-definition s="$cloudOutline MQTT example response reporter payload %&apos;payload&apos; topic %&apos;topic&apos;" type="reporter" category="MQTT"><comment x="0" y="0" w="90" collapsed="false">This is a simple echo example.&#xD;Topic can be used to filter the response.</comment><header></header><code></code><translations></translations><inputs><input type="%mlt">hello</input><input type="%txt">name</input></inputs><script><block s="doReport"><block var="payload"/></block></script></block-definition><block-definition s="$cloudOutline MQTT request %&apos;broker&apos; topic %&apos;topic&apos; $nl response topic %&apos;rtopic&apos; payload %&apos;payload&apos; $nl $options-1-192-192-192 %&apos;options&apos;" type="reporter" category="MQTT"><comment x="0" y="0" w="343" collapsed="false">The response topic should be a unique value for each call e.g. use timer&#xD;&#xD;The options are not required but can be filled if needed&#xD;&#xD;1.  Timeout value - default is 3 seconds&#xD;&#xD;2. Subscribe buffer mode (boolean) Default (false) - received payload is returned as text. &#xD;&#xD;If true, subscribed, received payload returned as single column list of values in the range of 0 to 255..  Default (false) - it is returned as text&#xD;&#xD;3.  Inform response topic (boolean): If true, the response topic is added at the end of the call topic after @ sign. The default condition (true) response topic is added.&#xD;&#xD;4.  Published buffer mode (boolean).  Default (false) - the payload is published as text.&#xD;&#xD;If set to true then published payload is expected to be a single column list of values in the 0 to 255 range and is published to the broker as a buffer of bytes.&#xD;&#xD;Note:  If the payload is a list and you don&apos;t set the buffer mode option, it will be automatically be converted into JSON and sent as text</comment><header></header><code></code><translations></translations><inputs><input type="%s">broker.emqx.io<options>broker.emqx.io&#xD;mqtt.eclipseprojects.io&#xD;test.mosquitto.org&#xD;broker.xmqtt.net</options></input><input type="%s">name</input><input type="%s">name2</input><input type="%mlt">hello</input><input type="%mult%s"></input></inputs><script><block s="doDeclareVariables"><list><l>resp</l><l>semaphore</l><l>timer0</l><l>timeout</l><l>informTopic</l><l>topicCall</l></list></block><block s="doSetVar"><l>semaphore</l><l>0</l></block><block s="doSetVar"><l>timeout</l><block s="reportIfElse"><block s="reportIsA"><block s="reportListItem"><l>1</l><block var="options"/></block><l><option>number</option></l></block><block s="reportListItem"><l>1</l><block var="options"/></block><l>3</l></block></block><block s="doSetVar"><l>informTopic</l><block s="reportIfElse"><block s="reportIsA"><block s="reportListItem"><l>3</l><block var="options"/></block><l><option>Boolean</option></l></block><block s="reportListItem"><l>3</l><block var="options"/></block><block s="reportBoolean"><l><bool>true</bool></l></block></block></block><block s="doSetVar"><l>resp</l><l>timeout</l></block><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><block var="broker"/><block s="reportJoinWords"><list><block var="rtopic"/></list></block><block s="reifyScript"><script><block s="doSetVar"><l>resp</l><block var="received payload"/></block><block s="doSetVar"><l>semaphore</l><l>1</l></block></script><list><l>received payload</l><l>received topic</l></list></block><list><block s="reportListItem"><l>2</l><block var="options"/></block></list></custom-block><block s="doIfElse"><block var="informTopic"/><script><block s="doSetVar"><l>topicCall</l><block s="reportJoinWords"><list><block var="topic"/><l>/</l><block s="reportJoinWords"><list><l>@</l><block var="rtopic"/></list></block></list></block></block></script><script><block s="doSetVar"><l>topicCall</l><block var="topic"/></block></script></block><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><block var="broker"/><block var="topicCall"/><block var="payload"/><list><l></l><l></l><block s="reportListItem"><l>4</l><block var="options"/></block></list></custom-block><block s="doSetVar"><l>timer0</l><block s="reportDate"><l><option>time in milliseconds</option></l></block></block><block s="doWaitUntil"><block s="reportVariadicOr"><list><block s="reportVariadicEquals"><list><block var="semaphore"/><l>1</l></list></block><block s="reportVariadicGreaterThan"><list><block s="reportDifference"><block s="reportDate"><l><option>time in milliseconds</option></l></block><block var="timer0"/></block><block s="reportVariadicProduct"><list><block var="timeout"/><l>1000</l></list></block></list></block></list></block></block><custom-block s="$cloudOutline MQTT unsubscribe from %s topic %s"><block var="broker"/><block s="reportJoinWords"><list><block var="rtopic"/></list></block></custom-block><block s="doReport"><block var="resp"/></block></script></block-definition><block-definition s="MQTT Extension Examples" type="command" category="MQTT"><comment x="0" y="0" w="277" collapsed="false">Open (edit) this block to look at examples how to use the MQTT Extension blocks&#xD;&#xD;Background documentation:&#xD;https://github.com/pixavier/mqtt4snap&#xD;&#xD;Last source code version (mqtt.xml and mqttExtension.js):&#xD;https://gitlab.com/cymplecy/Snap/-/tree/master/libraries</comment><header></header><code></code><translations></translations><inputs></inputs><scripts><script x="24.333333333333485" y="371.8666666666658"><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><l>hello</l><list><l></l></list></custom-block></script><script x="22.333333333333485" y="271.19999999999976"><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><block s="reifyScript"><script><block s="doSayFor"><block var="payload"/><l>2</l></block></script><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><comment x="525.9999999999995" y="140.2" w="191" collapsed="false">To execute the examples, single click on blocks, following the corresponding steps.</comment><script x="28" y="1315.0333333333292"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br on response run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><block s="getTimer"></block><l>hello</l><block s="reifyScript"><script><block s="doSayFor"><block var="payload"/><l>2</l></block></script><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><script x="24.333333333333485" y="1013.2000000000016"><custom-block s="$cloudOutline MQTT response %s topic %s %br reply %repRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name/#</l><block s="reifyReporter"><autolambda><custom-block s="$cloudOutline MQTT example response reporter payload %mlt topic %txt"><block var="payload"/><block var="topic"/></custom-block></autolambda><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><script x="28" y="498.6999999999993"><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name1</l><block s="reifyScript"><script><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name2</l><block var="payload"/><list><l></l></list></custom-block></script><list><l>payload</l><l>topic</l></list></block><list><l></l></list></custom-block></script><script x="30" y="633.0333333333344"><block s="doSayFor"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name1</l><l>name2</l><l>hello</l><list><l></l><l></l><block s="reportBoolean"><l><bool>false</bool></l></block></list></custom-block><l>2</l></block></script><comment x="487.99999999999955" y="1311.6999999999966" w="224" collapsed="false">Step 2 bis: Send a request (timer acts as idCall) and do not wait for the answer</comment><comment x="487.99999999999955" y="1013.7000000000012" w="220" collapsed="false">Step 1: Activate the responder</comment><comment x="483.66666666666697" y="805.3666666666666" w="224" collapsed="false">Step 2 bis: Send a request and do not wait for the answer</comment><comment x="487" y="495.6999999999983" w="220" collapsed="false">Step 1: Activate the responder as a simple subscription</comment><comment x="484.99999999999955" y="374.1999999999991" w="222" collapsed="false">Step 2: Publish a message</comment><comment x="485.99999999999955" y="293.1999999999993" w="222" collapsed="false">Step 1: Subscribe to a topic</comment><comment x="482.99999999999955" y="215.2" w="223" collapsed="false">Step 0: Connect to the broker</comment><comment x="485" y="635.6999999999996" w="220" collapsed="false">Step 2: Send a request and wait the answer.</comment><script x="24.333333333333485" y="209.2"><custom-block s="$cloudOutline MQTT connect to %s %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><list><l></l></list></custom-block></script><comment x="24.333333333333485" y="152.2000000000001" w="239.99999999999997" collapsed="false">PubSub Hello World!</comment><script x="26.333333333333485" y="1139.1999999999978"><block s="doSayFor"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name</l><block s="getTimer"></block><l>hello</l><list><l></l></list></custom-block><l>2</l></block></script><comment x="486.99999999999955" y="1138.6999999999982" w="219.00000000000023" collapsed="false">Step 2: Send a request (timer acts as idCall) and wait for the answer</comment><script x="27" y="803.0333333333335"><custom-block s="$cloudOutline MQTT request %s topic %s %br response topic %s payload %mlt %br on response run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><l>name1</l><l>name2</l><l>hello</l><block s="reifyScript"><script><block s="doSayFor"><block var="payload"/><l>2</l></block></script><list><l>payload</l><l>topic</l></list></block><list><l></l><block s="reportBoolean"><l><bool>false</bool></l></block></list></custom-block></script><comment x="29" y="736.6999999999998" w="372.0000000000004" collapsed="false">Asynchronous client-server Hello World! with static response topic (name2)</comment><comment x="25.333333333333485" y="935.2000000000012" w="356.99999999999994" collapsed="false">Synchronous client-server Hello World! with dynamic response topic (timer)</comment><comment x="28" y="431.36666666666673" w="361.99999999999994" collapsed="false">Synchronous client-server Hello World! with static response topic (name2)</comment><comment x="27" y="1243.6999999999966" w="352.0000000000003" collapsed="false">Asynchronous client-server Hello World! with dynamic response topic (timer)</comment></scripts></block-definition><block-definition s="connect MQTT" type="command" category="other"><header></header><code></code><translations></translations><inputs></inputs><script><custom-block s="$cloudOutline MQTT connect to %s %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><list></list></custom-block><custom-block s="$cloudOutline MQTT subscribe to %s topic %s %br on each message run %cmdRing %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><block var="game server"/><block s="reifyScript"><script></script><list></list></block><list></list></custom-block></script></block-definition></blocks><stage name="Stage" width="400" height="300" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="false" hyperops="true" codify="false" inheritance="true" sublistIDs="false" id="1557"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAEsCAYAAADtt+XCAAAAAXNSR0IArs4c6QAACpNJREFUeF7t1bENAAAIwzD6/9P8kNnsXSyk7BwBAgQIEAg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iMCBAgQEBA/QIAAAQJJQEASmxEBAgQICIgfIECAAIEkICCJzYgAAQIEBMQPECBAgEASEJDEZkSAAAECAuIHCBAgQCAJCEhiMyJAgAABAfEDBAgQIJAEBCSxGREgQICAgPgBAgQIEEgCApLYjAgQIEBAQPwAAQIECCQBAUlsRgQIECAgIH6AAAECBJKAgCQ2IwIECBB4kRQBLXVTLWsAAAAASUVORK5CYII=</pentrails><costumes><list struct="atomic" id="1558"></list></costumes><sounds><list struct="atomic" id="1559"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites select="1"><sprite name="Sprite" idx="1" x="130" y="-110" heading="90" scale="0.4" volume="100" pan="0" rotation="1" draggable="false" hidden="true" costume="0" color="80,80,80,1" pen="tip" id="1564"><wear><ref mediaID="1"></ref></wear><costumes><list id="1565"><item><ref mediaID="Sprite_cst_Square"></ref></item><item><ref mediaID="Sprite_cst_Circle"></ref></item></list></costumes><sounds><list struct="atomic" id="1566"></list></sounds><blocks></blocks><variables><variable name="waiting for click?"><l>0</l></variable></variables><scripts><script x="11" y="10"><block s="receiveGo"></block><block s="hide"></block><block s="clear"></block><block s="gotoXY"><l>-1000</l><l>1000</l></block><block s="doSetVar"><l>ID</l><custom-block s="prompt %s options %mult%s"><l>Connect as player...</l><list><l>1</l><l>2</l><l>3</l><l>4</l></list></custom-block></block><block s="setEffect"><l><option>color</option></l><block s="reportListItem"><block var="ID"/><block s="reportNewList"><list><l>10</l><l>20</l><l>60</l><l>90</l></list></block></block></block><block s="doSetVar"><l>game server</l><block s="reportJoinWords"><list><l>PJ21-GameController-</l><custom-block s="ask %s"><l>What game are you trying to connect to?</l></custom-block><l>-</l><custom-block s="ask %s"><l>What is your room name?</l></custom-block></list></block></block><custom-block s="connect MQTT"></custom-block><block s="doSetVar"><l>bottom button y</l><l>-80</l></block><block s="gotoXY"><l>-100</l><l>80</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>L1</l></custom-block><block s="gotoXY"><l>-140</l><l>40</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>L2</l></custom-block><block s="gotoXY"><l>-100</l><l>0</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>L3</l></custom-block><block s="gotoXY"><l>-60</l><l>40</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>L4</l></custom-block><block s="gotoXY"><l>100</l><l>80</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>R1</l></custom-block><block s="gotoXY"><l>60</l><l>40</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>R2</l></custom-block><block s="gotoXY"><l>100</l><l>0</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>R3</l></custom-block><block s="gotoXY"><l>140</l><l>40</l></block><custom-block s="main button"></custom-block><custom-block s="create button %s"><l>R4</l></custom-block><custom-block s="bottom circular button"></custom-block><block s="gotoXY"><l>-40</l><block var="bottom button y"/></block><custom-block s="create button %s"><l>A</l></custom-block><custom-block s="bottom circular button"></custom-block><block s="gotoXY"><l>0</l><block var="bottom button y"/></block><custom-block s="create button %s"><l>M</l></custom-block><custom-block s="bottom circular button"></custom-block><block s="gotoXY"><l>40</l><block var="bottom button y"/></block><custom-block s="create button %s"><l>C</l></custom-block><custom-block s="bar button"></custom-block><block s="gotoXY"><l>-130</l><block var="bottom button y"/></block><custom-block s="create button %s"><l>LB</l></custom-block><custom-block s="bar button"></custom-block><block s="gotoXY"><l>130</l><block var="bottom button y"/></block><custom-block s="create button %s"><l>RB</l></custom-block></script><script x="217" y="18.75"><block s="receiveOnClone"></block><block s="show"></block></script><script x="433" y="93"><block s="receiveInteraction"><l><option>mouse-departed</option></l></block><block s="doSetVar"><l>waiting for click?</l><block s="reportBoolean"><l><bool>false</bool></l></block></block></script><script x="429" y="186"><block s="receiveInteraction"><l><option>mouse-entered</option></l></block><block s="doSetVar"><l>waiting for click?</l><block s="reportBoolean"><l><bool>true</bool></l></block></block><block s="doWaitUntil"><block s="reportVariadicOr"><list><block s="reportNot"><block var="waiting for click?"/></block><block s="reportVariadicAnd"><list><block s="reportMouseDown"></block><block s="reportTouchingObject"><l><option>mouse-pointer</option></l></block></list></block></list></block></block><block s="doIf"><block s="reportVariadicAnd"><list><block s="reportMouseDown"></block><block s="reportTouchingObject"><l><option>mouse-pointer</option></l></block></list></block><script><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><block var="game server"/><block s="reportNewList"><list><block var="ID"/><block s="reportGet"><l><option>name</option></l></block><l>press</l></list></block><list></list></custom-block><block s="changeEffect"><l><option>brightness</option></l><l>-25</l></block><block s="doWaitUntil"><block s="reportNot"><block s="reportVariadicAnd"><list><block s="reportMouseDown"></block><block s="reportTouchingObject"><l><option>mouse-pointer</option></l></block></list></block></block></block><custom-block s="$cloudOutline MQTT publish to %s topic %s payload %mlt %br $options-1-192-192-192 %mult%s"><l>broker.emqx.io</l><block var="game server"/><block s="reportNewList"><list><block var="ID"/><block s="reportGet"><l><option>name</option></l></block><l>release</l></list></block><list></list></custom-block><block s="changeEffect"><l><option>brightness</option></l><l>25</l></block></script><list></list></block></script></scripts></sprite><watcher var="bottom button y" style="normal" x="10" y="10.000000000000014" color="243,118,29" hidden="true"/><watcher scope="Sprite" var="waiting for click?" style="normal" x="10" y="31.00000200000001" color="243,118,29" hidden="true"/><watcher var="ID" style="normal" x="10" y="52.000004000000004" color="243,118,29" hidden="true"/><watcher var="game server" style="normal" x="10" y="73.000006" color="243,118,29" hidden="true"/></sprites></stage><variables><variable name="bottom button y"><l>-110</l></variable><variable name="ID"><l>1</l></variable><variable name="game server"><l>PJ21-GameController-game-room</l></variable></variables></scene></scenes></project><media name="Game Controller" app="Snap! 9.0, https://snap.berkeley.edu" version="2"><costume name="Square" center-x="137.5" center-y="42" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAABUCAYAAAChg9PYAAAAAXNSR0IArs4c6QAAAnZJREFUeF7t1LERQjEMBUG5WXqiDeqgICCB+bSgC9e5X7CjufOauY1HgACBpcB5zzyWG74TIEBgrph8ORAgQGArICZbQf8JEPgLiIlDIEAgERCThNEIAQJi4gYIEEgExCRhNEKAgJi4AQIEEgExSRiNECAgJm6AAIFEQEwSRiMECIiJGyBAIBEQk4TRCAECYuIGCBBIBMQkYTRCgICYuAECBBIBMUkYjRAgICZugACBREBMEkYjBAiIiRsgQCAREJOE0QgBAmLiBggQSATEJGE0QoCAmLgBAgQSATFJGI0QICAmboAAgURATBJGIwQIiIkbIEAgERCThNEIAQJi4gYIEEgExCRhNEKAgJi4AQIEEgExSRiNECAgJm6AAIFEQEwSRiMECIiJGyBAIBEQk4TRCAECYuIGCBBIBMQkYTRCgICYuAECBBIBMUkYjRAgICZugACBREBMEkYjBAiIiRsgQCAREJOE0QgBAmLiBggQSATEJGE0QoCAmLgBAgQSATFJGI0QICAmboAAgURATBJGIwQIiIkbIEAgERCThNEIAQJi4gYIEEgExCRhNEKAgJi4AQIEEgExSRiNECAgJm6AAIFEQEwSRiMECIiJGyBAIBEQk4TRCAECYuIGCBBIBMQkYTRCgICYuAECBBIBMUkYjRAgICZugACBREBMEkYjBAiIiRsgQCAREJOE0QgBAmLiBggQSATEJGE0QoCAmLgBAgQSATFJGI0QICAmboAAgURATBJGIwQIiIkbIEAgERCThNEIAQJi4gYIEEgExCRhNEKAgJi4AQIEEgExSRiNECBwxeSJgQABAluB85m5b0f8J0CAwA9P5qQ2coh4gwAAAABJRU5ErkJggg==" mediaID="1"/><costume name="Square" center-x="27.5" center-y="28" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAA4CAYAAABZjWCTAAAAAXNSR0IArs4c6QAAALJJREFUaEPt0rEVgDAQw9DLsuzEpkADK6igEDylduHzzzpmtvnpW+fM/dPbpuO+KptccsIF+pZCFFQpOTSTMJScEAVVSg7NJAwlJ0RBlZJDMwlDyQlRUKXk0EzCUHJCFFQpOTSTMJScEAVVSg7NJAwlJ0RBlZJDMwlDyQlRUKXk0EzCUHJCFFQpOTSTMJScEAVVSg7NJAwlJ0RBlZJDMwlDyQlRUKXk0EzC0LpmdmGvVyo9O4dteiDagEwAAAAASUVORK5CYII=" mediaID="Sprite_cst_Square"/><costume name="Circle" center-x="32" center-y="31.5" image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA/CAYAAABQHc7KAAAAAXNSR0IArs4c6QAABQ1JREFUeF7lm1uME1UYx3+n6860S6KiJK4SLyj7sGjiJbJqjIloRPRJTUTQgAJegAcTBaNoxFtUjLfEByCorEIU9QF5UiRRHozxRhQTXR7whgZZExU1YduZdXvs6Uyblt3pnJlOtz3teWvmO//v//3Ppef2CSahZGFGCs4D+iWcAZwMHC8grdxLyAF/A4cE/Azsy8PeDPzUaHqiEQ4kWC5cB1wDzAFOj+nnALAbeN+CHQLcmDiB1RIVYAQuTcESATcDmYTJZiW8mYfBHvgkKexEBMjBPAH3AHOTIhaCs0vCi2nYWa+/ugRw4BzgceD6eonErP8usNaGb2PWJ7YADjwIPBnXccL1HrLhqTiYkQXIwmkCNgm4Oo7DRtWR8IGEOzPwSxQfkQTIwpUCtgrvb6zlioRDEhZl4ENdctoCOLAA2KYL3GS7hTa8pcNBS4AsLErBFh3AVrHJw+IMbA3jEyqA483w28OAWvT7DTaof4p4CyEXBoCP1cquRQOsSctfOV5mwRdBhoE9YBimTPUqzjIx+ArOQ4dhoBeOTBRHoAAOvA4sNjz4Ev0tNtyqLYCJk15YQwVNiuN6gISMC/uB6WGghn0/aEGfgGwl73ECOPA08IBhwenSXWfDmkABRmB6F/wK8fcIukyaZCfH4NQeOFjyX9UDHFgH3N8kcpPl9hm7ooeXBZBwjAt/AMdNFpMm+fnHgmkC/lP+ywJkYWkKXm0SqUl1m4dlGdhcJUAOdrbaFrdRqqitcxrmlQX4F060ve7fMcWBacfCn8UhYNhWN6lGKm6ZiwLkYL2AFUkhm4AjYUMaVhYFcOFLCReaQDwpjgL2WDC7NATUhUN3UuCG4IwWDlItkYOzBHxvCOl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