refresh global variable in javascript

Game development with Board Game Arena Studio
Post Reply
User avatar
_Maestro_
Posts: 16
Joined: 03 December 2021, 15:27

refresh global variable in javascript

Post 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
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: refresh global variable in javascript

Post 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.
Post Reply

Return to “Developers”