turtlestitch/libraries/make-variables.xml

1 wiersz
7.4 KiB
XML
Czysty Zwykły widok Historia

<blocks app="Snap! 6, https://snap.berkeley.edu" version="1"><block-definition s="create %&apos;_scope&apos; var %&apos;_names&apos;" type="command" category="variables"><comment x="0" y="0" w="146" collapsed="false">This block creates new variables on the selected scope: global (for all sprites), sprite (for this sprite only) or script (only for that blocks stack) with the names given (in &apos;names&apos; list).&#xD;&#xD;If there is already a variable with that name in that scope, it does nothing: no errors and no overwrites.</comment><header></header><code></code><translations>pt:cria as variáveis _ _&#xD;ca:crea les _ variables _&#xD;es:crear las _ variables _&#xD;de:erstellen _ var _&#xD;</translations><inputs><input type="%s" readonly="true">global<options>global&#xD;sprite&#xD;script</options></input><input type="%mult%txt"></input></inputs><script><block s="doWarp"><script><block s="doForEach"><l>_item</l><block var="_names"/><script><block s="doApplyExtension"><l>var_declare(scope, name)</l><list><block var="_scope"/><block var="_item"/></list></block></script></block></script></block></script></block-definition><block-definition s="delete var %&apos;_names&apos;" type="command" category="variables"><comment x="0" y="0" w="217" collapsed="false">This block deletes all the variables with the names given (inside input list).&#xD;&#xD;Each name will make only one variable deletion, and this will be the variable found following the scope order: &apos;script&apos; -&gt; &apos;sprite&apos; -&gt; &apos;global&apos;.&#xD;&#xD;If we have a &quot;testing&quot; sprite variable and also a &quot;testing&quot; global one, deleting &quot;testing&quot; will delete only the sprite one (Yes! we can also do &quot;delete var (testing, testing)&quot; to delete both.&#xD;&#xD;If one variable does not exists (in any scope) an error happens, stopping block action in that point. You can check it before with the &quot;does var (name) exists?&quot;block. </comment><header></header><code></code><translations>pt:remove as variáveis _&#xD;ca:esborra les variables _&#xD;es:borrar variables _&#xD;de:löschen var _&#xD;</translations><inputs><input type="%mult%txt"></input></inputs><script><block s="doWarp"><script><block s="doForEach"><l>_item</l><block var="_names"/><script><block s="doApplyExtension"><l>err_ignore</l><list><custom-block s="var %s"><block var="_item"/></custom-block></list></block><block s="doApplyExtension"><l>var_delete(name)</l><list><block var="_item"/></list></block></script></block></script></block></script></block-definition><block-definition s="set var %&apos;_name&apos; to %&apos;_value&apos;" type="command" category="variables"><comment x="0" y="0" w="240.4931640625" collapsed="false">This block sets the given value (last input) to the variable named with the name givent (var input).&#xD;&#xD;It looks for that variable following the scope order &apos;script&apos; -&gt; &apos;sprite&apos; -&gt; &apos;global&apos; (the first match it finds).&#xD;&#xD;If that variable does not exist (in any scope) an error happens, stopping their script. You can check it before using the &quot;does var (name) exists?&quot; block. </comment><header></header><code></code><translations>ca:assigna a _ el valor _&#xD;es:asignar a _ el valor _&#xD;pt:altera _ para _&#xD;de:setze var _ auf _&#xD;</translations><inputs><input type="%s"><options>§_getVarNamesDict</options></input><input type="%s"></input></inputs><script><block s="doApplyExtension"><l>var_set(name, val)</l><list><block var="_name"/><block var="_value"/></list></block></script></block-definition><block-definition s="var %&apos;_name&apos;" type="reporter" category="variables"><comment x="0" y="0" w="178.00000000000003" collapsed="false">This block reports the value of the variable with the name given.&#xD;&#xD;It looks for that variable following the scope order &apos;script&apos; -&gt; &apos;sprite&apos; -&gt; &apos;global&apos; (the first match it finds).&#xD;&#xD;If that variable does not exist (in any scope) an error happens, stopping their script. You can check it befo