intfiction.org

The Interactive Fiction Community Forum
It is currently Fri Aug 17, 2018 10:28 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Jul 29, 2018 4:43 pm 
Online
User avatar

Joined: Fri Jul 11, 2014 12:50 pm
Posts: 104
I have a project where I need to load multiple stories (not at the same time) in Quixe via JavaScript, without reloading the page.

I have the default Quixe template (play.html) with the following line removed:
Code:
<script src="stories/glulxercise.ulx.js" type="text/javascript"></script>

To load a story, I empty the #windowport element and use
Code:
GiLoad.load_run(null, data, "base64");

where data is a string representing the story Glulx file.

It work fine the first time, but when I try to load another story, Quixe crashes with the message "Quixe was inited twice!".

Is there a way to "quit" Quixe before loading another story?

I guess Zarf will be the one answering, so thanks in advance, Zarf!


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jul 29, 2018 8:07 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5712
Um, I don't think this can be done without a bunch of Quixe engineering. There's no code to clear out the data structures. Even if you took out that double-init check, re-running quixe_init() has never been tested and I don't make any promises about it.

You could maybe store some data in browser local storage, reload the page, and pull the data back out.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jul 29, 2018 10:09 pm 
Online
User avatar

Joined: Fri Jul 11, 2014 12:50 pm
Posts: 104
I ended up having a HTML file per story, and using iframes that I can show and hide when needed.

Not what I would have prefered, but it may finally be better and it seems to work, so I think all is OK.

Thanks anyway!


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group