Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Disabling default debug mode in Sugarcube 2 possible?


I have a ... possibly ... strange question. I love the new ability to have a debug view in Sugarcube but I only want it active when I have an error and am hunting that one down. Clicking the button in the side bar is a bit cumbersome because of ... let me explain:

I usually do text fragements and get the logic into place first before filling out the text. The logic involved quite a bit of random stuff so I usually rely on already set variables from a previous run and use "Test from here" to skip certain portions with variables already set. Once in the page I use F5 in the browser to test for various outcomes. And every time I hit F5 things change back to debug view which makes it hard to see the actual results (as I said - initially tons of code, little text).

Building and not using Test from here is equally cumbersome as I tend to make small changes and test those.

I found that you can use DebugView.disable() but I need to put that onto every page and this makes it a bit of a chore later on to remove all that once I'm done. So the question is - is there a way to disable it in another way than using DebugView.disable() on everypage that survives hitting F5 on a browser?

I tried to fiddle with predisplay in the hope that it would be global but I never managed to get it to work - probably because I am clueless what to use for "taskname".

Any input would be welcome.

Twine: 1.4


  • Assuming you haven't removed/hidden the UI bar, the following JavaScript should do what you need by creating a test mode setting in the Settings menu: (Twine 1: goes in script-tagged passage; Twine 2: goes in Story JavaScript)
    	Debug Settings.
    (function () {
    	Setting.addHeader("Debug Settings");
    	function initSettingDebug() {
    		Config.debug = settings.debug;
    	Setting.addToggle("debug", {
    		label    : "Enable test/debug mode?",
    		default  : false,
    		onInit   : initSettingDebug,
    		onChange : function () {
    Obviously, you will probably want to remove/disable that for public releases.
Sign In or Register to comment.