Page 1 of 1

Argument function of a state called too many times

Posted: 26 May 2013, 17:16
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?

Re: Argument function of a state called too many times

Posted: 27 May 2013, 14:57
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,

Re: Argument function of a state called too many times

Posted: 27 May 2013, 20:29
by Rudolf
Did you connect function several times without disconnect it?
I had same behaviour after doing that...
hope it will help...

Re: Argument function of a state called too many times

Posted: 28 May 2013, 02:26
by pikiou
The test is in PHP, I didn't use Javascript.