applern's Recent Forum Activity

  • 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.

  • 1. Add temporary Array for your quiz. At the start of your quiz, set size for this Array:

    X - set to how many question you have in the current quiz

    Y - set to how many variables you want your question to store. Let's say you only need 2: Result & Timer. Y would be equal to 2 then.

    Your first Question would be equal to 0, second to 1, third to 2 and etc.

    2. Add static local integer variable (ID) which saves current index. 0 by default.

    As your whole quiz starts from the beginning, variable must be set to 0.

    It should be in the same Group as your other functions for the quiz which should have access to it.

    You could use global integer variable for that too. Whatever you find appropriate.

    3. Add local boolean variable (Answer) inside your "checkQuestion" function. If player answered correctly it would set there to True (1).

    4. In the very end of your "checkQuestion" function, but before Timer has stopped:

    1. SAVE RESULT. Set XY value for temporary Array:

    X - ID variable

    Y - Answer variable

    2. SAVE TIMER. Set XY value for temporary Array:

    X - ID variable

    Y - Timer.TotalTime

    3. Add 1 to ID variable by the end of your "checkQuestion" function.

    I hope I explained it well enough -_-

    Woah, this is alot. May take some time to throughly read. Thanks! I'm sure this'll work.

  • 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?

  • You could store them in the Array based on index (order) of each question.

    If you only need to show timer for 1 question then you should add local variable (static) instead.

    How would I save t. Is there an expressio?

  • Mind showing screenshot of your code?

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

    sure!

    checkQuestion

    setQuestion

  • In my timer after you press submit it should stop the timer and save the current time somewhere. At last it should show the time for each question. What is the 'somwhere' where it could hold all this and how would you save it?

  • 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

  • setquestion

    You only need 2 actions for Timer.

    Wait what is repeat. is that a loop?

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "score" is already a global variable, you shouldn't need to add or change anything to how the scoring works, just include whatever method you want to go to the next layout - for example, in the template I provided after event 21 you can just add:

    + System: Else

    + txt_nextQuestion: Text is "QUIZ COMPLETE!" (Ignore case)

    -> System: Go to next layout

    And then in the next layout set the text on a text object to "Your Score is: "&score

    In my timer after you press submit it should stop the timer and save the current time somewhere. At last it should show the time for each question. What is the 'somwhere' where it could hold all this and how would you save it?

  • 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.

  • "score" is already a global variable, you shouldn't need to add or change anything to how the scoring works, just include whatever method you want to go to the next layout - for example, in the template I provided after event 21 you can just add:

    + System: Else

    + txt_nextQuestion: Text is "QUIZ COMPLETE!" (Ignore case)

    -> System: Go to next layout

    And then in the next layout set the text on a text object to "Your Score is: "&score

    Yay! it worked!

applern's avatar

applern

Member since 7 Oct, 2019

None one is following applern yet!

Trophy Case

  • 5-Year Club
  • Email Verified

Progress

6/44
How to earn trophies