Tutorial HTML How To Debug(Or Cheat) Twine{SugarCube} Variables

mannice431

Well-Known Member
Jun 14, 2017
1,005
1,074
Can someone help me with twine? I've downloaded Twine version 2.3.9 (for windows) and the story format is Sugarcube 2.31.1, but i can´t seem to get links to work, instead of highlighting the word (say, fire) in brackets, it instead shows up as: [[link]] fire.

Fire is clickable and shows up in blue, but so does [[link]] before it (not in blue).

Any help?

(I'm just starting out so it can't just be some weird bug)
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
Fire is clickable and shows up in blue, but so does [[link]] before it (not in blue).
I believe this question was answered for you on one of the other forums you asked it, but in case you haven't read the answer there yet... (or for anyone else having a similar issue.)

The Twine 2.x application has four main options that can be used to 'view' your story, they are: the Test button; the Play button; the Publish to File menu item; and the Test story starting here context toolbar button.

Both the Test button and the Test story starting here context toolbar button cause the story to be 'viewed' in debug mode, how exactly that mode appears and what features that mode has depend on the Story Format you are using. In the case of SugarCube 2.x the debug mode displays links in the manner you described.

I suggest only using the 'Test' related options when you actually need to debug the variables and logic of your story, in all other situations use either the Play or Publish to File options.
 

sahz

Newbie
Aug 9, 2016
19
8
Firefox version of SugarHack 3.0.2.

Needs to be installed in the developer version of firefox after disabling sign checking (navigate to about:config, set 'xpinstall.signatures.required' to false). The only way I know of to get round that limitation is to submit it as an addon, given I've only done a quick conversion, have no intention of updating it or supporting it and it's not my code I don't feel comfortable doing that.
 
  • Like
Reactions: etaoin and polaco

evilmonkie

Newbie
Nov 30, 2018
28
32
any idea how to edit game time when the dev uses the gamedate widget to manage time rather than hour/minute variables?
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
..dev uses the gamedate widget..
As far as I know there is no official <<gamedate>> widget, so it is likely a custom one.
If this is the case then we would need to know which story/game you are talking about so we could examine the widget's code to determine how it works.
 

evilmonkie

Newbie
Nov 30, 2018
28
32
As far as I know there is no official <<gamedate>> widget, so it is likely a custom one.
If this is the case then we would need to know which story/game you are talking about so we could examine the widget's code to determine how it works.
i've seen it in a few html games now, most recently "Suddenly A Girl" and "The Last Hope"
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
...most recently "Suddenly A Girl"
I de-compiled this game for you and it uses a $gameDate Story Variable to store a JavaScript Date object, which is then manipulated using custom widgets like <<addmins>> and <<addhours>>. I can't state where that specific game obtained the implementation it is using but the original .

As to your original "edit game time" question, as the value being stored in the $gameDate variable is a Standard JavaScript then you can use any of the object's functions to alter it current Date/Time value within your web-browser's Console using the SugarCube debug object.

eg. you wanted to add 10 minutes to the current Date/Time you could execute something like the following into the Console. (untested)
Code:
SugarCube.State.variables.gameDate.setMinutes(SugarCube.State.variables.gameDate.getMinutes() + 10)
 

MokoMilk

Newbie
Dec 30, 2017
40
3
did they remove sugercube hacker from the chrome app store? i downloaded the twine thing but its not working
 

Lure of Chaos

Member
Apr 21, 2020
113
99
Ya been using it when I found out about it, but 1 day I realize its missing from my extension and the google page for it went 404
Sorry for misunderstanding, I've taken the idea from this extension and fully rewritten ( is 100% mine) while keeping the title "TwineHacker" which is merely confusing if someone tries to google. I continue to develop only mine , so if you have any ideas to make it better, i'll try.
 

MokoMilk

Newbie
Dec 30, 2017
40
3
Do you activate it by ctrl + shift + H ? Cause i tried it and I can't manage to get it to activate, but nothing happen
 

BIG MAC 666

Newbie
Apr 24, 2019
28
19
so i used to be able to get this to work but not anymore it seems.So im trying to edit the cash in friends of mine and it doesnt pick up cash then i tried energy same thing. ive tried on multiple games and same thing. am i doing something wrong and yes ive done SugarCube.state.active.variables. this showed up DevTools failed to load SourceMap: Could not load content for file:///D:/nopy/Friends%20of%20Mine/es6-shim.map: System error: net::ERR_FILE_NOT_FOUND.