Platform Builder Forums

Help and Support => Working with Platform Builder => Topic started by: McPopato on May 31, 2020, 07:22:38 PM

Title: Comparing game variables to one another.
Post by: McPopato on May 31, 2020, 07:22:38 PM
I ran a hypothetical in which:
if game var A = game var B
+Functions
if game var A = 1
+FunctionsA
with both variables being equal to 1.
Only FunctionsA worked, even though they're literally the same command.
Can someone help me with this? It's making some testing fairly difficult.
Title: Re: Comparing game variables to one another.
Post by: McPopato on May 31, 2020, 07:36:29 PM
Answered my own question.
To compare variables to one another:
if game var a = [game var b]
using
if game var a = game var b
doesn't work for some reason.
Title: Re: Comparing game variables to one another.
Post by: Gizgord on May 31, 2020, 11:44:54 PM
when you put a variable in brackets, command prompt reads its value, e.g. 1, 3, 15, and so on.

Code: [Select]
if game var a = game var bthis command doesn't work because variables can only have numerical values, and "game var b" is obviously verbal.
Title: Re: Comparing game variables to one another.
Post by: Antikore on June 01, 2020, 09:44:34 AM
Actually conditionals are like commands. The second value must be numerical, bracketed or an special token you can search on the CP website, otherwise cp won't understand.

Any checking or setting to/with another variable or thing must use bracketings.
Title: Re: Comparing game variables to one another.
Post by: McPopato on June 01, 2020, 10:31:57 AM
I've understood my mistake. Thank you all for your assistance regardless!
Title: Re: Comparing game variables to one another.
Post by: War on June 01, 2020, 11:08:26 AM
I've understood my mistake. Thank you all for your assistance regardless!
No problem, I am myself very happy that you are back on PB. We missed you.
Title: Re: Comparing game variables to one another.
Post by: Antikore on June 01, 2020, 11:48:44 AM
I've understood my mistake. Thank you all for your assistance regardless!
No problem. Its good to have you back