playMaker

Author Topic: Int Switch (Else or <>)  (Read 4114 times)

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Int Switch (Else or <>)
« on: April 05, 2015, 12:23:53 PM »
Using the action 'int switch' you have to tell it the number such as 0, 1, 2.  So what if you want to do something with 0 and something else with >0?  There is not greater than or less than or even an else. 

At the very least there should be an 'else'.  So you could count the number of tags and get a number.  if the number is 0, you go to next state.  if number is >0 (or else) you can destroy all of the tagged items.  If you try to destroy tags and there are none, unity gives an error.

I'm surprised it came without this.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Int Switch (Else or <>)
« Reply #1 on: May 05, 2015, 04:28:53 AM »
Hi,

 It's because you achieve an "else" by simply adding an action after the switch action, which means that the state is still active, which means the switch state did not validate any of the switches, which means, it's an "else".

Bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Int Switch (Else or <>)
« Reply #2 on: May 05, 2015, 07:06:21 AM »
As Jean says, you can do this by adding an action after the switch.

Actions are very modular in design, there aren't a lot of 'super' actions, the design philosophy is to give greater flexibility to the user by offering more actions that do less things.

Ergo you should design with that in mind because it is a cornerstone of the tool and once you wrap your head around it your workflow and systems will be much better as a whole.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Int Switch (Else or <>)
« Reply #3 on: May 05, 2015, 12:53:21 PM »
how do you know the state is still active then?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Int Switch (Else or <>)
« Reply #4 on: May 05, 2015, 01:27:18 PM »
The state is always active if you have not used a transition to leave it.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: Int Switch (Else or <>)
« Reply #5 on: May 05, 2015, 06:35:17 PM »
I know that but what I meant was:  after the test fails how do you get it to go to an else?  Do you mean the action AFTER the condition?  So if the condition is true it goes to the next state but if it is false it goes to the next action?


if that is the case, I get it.  Still, I disagree with the way this is handled.  It would make a lot more sense to have 'else' statements.  It's like how you all have a 'int add' but no 'int subtract' (until I mentioned it).  I get you just add a minus sign first, but playmaker is supposed to be easier to use than programming code.  I still think the else is needed for beginners and ease of debugging.