memoir.js not similar on servers and games

Game development with Board Game Arena Studio
Post Reply
User avatar
Mumbly
Posts: 6
Joined: 26 November 2022, 19:25

memoir.js not similar on servers and games

Post by Mumbly »

Hello, we have an issue on a game which is create a blocking game :
https://boardgamearena.com/table?table= ... d=83881525

why in the file of the current gamememoir.js of game 75725443026 I can see :
onEnteringState(e, t) {
this.inherited(arguments);
if (t.args && t.args.currentAttack) {
let e = t.args.currentAttack;
e.unitId && $(unit-${e.unitId}).classList.add("attacking");
e.oppUnitId ? $(unit-${e.oppUnitId}).classList.add("attacked") : $(cell-${e.x}-${e.y}).classList.add("attacked")
}
in this case .classList.add("attacking"); is generating "Uncaught (in promise) TypeError: Cannot read properties of null (reading 'classList')

But on the other side the current memoir.js : is having another syntax :
onEnteringState(stateName, args) {
this.inherited(arguments);

// Highlight current attack
if (args.args && args.args.currentAttack) {
let attack = args.args.currentAttack;
if (attack.unitId) {
$(unit-${attack.unitId}).classList.add('attacking');
}


so why do we have different syntax ?
User avatar
cheval_raye
Posts: 101
Joined: 19 March 2020, 17:48

Re: memoir.js not similar on servers and games

Post by cheval_raye »

Javascript code is minified. But that's not the problem here. The result of

Code: Select all

$(unit-${attack.unitId})
is null, and when you try to add a class, it triggers an error. Are you sure you didn't forget backticks around

Code: Select all

unit-${attack.unitId}
?
Post Reply

Return to “Developers”