Page 1 of 1

Activeplayer state skipped

Posted: 22 December 2016, 18:22
by DrKarotte
I have a problem with strange behaviour of activeplayer state.

The game goes over several rounds. In the first round everything is fine.
In the 2nd round (and following) the game goes into an activeplayer state which is ended (skipped) without letting the active player do anything.

In the log it is visible that the state is in fact entered and left. This behaviour is not expected regarding the BGA state machine and should by no means possible in the game - I have not added any code which could explain this.

I have checked that the player id of the active player directly before entering the state is valid.

The game then enters "next player", and activates the next player who can do something.

Any ideas what could cause this?

Re: Activeplayer state skipped

Posted: 24 December 2016, 03:56
by Victoria_La
Make sure on php side you have no code after $this->gamestate->nextState(...) code.
Because if you do accidentally have code that goes to another state it will cause another state transition without user interaction (I had this problem before and spent hours debugging it).

Code: Select all

 function selectField($field) {
   self::checkAction ( 'selectField' );
   if ($field!=0) $this->gamestate->nextState ( 'next' );
   $this->gamestate->nextState ( 'last' ); // <-- here is missing else, so it will cause double state transition
 }

Re: Activeplayer state skipped

Posted: 24 December 2016, 09:21
by DrKarotte
Thanks Victoria :D

Your hint helped me figure it out; it was as suspected, but somewhat "hidden", so it was difficult to spot until knowing what kind of mistake to search for ;)

Now Christmas may come 8-)

Re: Activeplayer state skipped

Posted: 24 December 2016, 20:08
by Victoria_La
I am glad you found it. If you stuck again consult this page: http://en.doc.boardgamearena.com/Troubleshooting