In this page, we'll be teaching you about one of the fundamental commands for game development. Switches and Variables.

 

 

What is a Switch?

Switches are similar to light switches that we use in the real life. They are basically variables that can only return two values, true (ON) or false (OFF). What happens when a Switch is ON or OFF depends on what you want them to do.

 

 

What are Variables?

Variables are containers that store values and information. There's no limitation to what kind of information you can store in a Variable unlike Switches. There are two different types: Number and Text variables.

 

It's important to remember that Number variables can only store integers, meaning you cannot input double or float digits (ex. 1.05). This also means you cannot input anything that isn't a number. Meanwhile, Text variables stores strings. This means you can put anything to it and it's considered as just plain text.

 

What are uses for Number Variables?

Here are some examples where you can use number variables:

 

What are uses for Text Variables?

Here are some examples where you can use text variables:

 

It is important to note that Switches and Variables can also contain Game Data, like what language is the game currently on, and there are many uses for them.

 

What are the differences between Local, Global and Persistent?

Visual Novel Maker allows you to control three types of Switches and Variables: Local, Global and Persistent.

 

 

For example, in RPGs we have Treasure Chests. To create a Treasure chest, what you would want to do is that once the player talks to it, it will activate a switch so when you talk to it again, it will say, "You already opened it!" Now, that chest is going to remain in that state forever.  It would be silly to use a Global Switch for that when you could just use a Local Switch. This way, your Global Switch list won't get clogged up with useless one time only interactions. Global Switches and Variables should only be reserved for important bits of your game like flags or affection points.

 

What about Persistent Variables and Switches? Think of it as a way to store values where if the player unlocks extras like Developer Notes, New Game+ and so on without needing a save file.

 

By themselves, they cannot do much except store information. They might seem intimidating at first, but once you try a few exercises, you will quickly learn that they are your best friends. This is where Conditions would be useful so make sure to read it!