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

Jul 29, 2019
109
33
The instructions you followed are meant to be used on Twine based project's built with the Harlowe Story Format, and Accidental Woman isn't such a project.

Accidental Woman by ThaumX is built using a custom variation of the SugarCube Story Format (named SugarCubeAW), that has modified so its variant of the undocumented debug interface no longer exposes the . This is why the Story & Temporary variables can't be accessed using like SugarCube.State.variables or SugarCube.State.temporary.

It's also why a Twee Notation compiler like TweeGo can't be easily used to "decompile" the Accidental Woman Story HTML file.
I mostly wanna find a good way to kinda change the way arousal builds up, micromanage some stuff, and make it so clothes are generated with higher attractiveness. Among other things.
 
Jul 29, 2019
109
33
The instructions you followed are meant to be used on Twine based project's built with the Harlowe Story Format, and Accidental Woman isn't such a project.

Accidental Woman by ThaumX is built using a custom variation of the SugarCube Story Format (named SugarCubeAW), that has modified so its variant of the undocumented debug interface no longer exposes the . This is why the Story & Temporary variables can't be accessed using like SugarCube.State.variables or SugarCube.State.temporary.

It's also why a Twee Notation compiler like TweeGo can't be easily used to "decompile" the Accidental Woman Story HTML file.
Could it be modified so it does show up, just like I did with Harlowe? Or not really, cause it might actually need a key or advanced editing?
 

Daenerys5539

Newbie
Aug 17, 2016
60
12
Is there a way to make a variable static? eg. Make hunger/cash/energy etc variable reset itself automatically to full?
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
Is there a way to make a variable static? eg. Make hunger/cash/energy etc variable reset itself automatically to full?
Technically it could be possible to use the Web-browser's Console to add an event handler to a released project, that monitors for the custom event that gets triggered before the current state of all known Story Variables is persisted to Progress History during the Passage Transition process, and that event handler could then "reset" the value of the relevant Story Variable(s) before they are persisted to History.

But there is no built-in event that is triggered at the point in time that a variable's value is actually changed.
 

AllenDeez

Newbie
Dec 9, 2023
23
4
Can i have some help with the console command SugarCube.State.variables

because whenever i change a variable it won't reflect on the game Currently trying it on "a hard pill to swallow"

i write it like this SugarCube.State.variables.cash = 20000 or like this SugarCube.State.variables.cash=20000 but it won't reflect on the game so is there an option i have to allow first
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
because whenever i change a variable it won't reflect on the game
Any variable change you do in the web-browser's Console won't take affect until you use one of the blue link on the page to preform a Passage Transition.

eg. If you are currently viewing the "Business Floor" passage of the "A Hard Pill to Swallow" project, and you use the Console to execute SugarCube.State.variables.cash = 20000, then the amount of Cash shown in the Left Sidebar won't change until you've select one of the blue links (like "Go To Your Office" or "Go to the Lab") on the page.
 
  • Like
Reactions: AllenDeez

Lure of Chaos

Member
Apr 21, 2020
113
99
then the amount of Cash shown in the Left Sidebar won't change until you've select one of the blue links (like "Go To Your Office" or "Go to the Lab") on the page.
That's true. Also changes would be reset if you getting "back" from any "help" screen: history navigation links from left sidebar, character info, any informational one (probably any link clicked from the left sidebar menu). Popup dialogues do not revert those changes.
So: make console changes, progress in the game and you'll see the effect, if any.
P.S. for such trivial changes I recommend my SugarMelt tool.
 
Last edited:
  • Like
Reactions: AllenDeez

AllenDeez

Newbie
Dec 9, 2023
23
4
Any variable change you do in the web-browser's Console won't take affect until you use one of the blue link on the page to preform a Passage Transition.

eg. If you are currently viewing the "Business Floor" passage of the "A Hard Pill to Swallow" project, and you use the Console to execute SugarCube.State.variables.cash = 20000, then the amount of Cash shown in the Left Sidebar won't change until you've select one of the blue links (like "Go To Your Office" or "Go to the Lab") on the page.

Thank you very much
 

teken0

New Member
May 26, 2018
4
4
does anyone know how to use it in x-change life? i tried both the SugarCube.State.active.variables and the TwineHacker and did not worked
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
note: There are multiple Story Formats an Author can choose from when building a "Twine" based project, one is SugarCube and another is Harlowe. And each of these Story Formats is a self contained engine, that defines its own core functionality.
This specific thread is dedicated to how to debug (or cheat in) a SugarCube based project. And while the name of the TwineHacker tool implies it's for any "Twine" based project, in reality it would be better named as SugarCubeHacker.

does anyone know how to use it in x-change life?
If you mean X-Change Life by Aphrodite, then according to the information stored in the <tw-storydata> element of its X-Change Life.html file, that project is Harlowe based.

And unfortunately that Story Format's developer has decided not to provide a means for an Author to debug a Harlowe based Story HTML file using a web-browser's Console.
eg. there is no Harlowe equivalent of the undocumented SugarCube debug interface.

However, according to the information accessible from the Extras section this thread's original post, the project does include a built-in cheat menu.