3 new variable types
There still many things that PB has to improve in. These three variables may seem very complex but they can be useful while creating our games:
Local Variables · String Variables · Object Variables
Local VariablesLocal Variables are unique for each command prompt and return it's value to 0 when the command prompt ends. The point for this variable is that the same name for a local variable running at the same time on different command prompts will work well and can have different values each other at the same time :/
String VariablesThis may be the most complex variables but probably required. String Variables are variables that can't operate. (Example: You can't do string variable + 1) and can contain letters and numbers
Example of use:
<string variable player_name>Antikore
<npc 1>Hello, [string variable player_name]. Welcome to your new house!
This will return an NPC talking "Hello, Antikore. Welcome to your new house"
String variables also will require some new commands and conditionals like:
Length of (String variable)
if length of string variable player_name > 16 | length of string variable player_name < 4
{
<player 1>Your name should contain between 4 and 16 characters
}
Also to check what is the content:
if <string variable password>VivaVegetta777
{
<npc 1>You can continue [string variable player_name].
}
Other suggestion for working with string variables
- "Letter X of (String variable)" conditional
- "(String variable) contains letter X" conditional
- A textbox to write in while in game
- "(String variable) is empty" conditional
- "Downcase/Uppercase (String variable)" command
Object VariablesThis can be in 2 ways:
- Object string variable
- Object variable
Object variables act as the local variables but will not return at 0 when a command prompt is finished and will be unique for each object. For example, There are two custom gruppies, when you damage one, the next command prompt is executed
if percent chance = 50
{
object variable anger + 1
}
if object variable anger = 3
{
enemy = enemy 15
}
This variable is only detected by the gruppy we have damaged. With object variables, the first gruppy can have anger = 2 and the other can have anger = 1 simultaneously.
Thank you for reading