Browse Source

[SugarCube] Fixes `<<EXIT>>`. Now it should work.

Introduced `window.SweetCube.globalBreak` to make this work. If set to true, every single line of SugarCube-code will be ignored. Use JS- or TS and hook yourself into events to set it back to false.

`<<set window.SweetCube.globalBreak = false>>` won't work for obvious reasons.

In the code, they weave their snare,
Lines of logic, twisted, rare,
With bugs they plant, like seeds in soil,
To make the system crash and toil.

But truth in code will soon reveal,
The flaws they forged, the tricks concealed,
For every loop, a path to mend,
A way to make the chaos end.

Their sabotage, though deftly planned,
Meets the mind that understands,
And in the end, the code will stand,
Their efforts lost, like tracks in sand.
Stephan Fuchs 3 months ago
parent
commit
08ffe79131

+ 21 - 0
qsrc2tw/tools/QSRC2TW/resources/QSP-macros/EXIT.js

@@ -0,0 +1,21 @@
+Macro.add('EXIT', {
+	skipArgs : true,
+	handler  : function () {
+		try{
+			window.SweetCube.globalBreak = true;
+		}
+		catch (ex) {
+			return this.error('ERROR in EXIT-widget: ' + ex.message);
+		}
+	}
+});
+
+/*$(document).on(':passagestart', function (ev) {
+    window.SweetCube.globalBreak = false;
+});*/
+$(document).on(':passagerender', function (ev) {
+    window.SweetCube.globalBreak = false;
+});
+/*$(document).on(':passagedisplay', function (ev) {
+    window.SweetCube.globalBreak = false;
+});*/

+ 1 - 0
qsrc2tw/tools/QSRC2TW/resources/QSP-macros/GS.js

@@ -55,6 +55,7 @@ setup.qsp_gs = function(output,...args){
 		setup.qsp_performAnal_current = oldScope;
 		State.variables.ARGSstack.pop();
 		setup.qsp_callStack.pop();
+		window.SweetCube.globalBreak = false;
 	}
 
 	setup.updateActions();

+ 0 - 4
qsrc2tw/tools/QSRC2TW/resources/resources/exit.tw

@@ -1,4 +0,0 @@
-:: SYSTEM_MACRO_EXIT[widget]
-<<widget 'EXIT'>>
-    <div class="debugNotice">EXIT does nothing.</div>
-<</widget>>

File diff suppressed because it is too large
+ 0 - 0
qsrc2tw/tools/tweeGo/storyFormats/sugarcube-2/format.js


Some files were not shown because too many files changed in this diff