How to Output HTML to a Quest String? (Quest 5.8 desktop) [SOLVED AGAIN!]

Building off of my previous thread, I have a Quest string variable t containing all of my HTML, which is then printed out via a JS function openMarketPane(t), like so:


In the course of playing, changes are made to the HTML text (but not the t variable). When the game is saved and reloaded, the same JS function openMarketPane(t) is called to reload the HTML table #marketPane, but the old HTML is displayed (without the changes). I was trying to find a way to output the changed HTML to a Quest string variable/attribute before saving, in order to retrieve it upon game reload. Then I can reprint #marketPane with the new t variable.

I think you'd want to do something like:

  ASLEvent ('SaveMarket', $('#marketPane').html());

in javascript. This will call the quest function SaveMarket with a single string parameter, the HTML contents of that pane. The function will presumably put the contents in a string attribute somewhere, so that it can be reloaded when needed.

I think it might be easiest to do this whenever the HTML is changed, so Quest always has a copy of the latest string. There's probably a way to do it when the game is saved instead, but that would be more complex because the process of saving (and the way it passes control back and forth between Quest and JS) is different between the web and desktop players.

Ok, that worked! Yay!

I guess ASLEvent is the goto function whenever you need to go from JS/HTML back to Quest.

Yeah, I don't really want to mess with the save command/RequestSave/JS.saveGame, since save has been heavily modified in Q5.8.

Thanks again!

@ mrangel,
Do you accept bitcoin or paypal?

g I can do paypal.
But it turns out I'm not good at doing work for other people. I can't promise in advance if I'll be able to finish a particular project. I've been working on SaveStateLib for weeks now, but break down in anxiety every time I'm reminded that somebody else is waiting for it, which makes it take a lot longer.

Log in to post a reply.