Hiding menus - not sure the best way to approach this

Hey folks!
Been working on Tomb of the Dead again, and I'm running into some issues. If I show a menu and then have the game make a sarcastic response about the answer, it becomes weird when the menu is hidden.

So… I'm looking for a way to change it so that instead of hiding a menu, it just hides the non-chosen options.

I could create a new JS function to do the hiding, that's no problem, and override ShowMenuResponse. But on the web editor, I can't override functions. So I'd either have to create my own function around ShowMenu and wrap an extra script around the callback every time; or print the question and chosen answer at the start of every menu response individually.

I'm trying to figure out if there's a better way to do this.
I could override the JS addText function, and have it recognise menu options. That wouldn't actually be too hard (if a little flaky in the case of future updates). Could then have it play around with the classes, but that's horribly awkward. I'd have to have addText watch out for the string onclick="ASLEvent('ShowMenuResponse',, loop over the classes on the containing div to find the section\d+ one, and apply that section name to the span instead. Then replace the onclick with onclick="$(this).attr('onclick','').parent().removeClass('section123'); ASLEvent('ShowMenuResponseetc… So instead of the div having the class, it's stuck on all the individual lines except the one clicked. But then I'd have to override runCommand as well, to make sure it works with manually entered commands. That's starting to get pretty hairy…

So, a question: Which is the best solution? and perhaps more importantly: Is there a simpler way that I'm missing?


You can hide or destroy all the options, or, you can put the options somewhere else! But seriously, I'm not sure how to do this. I was trying to make a joke...


I've got it working now; wrote my own version of ShowMenu.
It also behaves sensibly if there's already a menu showing, so it'll display the second one after the first one ends.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums