Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: traitorjoe on June 29, 2014, 12:00:51 AM

Title: Adding Conditional Buttons?
Post by: traitorjoe on June 29, 2014, 12:00:51 AM
I've been searching for this and can't find a solution so I thought I'd post -

I've got a list of four GUI buttons I want on screen, but all four of them should appear or not appear based on a conditional integer value.

So if I try to add them all to one state, which seems like the correct thing to do, I'm not sure how to work the conditions in there (I'm using Int Compare).

I've been trying crazier things like a big tree where I add GUI buttons across multiple states. That works well as far as setting the conditions, but that doesn't seem to work right because GUI button 1 will disappear by the time I get to the state with GUI button 2.

So going back to the single state idea, is there a way to interject conditions in to GUI button creation process?
Title: Re: Adding Conditional Buttons?
Post by: jess84 on June 29, 2014, 07:30:29 AM
I don't know much about GUI Buttons, but I use GUI Texture for my buttons - it works fine, and I've got an FSM on each one to check for conditions and enables/disables the button when needed.

Do you need to use GUI Buttons?
Title: Re: Adding Conditional Buttons?
Post by: traitorjoe on June 29, 2014, 11:48:06 AM
GUI Texture would probably work for me fine. Are you setting all the conditions for the various buttons in the same state? I'd love to see an example or hear about how you're able to do that if so. Thanks for the response!
Title: Re: Adding Conditional Buttons?
Post by: Alex Chouls on June 29, 2014, 12:28:14 PM
Each button would generally have its own FSM since each button has its own states (Idle, Pressed, Disabled, Hidden...) Trying to collapse all that information for multiple buttons into one FSM gets messy fast!

Quote
So if I try to add them all to one state, which seems like the correct thing to do, I'm not sure how to work the conditions in there (I'm using Int Compare).

The FSM can run multiple states in a single Update so there's no reason to draw all your buttons in one state. Think of the FSM as a flowchart describing which buttons to draw...
Title: Re: Adding Conditional Buttons?
Post by: traitorjoe on June 29, 2014, 04:45:17 PM
OK cool. That's how I had tried it with attempt #2 but I was running in to an issue where if I had a GUI Button in FSM 1, it would disappear when I transitioned to FSM 2. So if I had four FSMs for the four buttons, I could only ever see one at a time. Is there a way around that problem?
Title: Re: Adding Conditional Buttons?
Post by: Alex Chouls on June 29, 2014, 04:52:56 PM
What do you mean by "when I transitioned to FSM 2"?
All the FSMs should be active...
Title: Re: Adding Conditional Buttons?
Post by: traitorjoe on June 29, 2014, 06:25:17 PM
Oh I was sloppy with my verbiage - what I meant was "when I transition to STATE 2". What I was trying was various states across the same FSM. Sounds like you're suggesting to literally make a separate FSM per button? I actually hadn't thought about that - I can give it a whirl.

Thanks for your patience with my noobiness. Any additional info along these lines you can offer is much appreciated!