3 ms·
This worked for the whole first chapter for me (and has some obvious further applications): startLevel["constructor"]("m", "console.log(m);" + "var
by jpolitz 13y ago
This worked for the whole first chapter for me (and has some obvious further applications):
startLevel["constructor"]("m",
"console.log(m);" +
"var old = m.placeObject;\n" +
"m.placeObject = function(x,y,t) { \n" +
"console.log(t);\n" +
"if (t === 'exit' || t === 'computer') {\n" +
"console.log('adding' + t);\n" +
"return old['ca' + 'll'](m, x,y,t) }};")(map);
EDIT: I wonder if you could wrap the user's code in, e.g. https://code.google.com/p/es-lab/wiki/SecureEcmaScript https://code.google.com/p/es-lab/wiki/SecureEcmaScript, and use this to gamify finding bugs in that sandbox :-)
- jacktoole1 13y agonice! similarly, var oldPlaceObject = map.placeObject; var newPlaceObject = function(x, y, type) { if (type !== 'block') { map.placeObject = oldPlaceObject; map.placeObject(x, y, type); map.placeObject = newPlaceObject; } }; map.placeObject = newPlaceObject; was my solution to multiple levels ;).
- kybernetikos 13y agoI also had to overwrite the map.verifyXitems (or whatever it was) to return true regardless.