XbabylonX Posted February 14, 2016 Share Posted February 14, 2016 Hi,I have a script with 2 states.While in the default one and clicking the object leads to the second state where another clicking trigger leads back to the default one but the problem is that the latter works with 2 clicks and not with a single.Any ideas why is this happening? Link to comment Share on other sites More sharing options...
ObviousAltIsObvious Posted February 14, 2016 Share Posted February 14, 2016 can only guess without seeing the script, but if you are switching states from inside a touch_start handler, don't do that because clicks can be lost. the easiest workaround is to use touch_end when you need to change states on click. Link to comment Share on other sites More sharing options...
Ron Khondji Posted February 14, 2016 Share Posted February 14, 2016 It's a very old bug. Something to do with touch_start event carrying over to the new state. The sollution is to use touch_end events instead. Link to comment Share on other sites More sharing options...
steph Arnott Posted February 14, 2016 Share Posted February 14, 2016 Is it really needed to switch states? Link to comment Share on other sites More sharing options...
Nova Convair Posted February 14, 2016 Share Posted February 14, 2016 steph Arnott wrote: Is it really needed to switch states? It's a well known old bug. If you switch states you need to use touch_end. Link to comment Share on other sites More sharing options...
steph Arnott Posted February 14, 2016 Share Posted February 14, 2016 I meant does the OP really see the need to have two states rarther than just one. Added;: BTW Rolig Loon wrote this. integer gON;default{ touch_start(integer num) { gON = !gON; // Here's the switch ... if (gON) // So, let's test it .... { // It's on. } else { // It's not. } }} Link to comment Share on other sites More sharing options...
XbabylonX Posted February 14, 2016 Author Share Posted February 14, 2016 Touch end solved it! Thank you a lot guys! Link to comment Share on other sites More sharing options...
Nova Convair Posted February 15, 2016 Share Posted February 15, 2016 Oh that - yes I never use states for this little things. For me that's just overhead. I only use states if I need 2 different event handlers for the same event. But thats a personal preference. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now