How do I restart the timer?

0 favourites
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • So I have a timer (Timer Behaviour) and 2 functions. (Its a quiz game)

    When the new question appears it calls the functionn 'setquestion' and the timer begins. Once you press submit, it calls 'checkquestion' and the timer stops. For the next question it should retat the timer but it just picks up where it left off. Any way to change this? Help would be appreciated. Thanks.

  • 1. Start Timer (Once) for X time with tag "any".

    2. Stop Timer with tag "any".

    3. Repeat from 1

  • 1. Start Timer (Once) for X time with tag "any".

    2. Stop Timer with tag "any".

    3. Repeat from 1

    Where would repeat from 1 be? In checkquestion or setquestion?

  • setquestion

    You only need 2 actions for Timer.

  • setquestion

    You only need 2 actions for Timer.

    Wait what is repeat. is that a loop?

  • I didn't meant it as condition, more like "go back to 1"

    You wrote that you start timer in "setquestion" and stop it in "checkquestion".

    So you need to start timer ONLY in "setquestion" and stop it ONLY in "checkquestion".

  • I didn't meant it as condition, more like "go back to 1"

    You wrote that you start timer in "setquestion" and stop it in "checkquestion".

    So you need to start timer ONLY in "setquestion" and stop it ONLY in "checkquestion".

    I tried doing 'only' but it got stuck in 00:01 for the timer only instead of regular

  • Mind showing screenshot of your code?

    You can send it to my Discord, if you like - XpMonster#2531

  • Mind showing screenshot of your code?

    You can send it to my Discord, if you like - XpMonster#2531

    sure!

    checkQuestion

    setQuestion

  • I see the problem now.

    "checkQuestion" uses "wait" type of action (Request Project File with AJAX) which can't be done in one-tick using standard synchronous function. Your function only worked until AJAX's request so "Stop" never happened.

    Make "checkQuestion" asynchronous and everything should work. Also put "Wait for previous actions to complete" after you call "checkQuestion".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I see the problem now.

    "checkQuestion" uses "wait" type of action (Request Project File with AJAX) which can't be done in one-tick using standard synchronous function. Your function only worked until AJAX's request so "Stop" never happened.

    Make "checkQuestion" asynchronous and everything should work. Also put "Wait for previous actions to complete" after you call "checkQuestion".

    I understood the first part but not the second. What do you mean by

    Also put "Wait for previous actions to complete" after you call "checkQuestion".

    I dont see where i shpuld put it?

  • Well you have action that calls your "checkQuestion" function somewhere in the code, right?

    Put "wait for previous action to complete" after that.

    Unless you have no actions after the call that is.

  • Well you have action that calls your "checkQuestion" function somewhere in the code, right?

    Put "wait for previous action to complete" after that.

    Unless you have no actions after the call that is.

    I did so, but it gets stuck at 00:01 and then i press next quesetion and it starts from 00:02 thengets stuck etc.

  • Give *c3p with this piece of code, please.

  • Give *c3p with this piece of code, please.

    I dont understand?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)