playMaker

Author Topic: Checking against a String Variable  (Read 1071 times)

SlimeyOoze

  • Playmaker Newbie
  • *
  • Posts: 10
Checking against a String Variable
« on: February 23, 2022, 09:55:01 AM »
Hello,

I'm trying to get 1 Switch Event check against 2 possible answers but can't see how?

In an if statement I would do

if(mySwitch == "unassigned" || mySwitch == "Left"
{
   ...Then do this
}

I guess I'm asking how I would go about placing an "OR" in Play Maker? either via a Switch or If Statement.

Currently I have a Switch event checking against UP, DOWN, LEFT & RIGHT but at the start the string variable isn't unassigned.

Thank You.


« Last Edit: February 23, 2022, 09:57:21 AM by SlimeyOoze »

SlimeyOoze

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Checking against a String Variable
« Reply #1 on: February 23, 2022, 10:04:08 AM »
Would it be "String Compare"?

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Checking against a String Variable
« Reply #2 on: February 23, 2022, 05:21:54 PM »
Heya,

Yes String compare will be the one to use here as I can't remember if there is a switch action for strings.  You'll need the first string compare to check against the value Unassigned with a match flowing to another state.  Otherwise it will go to the second compare checking against Left and having it go to where you want from there.

SlimeyOoze

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Checking against a String Variable
« Reply #3 on: February 23, 2022, 06:01:29 PM »
Thank you Athin