You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, OOPS just reloads your last command in the input element, for you to correct it (just like pressing the up arrow).
This makes OOPS works the "classic" way, where you can include an object, like:
> GET FRB
There doesn't seem to be anything you might call 'frb' here.
> OOPS FROB
You pick up the frob.
>
I have to change the actual code in the built-in library file for this one bit, to modify the Cmd class before it is used to create any commands:
// _command.js line 385noobjecterror(s){if(typeofgame.unrecognizedObjects=='undefined')game.unrecognizedObjects=[]game.unrecognizedObjects.push(s)returnlang.object_unknown_msg(s)}
The rest of this is added to my code.js file:
findCmd('MetaOops').regexes=[/^(?:oops(.+))$/]findCmd('MetaOops').script=function(objects){console.log('MetaOopsy!')returnio.againOrOops(false,objects)}findCmd('MetaOops').objects=[{special:'text'},]io.againOrOops=function(isAgain,objects){if(io.savedCommands.length===0){metamsg(lang.again_not_available)returnworld.FAILED}io.savedCommands.pop()// do not save AGAIN/OOPSif(isAgain){parser.parse(io.savedCommands[io.savedCommands.length-1])returnworld.SUCCESS_NO_TURNSCRIPTS;}else{if(typeofgame.unrecognizedObjects=='undefined'||game.unrecognizedObjects.length==0){msg("There is nothing to correct.",{},'parser')returnworld.SUCCESS_NO_TURNSCRIPTS;}lettoCorrect=io.savedCommands[io.savedCommands.length-1]letcorrected=toCorrect.replace(game.unrecognizedObjects[game.unrecognizedObjects.length-1],objects[0])//document.querySelector('#textbox').value = correctedgame.unrecognizedObjects=[]consts=correctedlog(s)msg("("+s+")",{},'parser')if(s){if(io.savedCommands[io.savedCommands.length-1]!==s&&!io.doNotSaveInput){io.savedCommands.push(s)}io.savedCommandsPos=io.savedCommands.length;parser.parse(s);if(io.doNotEraseLastCommand){io.doNotEraseLastCommand=false}else{document.querySelector('#textbox').value=''}}}}
Finally, this should really be handled in the function that runs when a turn ends (of course), but I added a turn script along with the code above to disallow OOPS after a successful turn:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
By default, OOPS just reloads your last command in the input element, for you to correct it (just like pressing the up arrow).
This makes OOPS works the "classic" way, where you can include an object, like:
I have to change the actual code in the built-in library file for this one bit, to modify the
Cmdclass before it is used to create any commands:The rest of this is added to my code.js file:
Finally, this should really be handled in the function that runs when a turn ends (of course), but I added a turn script along with the code above to disallow OOPS after a successful turn:
Beta Was this translation helpful? Give feedback.
All reactions