knowing if GameState > value?

Game development with Board Game Arena Studio
Post Reply
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

knowing if GameState > value?

Post by Rudolf »

Hello,
in Game.js / GetAllData, is it possible to know if the GameState is upper or lower than a value? ( if (ActiveStep > 29) ... ) o r shall I use my own global to memorize it?
According to a previous post, access is only on 'name'?
I will probably use a number inside ActiveStep, something like '29_Mystep' and split it if not... but I would like to check if there is a better solution.
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: knowing if GameState > value?

Post by Rudolf »

the goal is to replace something like:

Code: Select all

case 'CheckPlayerCanMove': 
								case "MoveEagle": case "MoveHorse": case "MoveSnake": case "MoveTurttle":
									if(movechoicediscover) this.DisplayMoves();
with if (Step>=29 && Step <...) ....
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: knowing if GameState > value?

Post by sourisdudesert »

Hello,

In this situation the best think is to add a "possibleaction" to all these state, and to test if this action is possible with this.checkAction( "mypossibleaction", true ).

Note: the "true" make sure that no warning message will be displayed to the user.

Cheers,
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: knowing if GameState > value?

Post by Rudolf »

Thanks Greg,
yes, you're right, but it's nearly same thing? And it's quicker like that?
I was thinking of a general case that involves that each time we add a step, we need to add a possibleaction (or a case)?
Post Reply

Return to “Developers”