How long does a "tap" on screen last?

AJaymzAJaymz Member, PRO Posts: 164

If you tapped your screen. How long does the press last for? I just want to make sure some of my codes will execute during the tap time before the release. Any idea?

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited July 2014

    Never rely on touch is pressed for long strings of code. Wrap them in a FOR timer set to .03 seconds and run to completion checked. .03 is one code scan cycle.

  • AJaymzAJaymz Member, PRO Posts: 164

    It isn't too long of code, but I would feel safer with a timer now. Thanks!

  • colandercolander Member Posts: 1,610

    I always use "After 0 sec run to completion" if there is any chance the code won't complete.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    With after zero seconds the timer will keep running. Not a good idea.

  • colandercolander Member Posts: 1,610

    @The_Gamesalad_Guru I have always used this method and it hasn't caused any problems obviously that doesn't mean you aren't right. My logic is once the rule is no longer active the timer won't run is this incorrect? Maybe the one of the GS team can answer this @ForumNinja can you find out and let us know the answer?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited July 2014

    If you have rules with conditions inside the timer they would fire again if the condition becomes active again. It would be fine for behaviors that only fire once like a change attribute but say a constrain attribute would stay active. When you check run to completion once the timer is active it will ignore the condition of the rule it is in. As I said it works because of the type of logic you're putting in the rule but other types of logic will not work properly. That is why the method I showed would work with any type of logic because the timer only runs for one code cycle and resets.

  • colandercolander Member Posts: 1,610

    Thanks I had not thought this through before. After reading your explanation and doing a test it now makes logical sense.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    That's why I'm the guru of logic :p

Sign In or Register to comment.