Hello.
In my JS code (for Riftforce) I have a global value named "this.cardActivated = {1:0,2:0,3:0};" in constructor.
I am having an error :
- When clicking a normal button I have a JS Error related to "Cannot read property '0' of undefined"
- If I hit "F5" my button is working without any more error
- Then it is the opponent turn (which have the same button, same error, same way to "F5 Fix")
- Then my turn again ==> Same JS Error
I have added some "console.log" in my scripts
What I can see is that if I do "console.log(this.cardActivated[1]);", the result is "undefined".
What can explain this strange behaviour ? i.e. : error despite the fact that the global value is declared and should be at least equal to "0".
FYI, the logic is
- Button clic ==> method "validateCardToDiscardForActivationFunctionButton" is called
- This method calls another method called "this.hightlightCardsToActivate();"
- this second method I am using these two values : "this.cardActivated[1]" and "this.cardActivated[2]"
I am also using these two values in other method without problems.
NB : the complete JS error log is :
EDIT : Note to myself : affect the correct type at a global value at any time
In my JS code (for Riftforce) I have a global value named "this.cardActivated = {1:0,2:0,3:0};" in constructor.
I am having an error :
- When clicking a normal button I have a JS Error related to "Cannot read property '0' of undefined"
- If I hit "F5" my button is working without any more error
- Then it is the opponent turn (which have the same button, same error, same way to "F5 Fix")
- Then my turn again ==> Same JS Error
I have added some "console.log" in my scripts
What I can see is that if I do "console.log(this.cardActivated[1]);", the result is "undefined".
What can explain this strange behaviour ? i.e. : error despite the fact that the global value is declared and should be at least equal to "0".
FYI, the logic is
- Button clic ==> method "validateCardToDiscardForActivationFunctionButton" is called
- This method calls another method called "this.hightlightCardsToActivate();"
- this second method I am using these two values : "this.cardActivated[1]" and "this.cardActivated[2]"
I am also using these two values in other method without problems.
NB : the complete JS error log is :
Code: Select all
Javascript error:
During callback: onclick / validateCardToDiscardForActivationFunctionButton
Cannot read property '0' of undefined
TypeError: Cannot read property '0' of undefined
at Object.hightlightCardsToActivate (https://en.1.studio.boardgamearena.com:8083/data/themereleases/current/games/riftforce/999999-9999/riftforce.js?1622144652120:768:60)
at Object.validateCardToDiscardForActivationFunctionButton (https://en.1.studio.boardgamearena.com:8083/data/themereleases/current/games/riftforce/999999-9999/riftforce.js?1622144652120:1623:22)
at Object. (https://studio.boardgamearena.com/1/riftforce?table=280500:2020:50)
at HTMLAnchorElement. (https://en.1.studio.boardgamearena.com:8083/data/themereleases/210527-1006/js/dojoroot/dojo/dojo.js:8:94920)
Script:
Url: https://studio.boardgamearena.com/1/riftforce?table=280500
BGA version 210527-1006
U=2337642
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36