Platform Builder Forums

Main => Suggestions => Topic started by: Antikore on December 28, 2018, 03:10:13 PM

Title: Three new types of variables
Post by: Antikore on December 28, 2018, 03:10:13 PM
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 Variables
Local 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 Variables
This 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:
Code: [Select]
<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)
Code: [Select]
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:
Code: [Select]
if <string variable password>VivaVegetta777
{
<npc 1>You can continue [string variable player_name].
}
Other suggestion for working with string variables

Object Variables
This can be in 2 ways:

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
Code: [Select]
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


Title: Re: Three new types of variables
Post by: CGM on December 29, 2018, 02:19:41 AM
Interesting... A bit over my head, but okay.