Author Topic: Comparing game variables to one another.  (Read 1855 times)

McPopato

  • A very inconsistent user.
  • Level 4: Sparr
  • *
  • Posts: 51
  • Hello. I do projects sometimes.
    • View Profile
Comparing game variables to one another.
« 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.
« Last Edit: May 31, 2020, 07:22:47 PM by McPopato »
"Friends are people who come and go, appreciate them when they're here and remember them when they're gone." - Some guy probably.

McPopato

  • A very inconsistent user.
  • Level 4: Sparr
  • *
  • Posts: 51
  • Hello. I do projects sometimes.
    • View Profile
Re: Comparing game variables to one another.
« Reply #1 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.
"Friends are people who come and go, appreciate them when they're here and remember them when they're gone." - Some guy probably.

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Comparing game variables to one another.
« Reply #2 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.
« Last Edit: May 31, 2020, 11:45:08 PM by Gizgord »

Antikore

  • Developing Mortal Theater at day, developing depression at night.
  • Level 22: Trex
  • *
  • Posts: 2020
  • Enjoying Platform Builder from the very start
    • View Profile
    • PBuilder Resources
Re: Comparing game variables to one another.
« Reply #3 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.
Sorry because my English is not very good because I'm Spanish ;) :P

McPopato

  • A very inconsistent user.
  • Level 4: Sparr
  • *
  • Posts: 51
  • Hello. I do projects sometimes.
    • View Profile
Re: Comparing game variables to one another.
« Reply #4 on: June 01, 2020, 10:31:57 AM »
I've understood my mistake. Thank you all for your assistance regardless!
"Friends are people who come and go, appreciate them when they're here and remember them when they're gone." - Some guy probably.

War

  • "The top player is here!"
  • Level 20: Nobom
  • *
  • Posts: 1490
    • View Profile
    • My website
Re: Comparing game variables to one another.
« Reply #5 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.
Hey, wassup wassup? My name is Warrior555MainsGanon (but just call me War) and I'm the main guy behind Megaman Zero Online and the upcoming Matt's Adventure! I don't speak often here but I'm a very friendly lad so if you wanna talk, don't hesitate!

Antikore

  • Developing Mortal Theater at day, developing depression at night.
  • Level 22: Trex
  • *
  • Posts: 2020
  • Enjoying Platform Builder from the very start
    • View Profile
    • PBuilder Resources
Re: Comparing game variables to one another.
« Reply #6 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
Sorry because my English is not very good because I'm Spanish ;) :P