persistent 'gameStateChange' Javascript error

Game development with Board Game Arena Studio
Post Reply
User avatar
cmgames
Posts: 16
Joined: 05 October 2016, 22:14

persistent 'gameStateChange' Javascript error

Post by cmgames »

I am developing a game where the player must play one action, the may play additional actions or end his turn.

My problem is that once the required action is complete and the player proceeds to the 'chooseOptionalActions' game state, I am always getting the following error:

Javascript error:
During notification gameStateChange
undefined
no_stack_avail

It makes no difference what primary action path the player took to get there.
I have checked that every possible action available in the states.inc.php has a matching function in mygame.action.php.
I have checked that every possible action function available in the mygame.action.php has a matching function in mygame.game.php.
I have checked that every possible 'notify' function in mygame.game.php maps to a valid notify subscription and function in mygame.js.
I have checked that every state in the states.inc.php that I have specified to 'updateGameProgression' returns a unique integer from the 'getGameProgression' function in mygame.action.php.

What have I missed? Why am I getting that error?

~cmgames
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

Re: persistent 'gameStateChange' Javascript error

Post by apollo1001 »

I haven't checked your code, but that looks like an error you would get if you have tried to add an action listener (e.g. to an action button) without also defining the function itself. I'd therefore check your onUpdateActionButtons and onEnteringState functions in <yourgame>.js
User avatar
cmgames
Posts: 16
Joined: 05 October 2016, 22:14

Re: persistent 'gameStateChange' Javascript error

Post by cmgames »

Yeah, that is what it seemed to me, too. But I have checked all those at least five times and they are all correct and there. I even tried re-naming all the actions and all the functions. No joy - same symptom.

~cmgames
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

Re: persistent 'gameStateChange' Javascript error

Post by apollo1001 »

Which state had the issue? I've just checked your code and note:

Code: Select all

		case 'showNewCard':
                        this.addActionButton( 'ack_card', _('OK'), 'ackCard' );
                        break;
                case 'diceActionComplete':
                        this.addActionButton( 'play_card', _('Play a Card'), 'playCard' );
                        if(this.gamedatas.players[this.player_id].built_this_turn == 'N'){
                            this.addActionButton( 'build_building', _('Build a Building'), 'buildBuilding' );
                        }
                        this.addActionButton( 'end_turn', _('End Turn'), 'endPlayerTurn' );
It looks like 'ackCard', 'buildBuilding' and 'endPlayerTurn' are all currently undefined.

EDIT:
My problem is that once the required action is complete and the player proceeds to the 'chooseOptionalActions' game state, I am always getting the following error
I should clarify: 'chooseOptionalActions' doesn't appear in your states.inc.php file.
User avatar
cmgames
Posts: 16
Joined: 05 October 2016, 22:14

Re: persistent 'gameStateChange' Javascript error

Post by cmgames »

It was the 'diceActionComplete' state that keeps throwing the error.

Thanks for pointing me in the right direction - it was the missing (evt) functions in the .js file. I had the actual functions all correct - I just didn't have an event handler to start the ball rolling.

New question:
In the documentation for 'Studio Logs" (http://en.doc.boardgamearena.com/Studio_logs), it states:
"BGA Studio logs are available directly from your game development interface.
Logs allows you to check out what happened recently on server and to debug your game."

But I cannot find WHERE to see the logs in my "game development interface". I found where I can download the "errors from Production", but since this game is not in production mode (I don't think), all I get is a file-not-found kind of error when I click those buttons.

Thanks again!

~cmgames
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: persistent 'gameStateChange' Javascript error

Post by fafa-fr »

cmgames wrote: But I cannot find WHERE to see the logs in my "game development interface".
Maybe the wording "game development interface" is misleading: in the table of a running game, below your game interface, there are three buttons, one of which being "BGA request&SQL logs".
Post Reply

Return to “Developers”