MZ: TypeError: Cannot set property 'effects' of undefined

window.v = $gameVariables._data
window.s = self(1,1)

It seems like this window. which I previously used in MV produces this error. Yet if I remove it the game can't identify these variables correctly.
Moderator note: I've moved this thread to Learning JavaScript. I think this is the best board for what you're asking about, but it's not clear as you will likely need to provide more detail before someone can offer a helpful response:
  • I know you are trying to use this code in MZ, but is that code part of an MZ Plugin, an MV Plugin, a custom plugin you are making yourself, or something inserted into the game's base code? If it is a plugin, you should post a link to that plugin here. If it is base code, you should paste the entire method here.
  • What does 'window' refer to in this context? Where was 'window' defined?
  • Where is 'effects' defined for 'window'? Also, since the error is saying that 'effects' is trying to be read for some kind of object (likely 'window' but not certain), you should paste the line of code (and the couple lines around it) that the game tells you caused the crash.
  • What are you trying to do with this code?
Hopefully with that information you can get some better answers about why this is happening and how to correct it.
My bad, I overlooked an obvious syntaxis error when creating an array. Solved 😀
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/mz-typeerror-cannot-set-property-effects-of-undefined.140666/