Page 1 of 1

knowing if GameState > value?

Posted: 04 May 2013, 23:25
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.

Re: knowing if GameState > value?

Posted: 07 May 2013, 22:44
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 <...) ....

Re: knowing if GameState > value?

Posted: 09 May 2013, 18:38
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,

Re: knowing if GameState > value?

Posted: 09 May 2013, 20:35
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)?