A Variable is simply somewhere to store numbers or values so that they can be referenced later. There are two types of variables in Smile Game Builder: Basic and Advanced.
I’m going to be as comprehensive as possible with this series. However, you can skim through the parts you already know and, as the series progresses, skip to the parts you’d like to know more about.
Basic VariablesBasic Variables are used for simple operations to directly affect the targeted Variable No. with whatever number is set in its Value.
You can assign a fixed value to the variable with Put into variable box as-is. Another value can then be added to or subtracted from this value, or multiplied by or divided by it with another Variable Box referencing it. And this new value is placed into the variable.
Besides the usual math operators, you can also add a random number in variable box between 1 and whatever number is placed in Value up to a maximum 999,999. This does exactly as it states and adds the random number to the variable; it doesn’t create a random number (that’s in the Advanced Variables section).
The basic Variable Box is primarily used for setting up quick, simple variables and manipulating them with the operators.
ALL values are fixed and can’t be directly influenced by other variables. It can kind of be done, but I’ll cover that in a later tutorial.
In the Advanced Variable Box Op. section, you can do much more with variables (as you can see in Fig. 3 below).These are values specific to various parts of the game and they can be stored and manipulated in the same way as basic variables. And we’ll go through each of them over the course of this tutorial.
This is where you set the variable you want to use. The maximum allowed variables in a single game is 999, although you can reuse other established variables on different maps if you’re not using them elsewhere on the same map.
Variable Box is used and referenced the same as in the Basic Variables. There is another option in the dropdown, Number Displayed in Variable Box, but we won’t worry about that for some time.
This section is for selecting the type of operator to use with the variable. In addition to the usual math operators, you (obviously) set the variable’s value with Assign.
There’s one other operator, Substitute Divided Remainder, which divides the variable’s value by the assigned number and uses the remainder as the value. I covered modulo operations already in a previous tutorial.
You can use advanced variables to set "fixed" variables instead of the basic Variable Box. The two are the same and do the same thing.
Personally, I like using the basic Variable Box if my variables are simple values not reliant on anything except for fundamental calculations. And then I use the Advanced Variable Box for more complex operations. It may be just a matter of preference when setting up the basics for more advanced stuff later.
In Variables Part 2
I’ll continue the series in the next article and, over the course of the tutorial, will go through each one in turn. Included will be explanations on how and where they can be used, along with examples as necessary.
I covered Advanced Variables in my video series in Tutorial #11 (as well as some later videos), so aim to expand on that in this series, with additional video references as they crop up.
Although I won’t go into as much detail (except perhaps in a future article), I’ll utilize the event’s Conditions in conjunction with variables. And I’ll share some of the techniques I’ve learned in the process, such as how to properly set up a cut scene using only variables.