Rest all variables

Problem: Resetting variables

ActivePresenter version: N/A

OS: Mac

Notes: Hi, quick question, is it possible (on a button click) to reset all variables back to their default when the app is initially loaded, ie, numbers returning to zero, or text being removed having been concated?

Thanks

Sure -

There is not a master switch for this, however, that I am aware of - except maybe Restart Presentation - but I don’t think that is what you’re after. Even then - you can run into caching problems so I like this method best.

I do this often with JavaScript and a function in my onload event to the slide.

For example…

// RESET ALL VARIABLES

window.resetGame = function() {
    prez.variable("score", 0);
    prez.variable("playerName", "");
    prez.object("feedback").state("blank");
    // etc...
}

Then - on your reset button, you can call the function.

resetGame();

Hopefully that helps

Thank you. That’s perfect. I as having caching problems where scores were being remembered so this is ideal.

1 Like