Page 2 of 3

Re: database write delay ?

Posted: 31 May 2020, 15:23
by Benoit314
I checked this morning and you're right, you can access values in args. I wrongly assumed your code was inside OnEnteringState.

If args.token_type equals to null and not undefined, I suppose something went wrong with your query the first time. I would add some self::trace near your query to check it.

Re: database write delay ?

Posted: 31 May 2020, 15:57
by RicardoRix

Code: Select all

$sql = "UPDATE token SET token_specialpower_counter='-10' WHERE token_id='".$part_token['id']."
This formatting doesn't look quite right at the end. Looks like it's missing the final single quote, in fact there is an erroneous double quote at the end not terminated.

I would avoid using type as a field name, that's a sql keyword. I also prefer to use AS in the query as well to make it more readable, or even better don't rename the fields, it you don't like the field names then why start with them.

Re: database write delay ?

Posted: 31 May 2020, 16:42
by DrKarotte
OK, sorry, I am not sure about this. I now would log the args in the enteringState function and check if the same effect happens there, too.

Re: database write delay ?

Posted: 31 May 2020, 16:57
by tchobello
RicardoRix wrote: 31 May 2020, 15:57

Code: Select all

$sql = "UPDATE token SET token_specialpower_counter='-10' WHERE token_id='".$part_token['id']."
This formatting doesn't look quite right at the end. Looks like it's missing the final single quote, in fact there is an erroneous double quote at the end not terminated.

I would avoid using type as a field name, that's a sql keyword. I also prefer to use AS in the query as well to make it more readable, or even better don't rename the fields, it you don't like the field names then why start with them.
yep, sorry, I did erase the end while copying it here

Code: Select all

$sql = "UPDATE token SET token_specialpower_counter='-10' WHERE token_id='".$part_token['id']."'";
about the field names, you may ask sourisdudesert, who have made all this work using ' token_type type' a hundred times...

Re: database write delay ?

Posted: 02 June 2020, 00:56
by Tisaac
And what if you try to log 'this.gamedatas.gamestate.args' instead of 'args' ?

Re: database write delay ?

Posted: 02 June 2020, 03:55
by hersh
do you have

Code: Select all

if(this.isCurrentPlayerActive()) 
inside onUpdateActionButtons?

+1 to DrKarotte suggestion. If I recall onUpdateActionButtons can be called multiple times.

Re: database write delay ?

Posted: 02 June 2020, 08:35
by tchobello
I've tried all you've suggested...

I still have the problem...

I need to hit F5 for the variable to be recognized.

Re: database write delay ?

Posted: 02 June 2020, 10:39
by Tisaac
That weird, can you give the name of the studio project so I can try to look at it ?

Re: database write delay ?

Posted: 02 June 2020, 11:09
by tchobello
dungeontwisterext

Re: database write delay ?

Posted: 02 June 2020, 12:15
by Tisaac
Thanks but I can't ask for read access, maybe you have to do something to allow other developpers to ask ?