Page 1 of 1

refresh global variable in javascript

Posted: 22 March 2022, 10:03
by _Maestro_
Hi

In my game you need to pick a card from a certain pile dependent on the step you are in.
In order to connect to the correct pile, I need to source the global variable "currentStep". However when it moves up, the global variable is not (automatically) updated in javascript.

(going to a new step is a new state)

How do I make sure that in javascript I always work with the actual current value of the global variable?

Best regards
Maurice

Re: refresh global variable in javascript

Posted: 22 March 2022, 10:12
by RicardoRix
Short answer: it doesn't.

You can pass updated data from the server to the client in 2 ways.
- A notification.
- using the 'args' variable in a state change.