I’ve submitted code which triggers a console error of “Non-UserCodeError: TypeError: undefined is not a function”
This causes the game to never load, and I can’t seem to enter a game to attempt to fix.
Full trace
|Athena's Archer| Non-UserCodeError: TypeError: undefined is not a function
TypeError: undefined is not a function
at new t (http://codecombat.com/javascripts/world.js:1279:173)
at t.i.exports.t.getState (http://codecombat.com/javascripts/world.js:1265:75)
at t.i.exports.t.setState (http://codecombat.com/javascripts/world.js:1406:94)
at new t (http://codecombat.com/javascripts/world.js:1402:135)
at t.i.exports.t.getNextFrame (http://codecombat.com/javascripts/world.js:1405:10)
at World.module.exports.World.getFrame (http://codecombat.com/javascripts/world.js:1330:52)
at World.module.exports.World.loadFrames (http://codecombat.com/javascripts/world.js:1337:71)
at http://codecombat.com/javascripts/world.js:1338:339
Edit:
Managed to test code on another account. This happens if I try to modify a coins properties (specifically pos). I see now that these are read only properties, but attempting to change them shouldn’t crash the game (and make it impossible to fix ) .
I still can’t get to an edit panel on my account so if you could clear my code it would be appreciated.
How about now? I just made the raise-dead logic a little more robust to raising dead units that can’t see, but I’m not sure that was it. (Did you raise a chest or something, possibly?)
This is a common JavaScript error that happens when you try to call a function before it is defined. You get “‘undefined’ is not a function” error when you try to execute a function that is uninitialized or improperly initialized . It means that the expression did not return a function object. So you have to figure out what you are trying to execute isn’t a function.
In Javascript , when you execute a function, it’s evaluated like the following:
execute -> expression.that(‘returns’).aFunctionObject // what the JS engine does
That expression may be complex. So when you get undefined is not a function it means that expression did not return a function object. So you have to figure out what you are trying to execute isn’t a function.