Variables Blocks

Create Variables

{"func":"blockControlScriptVar"}

Script Variables

"Script Variables" allows you to define variables that only exist within a given script or function.

Parameters:

None.

Related Blocks:
{"func":"blockVarPropSet"}

Sample Code:
{"func":"blockControlScriptVar","cat":"var","label":"script variables{varargs:valueScriptVar}","values":[{"type":"wrapper","func":"valueScriptVar","name":"var"}],"next":{"func":"blockVarSet","values":[{"type":"string","value":"var"},{"type":"string","value":"0"}],"next":{"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"var"},{"type":"number","value":"1"}]}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueScriptVar","name":"var"},{"type":"string","value":"is 10"}]}}}} Add to my Backpack


{"func":"blockControlScriptVar"}

Variables locales

"Variable locales" te permite definir variables que existen únicamente dentro de una determinada secuencia de comandos o función.

Parameters:

Ninguno.

Related Blocks:
{"func":"blockVarPropSet"}

Sample Code:
{"func":"blockControlScriptVar","cat":"var","label":"script variables{varargs:valueScriptVar}","values":[{"type":"wrapper","func":"valueScriptVar","name":"var"}],"next":{"func":"blockVarSet","values":[{"type":"string","value":"var"},{"type":"string","value":"0"}],"next":{"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[{"func":"blockVarChangeBy","values":[{"type":"string","value":"var"},{"type":"number","value":"1"}]}],"next":{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueScriptVar","name":"var"},{"type":"string","value":"is 10"}]}}}} Add to my Backpack


Variable Operators

{"func":"blockVarPropSet"}

Set

"Set" allows you to adjust the value of a variable. The first parameter indicates the name of the variable, the second parameter indicates the name of the Actor where the variable resides, and the third parameter indicates the new value for the variable.

Parameters:

Variable: This parameter should be the name of one of your variables.

Actor: This parameter should be the name of the Actor where the variable you want to set resides.

New Value: The value of the specified variable in the specified Actor will be set to this value.

Related Blocks:
{"func":"valueVarPropGet"} ,     {"func":"blockVarSet"} ,     {"func":"blockVarChangeBy"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockVarSet","values":[{"type":"string","value":"NumLives"},{"type":"string","value":"3"}]}} Add to my Backpack


{"func":"valueVarPropGet"}

Property

"Property" returns the specified property of the specified Actor.

Parameters:

Property: This variable is the property you want to access.

Actor: This variable is the name of the Actor whose property you want to access.

Related Blocks:
{"func":"blockVarPropSet"} ,     {"func":"blockVarSet"} ,     {"func":"blockVarChangeBy"}

Sample Code:
{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueVarPropGet","values":[{"type":"string","value":"Playing"},{"type":"string","value":"stage"}]}],"containers":[{"func":"blockVarShow","values":[{"type":"string","value":"MyScore"}]},{"func":"blockVarHide","values":[{"type":"string","value":"MyScore"}]}]} Add to my Backpack


{"func":"blockVarSet"}

Set

"Set" allows you to adjust the value of a variable. The first parameter indicates the name of the variable, and the second parameter indicates the new value for the variable.

Parameters:

Variable: This parameter should be the name of one of your variables.

New Value: The value of the specified variable in the specified Actor will be set to this value.

Related Blocks:
{"func":"blockVarPropSet"} ,     {"func":"valueVarPropGet"} ,     {"func":"blockVarChangeBy"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueVar","name":"Playing"}],"containers":[{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueVar","name":"NumLives"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarPropSet","values":[{"type":"string","value":"Playing"},{"type":"string","value":"self"},{"type":"string","value":"false"}]}]}]}} Add to my Backpack


{"func":"blockVarChangeBy"}

Change

"Change" allows you to increment the specified variable by the specified amount.

Parameters:

Variable: This parameter should be the name of one of your variables.

Increase: This parameter is the number you want to increase your variable by. Use a negative number to make the number smaller.

Related Blocks:
{"func":"blockVarPropSet"} ,     {"func":"valueVarPropGet"} ,     {"func":"blockVarSet"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockVarChangeBy","values":[{"type":"string","value":"MyScore"},{"type":"number","value":"1"}]}} Add to my Backpack


{"func":"blockVarShow"}

Show Variable

"Show Variable" makes the specified variable appear on the Stage.

Parameters:

Variable: This parameter should be the name of one the variable you want to show up on the Stage.

Related Blocks:
{"func":"blockVarHide"}

Sample Code:
{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueVarPropGet","values":[{"type":"string","value":"Playing"},{"type":"string","value":"stage"}]}],"containers":[{"func":"blockVarShow","values":[{"type":"string","value":"MyScore"}]},{"func":"blockVarHide","values":[{"type":"string","value":"MyScore"}]}]} Add to my Backpack


{"func":"blockVarHide"}

Hide Variable

"Hide Variable" makes the specified variable disappear on the Stage.

Parameters:

Variable: This parameter should be the name of one the variable you want to hide.

Related Blocks:
{"func":"blockVarShow"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockVarHide","values":[{"type":"string","value":"MyScore"}]}} Add to my Backpack


{"func":"blockVarPropSet"}

Fijar

"Fijar" te permite ajustar el valor de una variable. El primer parámetro indica el nombre de la variable, el segundo parámetro indica el nombre del Actor que contiene la variable y el tercer parámetro es el nuevo valor de la variable.

Parameters:

Variable: este parámetro es el nombre de una de tus variables.

Actor: este parámetro es el nombre del Actor que contiene la variable que deseas ajustar.

Nuevo valor: el valor de la variable especificada del Actor tendrá este nuevo valor.

Related Blocks:
{"func":"valueVarPropGet"} ,     {"func":"blockVarSet"} ,     {"func":"blockVarChangeBy"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockVarSet","values":[{"type":"string","value":"NumLives"},{"type":"string","value":"3"}]}} Add to my Backpack


{"func":"valueVarPropGet"}

Propiedad

"Propiedad" devuelve la propiedad especificada del Actor indicado.

Parameters:

Propiedad: esta variable es la propiedad a la que deseas acceder.

Actor: el nombre del Actor cuya variable deseas conocer.

Related Blocks:
{"func":"blockVarPropSet"} ,     {"func":"blockVarSet"} ,     {"func":"blockVarChangeBy"}

Sample Code:
{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueVarPropGet","values":[{"type":"string","value":"Playing"},{"type":"string","value":"stage"}]}],"containers":[{"func":"blockVarShow","values":[{"type":"string","value":"MyScore"}]},{"func":"blockVarHide","values":[{"type":"string","value":"MyScore"}]}]} Add to my Backpack


{"func":"blockVarSet"}

Fijar

"Fijar" te permite ajustar el valor de una variable. El primer parámetro indica el nombre de la variable y el segundo parámetro indica el nuevo valor de la variable.

Parameters:

Variable: este parámetro es el nombre de una de tus variables.

Nuevo valor: el nuevo valor que tendrá la variable indicada del Actor.

Related Blocks:
{"func":"blockVarPropSet"} ,     {"func":"valueVarPropGet"} ,     {"func":"blockVarChangeBy"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueVar","name":"Playing"}],"containers":[{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueVar","name":"NumLives"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockVarPropSet","values":[{"type":"string","value":"Playing"},{"type":"string","value":"self"},{"type":"string","value":"false"}]}]}]}} Add to my Backpack


{"func":"blockVarChangeBy"}

Cambiar

"Cambiar" te permite incrementar la variable especificada en la cantidad indicada.

Parameters:

Variable: este parámetro es el nombre de una de tus variables.

Incremento: este parámetro es la cantidad en que quieres aumentar el valor de tu variable. Utiliza un número negativo para disminuir el valor.

Related Blocks:
{"func":"blockVarPropSet"} ,     {"func":"valueVarPropGet"} ,     {"func":"blockVarSet"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"AddPoint"}],"next":{"func":"blockVarChangeBy","values":[{"type":"string","value":"MyScore"},{"type":"number","value":"1"}]}} Add to my Backpack


{"func":"blockVarShow"}

Mostrar variable

"Mostrar variable" hace que la variable especificada aparezca en el escenario.

Parameters:

Variable: este parámetro es el nombre de una de las variables que deseas que aparezca en el escenario.

Related Blocks:
{"func":"blockVarHide"}

Sample Code:
{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueVarPropGet","values":[{"type":"string","value":"Playing"},{"type":"string","value":"stage"}]}],"containers":[{"func":"blockVarShow","values":[{"type":"string","value":"MyScore"}]},{"func":"blockVarHide","values":[{"type":"string","value":"MyScore"}]}]} Add to my Backpack


{"func":"blockVarHide"}

Ocultar variable

"Ocultar variable" hace que la variable especificada desaparezca del escenario.

Parameters:

Variable: este parámetro es el nombre de una de las variables que deseas ocultar.

Related Blocks:
{"func":"blockVarShow"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockVarHide","values":[{"type":"string","value":"MyScore"}]}} Add to my Backpack