We have a thing called a “Referee” which looks like a well. Add that to your level and navigate to it’s components (double-click on it) and go to the “misc.Referee” component. Inside the Referee’s misc.Referee component click the [+] and add “extraCode”. Now, finally, inside that extraCode you can add these custom functionality. Note that this is in CoffeeScript, not JavaScript/Python/Lua
setUpLevel happens once before the level starts. onFirstFrame happens during the first frame of the level. chooseAction happens every frame of the level.