Replace previous output?

(Desktop version)

I have a computer that displays a centered message "insufficient power" when you try to use it and then asks if you want to override.

Would it be possible (if the player choose to override) to clear the previous line of text and replace it?

Basically once the player chooses to override, the message "insufficient power" changes to "override"?

(My game is set up to not output the text the player typed so no worries there.)


To replace the last line output, I think it would look something like:

JS.eval("$('#divOutput div span:visible').last().text('Override');")

But there might be timing issues if there's a menu in between (as the last line will be the menu, just before it's hidden).

In this case, you probably want:

msg("Insufficient power!")
JS.eval("text_to_replace = getCurrentDiv.children('span').last();")

then do the thing with the menu
Then you can do:

JS.eval("text_to_replace.text('Override!');")

Log in to post a reply.

Support

Forums