Skip to content

Latest commit

 

History

History
70 lines (41 loc) · 2.27 KB

File metadata and controls

70 lines (41 loc) · 2.27 KB

variable

English

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 the variableshowall() function to show in the log all the created variables of the script and their values.

Portuguese

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ção variableshowall() 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

  1. Create a script variable named myVariableName and set it's value to 1.
variable(myVariableName, 1)
  1. Create a script variable named messageText and set a text as its value, then get the variable value using getsetting() and store in the $textVar, lastly show the variable value using the messagebox() function.
variable(messageText, this is a text value for the variable)

$textVar = getsetting(scriptVariables/messageText)

messagebox($textVar)
  1. 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)
  1. Decrement the value of the variable named triesDeposit.
variable(triesDeposit, --)