How to use Variables

by solostrike

<< All Articles | Print


If you do not know what variables are, (probably why you are reading this, right?) then you should read this paragraph. Variables hold number values that can be manipulated by the author. The value can be: added, subtracted, multiplied, and divided. With the above options, you can also get a random variable and form a percent.
Creating Variables

Lets start off with creating a variable. Variables can be a maximum of ten characters long. Variables can have a maximum and minimum value (number value) and a starting value. When entering these values, keep in mind that leaving the starting value “blank” defaults to zero and leaving the maximum and minimum values “blank” means no restriction at all.

Variable Events

Variables can have “events” exactly like the default item effect. Variable events can happen when the variable value goes over or below an entered value. When a variable “event” happens, you can make the player go to a certain page. For example, if a MONEY variable goes below 1, you can make the player go to a page that says, “You do not have any money left”. If a MONEY variable goes above 100, you can make the player go to a page, “You have over $100”.

Changing Variables in-game

Variable values change throughout the game depending on the game and the author. If you have a game about betting, odds, etc., many variables will be used and the variable values will change often. If you have a game about sports, you may have very few variables along with few variable changes. To change the value of a variable, you need to open a page created in the game, add a link to another page, and then click the variable changes link. This link is displayed as a plus (+) on top of a minus (-) image. By clicking this link, a window will open and will display all the variables currently in the game. Beside each variable, a drop down menu will be displayed with the default text of “none”. When you click this drop down box, you will be given six options: addition, subtraction, multiplication, division, percentage and reset. You will have text box available to you once an option is selected. Also, you will notice that a “Count Multiple” check box is enabled when an option is selected. This will be discussed later.

Choosing the Change
To change the value of a variable, select an option from the drop down menu, add the value that will be calculated, and the variables’ value will be changed when that particular link is selected during the game. For example, you would like the player of the game to lose 5 LIFE when they select a link that makes them bleed in the game, in the variable changes menu, you select “subtract” from the drop down menu corresponding to the LIFE variable and input “5” in the text box. This means, subtract 5 LIFE when the link is selected.
You’ve probably figured out what “Count Multiple” is, or do not know what it is and are wondering why I haven’t mention it. I’ll go with the latter and say that “Count Multiple” means that the variable change happens EVERY single time the link is selected.  Going with the previous example, if you select “Count Multiple” for the change of the LIFE variable, every time the player clicks the link that makes him bleed, he loses 5 LIFE. If the “Count Multiple” is unchecked, the player loses 5 life the FIRST time he selects the link. Clicks after the first click do not count in any LIFE loss.

You now know the basics about using Variables!