Create and set value to script variables while the Cavebot is running, besides setting a value, it's possible to increment/decrement the current value, as shown in the examples.
The script variables created with this function are accessed using the
getsetting()function, see examples below.
You can use thevariableshowall()function to show in the log all the created variables of the script and their values.
Criar e setar valores a variaveis do script enquanto o Cavebot está rodando, além de poder setar um valor, é possível incrementar/decrementar o valor atual, como mostrado nos exemplos.
As variáveis do script criadas com essa função são acessadas usando a função
getsetting(), veja os exemplos abaixo.
Você pode usar a funçãovariableshowall()para mostrar no log todas as variáveis do script criadas e seus valores.
variable(name, value)
- Parameters
name:name of the variable to be created/set value.value:value to set to the variable, only strings/alphanumeric characters.
Return Value
Returns true upon success, or false otherwise.
Examples
- Create a script variable named myVariableName and set it's value to
1.
variable(myVariableName, 1)- Create a script variable named messageText and set a
textas its value, then get the variable value usinggetsetting()and store in the$textVar, lastly show the variable value using themessagebox()function.
variable(messageText, this is a text value for the variable)
$textVar = getsetting(scriptVariables/messageText)
messagebox($textVar)- Increment the value of the variable named triesDeposit and log the new value.
variable(triesDeposit, ++)
# checking the new value
$var = getsetting(scriptVariables/triesDeposit)
log($var)- Decrement the value of the variable named triesDeposit.
variable(triesDeposit, --)