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

content_eater

New Member
Mar 18, 2017
9
128
Yeah, I had the same (couldn't ever open Console by pressing F12) with the last "Revamped bloodlines". Maybe this is a part of anticheat system?
It works with other games though
Lol so i looked at this and it's kind of funny. It seems that website/game captures the mouse and the keyboard keys in and doesn't let the browser take in f12.

The easy work around for this is just to click the urlbar on the top (the http://...), then when you press f12 and then it pops up. :cool:

The next step is to do what Liara said:

If you can't find SugarCube on the console AND play via itch.io:
itch.io wraps a frame around sugarcube.​
Do right-click: Current Frame -> Show only this frame.​
Then you can access SugarCube via console as usual.​
It's different on chrome and firefox.
On Chrome you do it from here:
1612286615676.png
On Firefox you do it from here:
1612286648828.png


Also the gold value for this game is SugarCube.State.active.variables.sw6668686868686868 (this might change in the future), there is a value called "coin" but that wasn't it....
 
Last edited:
  • Like
Reactions: Lure of Chaos

someone999

New Member
Apr 3, 2020
6
0
hi, so i can usually edit the values using the tuturial in the op, but there are some variebles in some games that i dont know how to change.
for example i downloaded boring days, and want to change the npc stats. i found the variables using SugarCube.State.variables so then it becomes SugarCube.State.variables.NPCstats. the problem comes after, the npcs are divided from 0 to 27, in this case for example 0 is the wife which then has corruption arousal etc. and i woul think that the command should look something like SugarCube.State.variables.NPCstats.0.corruption=50 or SugarCube.State.variables.NPCstats.wife.corruption=50.
the wife command is not recognised and when i try to type numbers it doesnt work.
 

greyelf

Well-Known Member
Nov 16, 2016
1,072
787
...the npcs are divided from 0 to 27, in this case for example 0 is the wife which then has corruption arousal etc. and i woul think that the command should look something like SugarCube.State.variables.NPCstats.0.corruption=50 or SugarCube.State.variables.NPCstats.wife.corruption=50.
the wife command is not recognised and when i try to type numbers it doesnt work.
I don't know the specific project you are asking about but if the SugarCube.State.variables.NPCstats variable contains an Array, then each of the elements within that Array are accessed using its index number. JavaScript array's are zero based, so the first element has an index of 0 (zero), the second element's index is 1 (one), and so forth.

So if that NPCstats variable is an Array and you wanted to access the first element of that array you would do the following...
Code:
SugarCube.State.variables.NPCstats[0]
If the value of that element is an Object that contains a corruption property, and you want to set that property to 50 you would do the following...
Code:
SugarCube.State.variables.NPCstats[0].corruption = 50
 

Lure of Chaos

Member
Apr 21, 2020
113
99
hi, so i can usually edit the values using the tuturial in the op, but there are some variebles in some games that i dont know how to change.
for example i downloaded boring days, and want to change the npc stats. i found the variables using SugarCube.State.variables so then it becomes SugarCube.State.variables.NPCstats. the problem comes after, the npcs are divided from 0 to 27, in this case for example 0 is the wife which then has corruption arousal etc. and i woul think that the command should look something like SugarCube.State.variables.NPCstats.0.corruption=50 or SugarCube.State.variables.NPCstats.wife.corruption=50.
the wife command is not recognised and when i try to type numbers it doesnt work.
Works like a charm!

Few things to remember:
  • Be careful typing. For example here you would type SugarCube.State.variables.NPCstat[0].corruption=50 not SugarCube.State.variables.NPCstats.wife.corruption=50
  • Please avoid altering when you are in "secondary screen" with the only option to "return": profile screen, stats screen etc, as those changes would be reverted to prevoius state. Or use "lock" checkbox if use extension
  • Though changes (as using extension as typing in console) are applied immediately, you should make any action in game to see that changes are there (game needs to update, or "render" again texts with variables)
Good luck young crack! (c)
 

JP Woods

Newbie
May 19, 2017
42
12
Hello, I'm just curious why can't sugarhack work on a game like [Unity] Bloodshift, while it work on a game like
HTML:
 College Daze, does it work only for game that are html type, and not unity type, or any other kind of type?
 

Lure of Chaos

Member
Apr 21, 2020
113
99
Hello, I'm just curious why can't sugarhack work on a game like [Unity] Bloodshift, while it work on a game like
HTML:
 College Daze, does it work only for game that are html type, and not unity type, or any other kind of type?
Hell yeah, different tools for different game engines.
For Unity games there are no universal tool, you could try use smth like ArtMoney for those
 

riadhloch

Member
Jul 1, 2018
214
293
I'm in the console for a game and I have an odd array I'm not sure how to access (v's indicating nesting). The standard use of brackets to access an array (e.g. [0].blahblah) doesn't seem to work:

SugarCube.State.active.variables.characters
v Map(1) {0 => Character}
vv [[Entries]]
vvv 0: {0 => Character}


Any suggestions?
 

Lure of Chaos

Member
Apr 21, 2020
113
99
I'm in the console for a game and I have an odd array I'm not sure how to access (v's indicating nesting). The standard use of brackets to access an array (e.g. [0].blahblah) doesn't seem to work:

SugarCube.State.active.variables.characters
v Map(1) {0 => Character}
vv [[Entries]]
vvv 0: {0 => Character}


Any suggestions?
Please provide concrete example: game title, object path.
As alternative you may try my TwineHacker browser extension (works in Chrome and Firefox Development Edition)
 

vimey

Active Member
Nov 29, 2020
823
599
Using Chrome isn't an option?
it worked on edge my bad I had to extract the other winrar file but to use the lock feature you have to keep it open right
edit : I figured out how to keep it open in separate window the other twinehacker just stopped working for me but yours is much better thank you for your good work
 
Last edited:

Lure of Chaos

Member
Apr 21, 2020
113
99
it worked on edge my bad I had to extract the other winrar file but to use the lock feature you have to keep it open right
edit : I figured out how to keep it open in separate window the other twinehacker just stopped working for me but yours is much better thank you for your good work
Thanks!
 
  • Like
Reactions: vimey

greyelf

Well-Known Member
Nov 16, 2016
1,072
787
can somebody help me here
While the web-browser addon you're using is called "Twinehacker" it really should be named "SugarCubeHacker", because it really only supports one of the Story Formats that a Twine based project can be built with. eg. SugarCube.

Unfortunately for you the Twine project you're trying to hack was built using Harlowe, which doesn't include a JavaScript based debugging API like SugarCube does.
 

Lure of Chaos

Member
Apr 21, 2020
113
99
Unfortunately for you the Twine project you're trying to hack was built using Harlowe, which doesn't include a JavaScript based debugging API like SugarCube does.
Moreover, Harlowe cannot be hacked so easily without modifying game source, it makes me sad