Hello,
I have a bug in RFTG which I have a hard time reproducing. Here is what's going on.
There is a special action in the game that can be done only once (prestige action). When the player click the prestige action button (called action_phasebonus in the code), there is a confirmation window to warn about "can be done only once!". The callback function of the confirmation dialog hides the button (among other things) with this line of code:
When the player select their action, I check the existence and visibility of the button to decide whether it's a normal action or a prestige action:
Sometimes it doesn't work. The player clicks the prestige action button, confirms, then selects their action and it's a normal action, not a prestige one. I suspect that the callback function is too slow and the player chooses their action before it has been executed. Or maybe it hasn't been executed at all.
So, is there a more reliable way to do this? Is the hiding of the button too slow and I should set a variable instead? Would that changes anything? Or is the timing of callback function generally unreliable? Or am I doing this the wrong way?
I'm thinking of replacing the confirmation dialog by a simple warning message. There's an undo button anyway.
I have a bug in RFTG which I have a hard time reproducing. Here is what's going on.
There is a special action in the game that can be done only once (prestige action). When the player click the prestige action button (called action_phasebonus in the code), there is a confirmation window to warn about "can be done only once!". The callback function of the confirmation dialog hides the button (among other things) with this line of code:
Code: Select all
dojo.style('action_phasebonus', 'display', 'none');Code: Select all
if ($('action_phasebonus')) {
if (dojo.style('action_phasebonus', 'display') == 'none') {
bCardBonus = true;
}
}So, is there a more reliable way to do this? Is the hiding of the button too slow and I should set a variable instead? Would that changes anything? Or is the timing of callback function generally unreliable? Or am I doing this the wrong way?
I'm thinking of replacing the confirmation dialog by a simple warning message. There's an undo button anyway.