Using
Sugarcane.
I'm experimenting with xax's awesome
multi-panel design. Unfortunately, I don't seem able to use L's usual
replace macros in it. If I include both scripts in the file, opening the game produces Error 1 (see screenshots below). The replace macro will actually function properly within the passage, but when I try to click on a link after that, it produces Error 2.
Does anyone know why they conflict? Is it something to do with the fact that the multi-panel script came from twee?
I'm attaching the tws file with both scripts included.
Comments
After a little digging it looks like that while the actual cause of the problem is still mysterious to me, it goes away if you separate out the macro sets into two different passages -- instead of having one
"script"
passage taggedscript
, have"panes"
and"replace"
passages (or whatever), both taggedscript
. Which... seems to fix it?" reshowAll@file:///C:/Users/Logan/Desktop/pane%20test.html line 87 > eval:1:27
macros.linkTo.handler/link.onclick@file:///C:/Users/Logan/Desktop/pane%20test.html line 87 > eval:1:1995
You may be able to continue playing, but some parts may not work properly. "
For quick comparison, the Opera error:
"Uncaught exception: TypeError: Cannot convert 'e' to object."
and Chrome error:
"TypeError: Cannot read property 'replace' of undefined at reshowAll, <anonymous>:1:69)
at HTMLAnchorElement.link.onclick, <anonymous:1:1995)"
Does any of that...clarify anything? .___.
edit and wholly unrelated, is there a way to do external links with this design?
<<link "passage name" "visible text">> is the basic link you have set up, but if I want to open another site rather than a passage... what should I write in place of the passage name?
<<link>>
macros won't work inside timed code, due to some fairly fundamental problems between the two macro sets and how javascript handles asynchronous code. However! What's happening (and I really should have put a macro error message there, rather than just some silent broken code -- it's the same issue in all browsers, just the specific part where the code stumbles and falls is different) is that<<link>>
can't figure out what pane it's in. If you change the<<link "next left" "click me">>
line to<<linkTo "left" "next left" "click me">>
, that should work!Also external links... If you want a standard external link, then you can use the usual twine link format, even inside a pane. If you want an external link but inside a pane... that's definitely not something I was thinking of when I wrote this. What you could do, I think, is make a passage that had an iframe HTML element in it --
<iframe src="url here"></iframe>
and then link to that passage.So thanks again for designing this and helping me out. If it's possible, you might want to add this explanation to the original thread that documents the layout. I think it'd be useful for future Twiners to know this little trick as well, as most of us use L's macros.