Definition #
A static variable is a variable that is allocated a fixed amount of memory space and retains its value across function calls. The static variable has a static value that stays the same and can be called in RTILA software to get the static value it contains.
Add & configure Static Variables #
Add #
To add a static variable, you will need to go to the variables tab of a new command interface and search for it. After finding the variable and adding it, you can edit its value and set some other configurations.
Configure #
- This refers to the ID of the variable which you can call later to get the value of this variable
- Edit the name of the static variable describing what value would it contain
- Here you can enter the fixed value that will be stored in the static variable
- A sequence of characters that forms a search pattern. For example, you can use regex to find all email addresses in a document or to extract all the numbers in a string.
- This allows you to combine different pieces of data or text
- Enabling text spinning in a static var means allowing a static variable to store multiple versions of the same text, each with different wordings and phrasings, so that when the variable is called in a program or script, a different version of the text is returned each time. Here is the syntax on how to enter your strings/words so that they can be spinned:
{Word1|Word2|Word3}
How to call a Static variable #
You can use the fixed value stored in a static variable with two methods :
1. Call the variable using the “window.localStorage[‘RTILA_VAR_ID‘])” in a javascript command. #
There is an example of using static variables in a javascript code that communicates with CHAT GPT, You can see how we called the static variables using their IDs shown in the previous section of this documentation.
Var = JSON.parse(window.localStorage['RTILA_VAR_ID']);
2. Inside other commands or Properties, using the syntax {{VariableName}} #
And here is another example showing the variable called using the “{{VariableName}}” method inside another command.
In this example, we stored the login credentials of a Facebook account in two static variables named: “email” and “password”, then called these two variables in another populate text field command which will take the value of these variables and populate the text in the email and passwords fields using the second method of calling a variable in RTILA Studio {{email}}, {{password}}