Forum Discussion

ChrisAmmon's avatar
ChrisAmmon
Community Member
12 years ago

Reset multiple variables to default values

Is there any shortcut for reseting many variable to their default values? I'm creating a scenario based training in which I have about 20 variables tracking user progress. If they choose to restart the training I need to reset all of the variables. Can that be done with a single trigger or javascript versus adding 20 individual triggers to my Restart button? Thank you!

39 Replies

  • YvetteHealey's avatar
    YvetteHealey
    Community Member

    Hi, Ashley! A preliminary test in preview mode seems to indicate it's working!! I will test in my LMS today to be certain. Thank you so much!

     

  • Hi Ashley

    I'm just working through this thread now as I need to reset all my variables when a course restarts. I really don't want to incorporate any JS (due to the potential errors that it might produce further down the line) so is there a Reset All Variables option in SL2?

  • Hey Gary! 

    Looks like all of your options have been shared in this thread.

    • Triggers for each variable
    • JavaScript shared by community

    Just be sure that the triggers have time to execute before you jump to the beginning of your course, or they could execute when the timeline starts on that first slide.

  • I'm thinking it would be a great idea to add the resetvars option to the action list. SL already has a complete list of user created vars, their type, default values, etc. so creating the code to run through the list and reset them based on those default options is quite easy with a recursive function call. 

    having to create 10s of triggers or create a javascript solution is a time wasting issue. 

  • Hola, alguno me podrĂ­a ayudar! 

    Tengo una variable incorporada que cambia el estado de un objeto, necesito que la variable se reinicie si el usuario quiere volver a empezar el "juego" 

    Muchas gracias.

     

     

  • Si empiece de nuevo el proyecto entero, todos los variables se reinicien.

    Si no, puede usar la accion que hace el usario para reempezar como iniciador de disparador que cambia el variable.

  • GeneToth's avatar
    GeneToth
    Community Member

    Seems this could be managed using a series of master slides.