Argument function of a state called too many times

Game development with Board Game Arena Studio
Post Reply
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Argument function of a state called too many times

Post by pikiou »

I was wondering in which order stStateName and argStateName were called, and from a test here is what I found.

In states.inc.php I have this as the next state after gameSetup:

Code: Select all

   2 => array(
      "name" => "test",
      "description" => '',
      "descriptionmyturn" => '',
      "type" => "activeplayer", 
      "action" => "stTest",
      'args' => 'argTest',
      "possibleactions" => array("playCard"),
      "transitions" => array("playCard" => 3)
   ),
And here is the chronological sorted list of called functions:

Code: Select all

argTest
argTest
stTest
argTest
argTest
getAllDatas
argTest
getAllDatas
argTest
argTest
argTest
playCard <= result of me playing a card
argTest
argTest
argTest
Why is the argument function called 11 times if it's result is supposed to be unique?
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Argument function of a state called too many times

Post by sourisdudesert »

Hello,

In fact the "arg" function can be called multiple times, when needed by the framework (ex: after a page refresh). As it is not supposed to do any action, this has no side effect.

Thus, the situation you described seems to be suboptimal and I'm going to investigate this.

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

Re: Argument function of a state called too many times

Post by Rudolf »

Did you connect function several times without disconnect it?
I had same behaviour after doing that...
hope it will help...
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: Argument function of a state called too many times

Post by pikiou »

The test is in PHP, I didn't use Javascript.
Post Reply

Return to “Developers”