So I'm trying to convert the game I've been making in Twine2/SugarCube2.6.1 into Twee2 0.4.2 format and compile with Sugarcube 2.6.1. I figured out how to correctly install and compile with the 2.x Sugarcube format, and my game is mostly working correctly. I just have one issue...
I want to use Leon's combined replace link macro set for <<insertlink>> and <<replacelink>>, but whenever I compile using Twee2 and try to open my .html file, I get the following error:
"Error[tw-user-script-0]: Unexpected token &."
If I cut out the javascript related to the replace link macro set from my [script] passage, I have no errors or warnings except for my <<insertlink>> tags failing (obviously, since the code to run them isn't there).
Anyone have some ideas on how to make the macros play nice with the Twee2 generated file?
Comments
/*! <<replacelink>> macro set for SugarCube 2.x */
!function(){"use strict";function showVer(n,notrans){n&&(n.innerHTML="",new Wikifier(n,n.tweecode),n.setAttribute("data-enabled","true"),n.style.display="inline",n.classList.remove("revision-span-out"),notrans||(n.classList.add("revision-span-in"),n.timeout&&clearTimeout(n.timeout),n.timeout=setTimeout(function(){n.classList.remove("revision-span-in"),n=null},20)))}function hideVer(n,notrans){n&&(n.setAttribute("data-enabled","false"),n.classList.remove("revision-span-in"),n.timeout&&clearTimeout(n.timeout),notrans?(n.style.display="none",n.innerHTML="",n=null):(n.classList.add("revision-span-out"),n.timeout=setTimeout(function(){"false"===n.getAttribute("data-enabled")&&(n.classList.remove("revision-span-out"),n.style.display="none",n.innerHTML=""),n=null},1e3)))}function tagcontents(b,starttags,desttags,endtags,k){function tagfound(i,e,endtag){for(var j=0;j
I can only conclude that any testing of the correctness of Twee2's output was minimal, at best.
Is Twine 1.x + Twee better, and would my SugarCube code all be compatible?
The easiest thing would probably be to download TweeGo (v0.99.0) and the version of SugarCube v2 which works with it. After you've placed the TweeGo executable somewhere, make a targets directory within the same directory, then place the SugarCube v2 directory from the archive within that targets directory. In other words, it should look something like the following: From there, simply typing tweego at your command line will yield help on how to use it—as long as you're in that directory or it's in your path variable.
The compiler you're using has little bearing—none really—on your code, that's the domain of the story format itself. So, yes, your SugarCube v2 code will be compatible.