playMaker

Author Topic: Mouse Held events - getting weird results [solved]  (Read 2714 times)

tofusoup

  • Playmaker Newbie
  • *
  • Posts: 30
Mouse Held events - getting weird results [solved]
« on: January 20, 2013, 12:15:29 AM »
Just started playmaker back up after a very long hiatus...but I noticed something weird when setting up events to detect mouse held down.

I tried 2 ways to detect this with same result:

State 1
Set Bool Value - myBool to false
Get Mouse Button Down > State 2

State 2
Set Bool Value - myBool to true
Get Mouse Button Up > State 1

I have myBool with Inspector option on, so I can see it change.  

What I noticed is if I click my mouse, sometimes it would not set myBool to true.  Even though I see the states move back and fourth.  I tried changing the order but same result.  Of course holding the click down detects fine.  It seems I can click fast enough where it just doesn't set the Bool??

I also tried having State 2 to be like the following post > http://hutonggames.com/playmakerforum/index.php?topic=1320.0

I think this is causing my character not to move when I click fast.  I'm getting a similar thing on iOS.

I'm running latest PM, with Unity 4.  Can someone try to reproduce this....

thanks.




« Last Edit: January 21, 2013, 09:24:48 PM by tofusoup »

tofusoup

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Mouse Held events - getting weird results
« Reply #1 on: January 20, 2013, 12:33:46 AM »
Well actually I was thinking some more, and I can get around the single click.

I would simply check if mouse down, then check if the bool is true if they held, then do what I want for single click move or hold and move....etc

Adding an additional check should fix this....

but still, is this weird or just me?  I'll update this with [solved] if someone gets back to me :).


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mouse Held events - getting weird results
« Reply #2 on: January 21, 2013, 12:27:24 AM »
Hi,

 THe editor interface is not necessarly refreshing fast enough for you to see the variable value changed. The best way is to run some debugs in the console to make sure or watch the debug flow and study then what happened.

It could be also the way you plugged everything and when exactly you set the bool. Could you make screenshots or share the fsm in question?

bye,

 Jean

tofusoup

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Mouse Held events - getting weird results [Solved]
« Reply #3 on: January 21, 2013, 07:09:15 PM »
Thanks for the response

I thought some more about how I was using the states and figured it out.  Sometimes it's hard to wrap my head around what I want them to do.

Basically I think my order of bool check was in the wrong spot. 

Here's the logic:

When I click, I know I want the player to move, so I move the player, when it loops back around in the state, I check for a bool (MouseState), if it's true continue moving, else it just kicks you out because I know you didn't keep the mouse held.

I have another state machine changing the mouseState bool if it's true or false.

It's hard to explain but I setup way too many individual states to do things I didn't need and it was confusing myself.  I ended up cleaning most of it up and it's working now.

thanks!