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

whalat

Newbie
Sep 27, 2017
50
63
Did anyone get Sugarcube hacker working recently?
I've been trying it on both chrome and firefox and it seems to install just fine it still doesn't do anything.
I managed to find a working version and I'm leaving it here for anyone else that needs it.
 
  • Like
Reactions: kino4ka

fernandopoo

Member
May 22, 2017
151
127
Sorry to disturb you with my ignorance... But I cannot manage by myself. I have install the hacker in firefox developer edition, open the console and paste the json script... even add the two posibilities mentioned for SugarCube one and two...
don't know if I have to end the sentence with ; or if I have to use ' or " in the console.... summarizing, I dont know what code to write even if I have discovered that $cash=int is for the money (I am playing Masters of Raaa). Any help, plz?
 

Tsuyefk

New Member
May 12, 2017
1
0
There used to be a tool which you could copy and paste the code into browser console (or at least it worked for Firefox) and it would enable it. You'd have to input which instances you wished to edit but it was relatively easy to use. I remember it having an eye or something for each instance. Anyone know of what I'm talking about and is able to share it?
 

KVAtlantis

Member
Dec 27, 2017
103
72
There used to be a tool which you could copy and paste the code into browser console (or at least it worked for Firefox) and it would enable it. You'd have to input which instances you wished to edit but it was relatively easy to use. I remember it having an eye or something for each instance. Anyone know of what I'm talking about and is able to share it?
https://f95zone.to/threads/twine-sugarcube-cheat-script.66144/
i think you mean this^^
 

korte7

Newbie
Jul 20, 2020
16
28
I have a somewhat unrelated question. I looked at the HTML and I could find the gallery videos, which I want to set to looping, however when I add loop next to controls in the main HTML file, the game doesn't start, it seems to load forever. When I set them back to only controls it works again. Does anyone know why this is how to set all videos to loop in the gallery (the game is Grand Smash)? I suppose there might be some general setting which causes a contradiction in the code?
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
however when I add loop next to controls in the main HTML file, the game doesn't start,
How exactly are you editing the HTML <video> elements?
  • decompiling the HTML file into a Twine or Twee project, editing the elements, and then re-creating the HTML file again.
    (this method will have the best outcome, as you don't need to worry about the Passage content being encoded)
  • opening the HTML file in a Text Editor, and manually editing the elements.
    (this could cause issue if care isn't taken regarding the fact that the Passage content may be encoded)
  • some other means.
I reviewed the <video> element being used to display the "Gallery" content, and they had a structure like...
Code:
<video class="video-group" src="visuals/chars/abella/turkey/first01.mp4" width="100%" controls=""></video>
...so it appears that a video-group CSS class is being used as an identifier.

So entering a command like the following within the Console of your web-browser...
Code:
$('video.video-group').attr('loop', true)
...will (temporarily) alter all the video elements in the Passage currently being displayed to have looping enabled.

It would take a lot more effort to permanently alter all those video elements.
 
  • Like
Reactions: korte7

korte7

Newbie
Jul 20, 2020
16
28
How exactly are you editing the HTML <video> elements?
I was doing it in a text editor, so option 2.

So entering a command like the following within the Console of your web-browser...
Code:
$('video.video-group').attr('loop', true)
...will (temporarily) alter all the video elements in the Passage currently being displayed to have looping enabled.
I tried this and it works but only for the current page, which is expected I guess. I will try the decompilation method if I'm bored sometime, thank you very much.
 

DarkEnchanter

New Member
Dec 30, 2023
11
4
I have read several times here the question of how to close the Twine hacking tool again. I haven't seen anyone answer this yet.

The answer is => Just click on the "Gamestate" button again and the tool closes.
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
looking for the proper Sugarcube for money plz
SugarCube itself has no concept of "money", it is the Author who decides what variables their project will have and how those variables are named. So there is no proper Sugarcube for money.

You need to tell us which project you want the information for, so we can tell you what its Author decided to call the variable.

eg. some examples of the sort of variable names some Authors have used.
Code:
$money
$cash
$dollars
$gold
$player.money
$mc.currency.current
 

Sk1tz

Newbie
Nov 9, 2021
86
21
SugarCube itself has no concept of "money", it is the Author who decides what variables their project will have and how those variables are named. So there is no proper Sugarcube for money.

You need to tell us which project you want the information for, so we can tell you what its Author decided to call the variable.

eg. some examples of the sort of variable names some Authors have used.
Code:
$money
$cash
$dollars
$gold
$player.money
$mc.currency.current

trying to use on Become Alpha
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
trying to use on Become Alpha
The Author of that project seems to store the amount of cash the player has in the $player variable's cash property, so the web-browser Console command for changing the amount is...
Code:
SugarCube.State.variables.player.cash = 1000
...where the 1000 can be replaced with any other positive number.
 

Nahksius

Newbie
Aug 2, 2023
17
14
Not sure if anyone asked this one yet, but anyone know the variables for, "Beef In The City v0.14.0"?


Specifically need the Variable for the Cheat Button Menu.

its only got the one actual in game cheat to unlock the patreon.

i'm only asking for the variable so i dont have to come back every update for the code, but tbh i been at this for soooooo long tryna figure out what y'all are saying, my problem isn't understanding it's actually finding the shit, lol. i know basic coding, if/then statements, i can understand how to do it, and changed my money values already, but i juust can not find this code. if I can get some help, with either the code, or the variable so i can change the code you guys would be like superman right now. exhausted myself trying...

[P.S.} IN ADVANCED!!!! To whomever may help me, if'n the hero is out there, thank you, from the bottom of the dark cavernous pit that i call a heart, and I love you! lol
 

Nahksius

Newbie
Aug 2, 2023
17
14
Sorry for my ignorance, but is this also compatible with Firefox, it won't show when I navigate to it through the "add extension from file" interface
yeah mine isnt showing up anywhere on add extensions or anything. but when i view developer mode, it says something about twine in there, so it's partially worked? maybe? idk, cause i came here and saw everyones screenshots of the in game menu it pops up with EVERY option available for change and im guessing i'ma be back to square one now... lol
 

Nahksius

Newbie
Aug 2, 2023
17
14
For future reference:
For downloads refer to PAGE ONE, SECOND POST!
To install Twinehacker on Chrome:

View attachment 85784
View attachment 85772
View attachment 85776
View attachment 85777
To find the keyboard shortcut:
View attachment 85766
View attachment 85768
View attachment 85771
Yeah, and i'm just lost now on how its not even in this spot when i look. sugarcube v.2 AND twine both dl and un-dl, to re-dl, and i just dont know why they arent in the "LOAD UNPACKED" area. already unzipped them, put them in in new folders in the folder in the zip file, ive mixed and matched it all, and i'm beginning to believe i may just be absolutely fucking retarded at this point man.. haha. i know enough about coding to be making a few games in UE4 from back in HS when i took coding, animation, and bcis, but i am a stoopid people who just needs someone to walk me through shit first so i can see it, then i'll get it, after seeing specifics, but all these tips from everyone is like trying to use MapQuest back in the day. printing out a 9 page book, with "go left, continue for 800ft, then go right and continue for 14 miles... etc. the concept was good, and it helped give me an outline, but you ALWAYS missed like 3 exits or some shit, cause its not like gps that follows you, so when your turns coming up, it shows you directly you know?
mapquest was anxiety, and autism freakouts all day for me lmfao. and figuring this shit out with all the lil problems is wrinkling my brain, lil simple issues that are EVERYWHERE, and i gotta go back to these forums and re-research, then go back and search for 4 hours before i see that it was just 1 button or something. I apologize for the book, but im so lost, maybe i just needed the vent. lmao. i appreciate your time and effort in helping guide me this far tho, I'm just confused now as to why no extension i download is even showing up.. it threw me back to the stone ages with that shit, and now i'm just smashing rocks on trees like the caveman i am and seeing if an answer comes flying out of one when it breaks. XD
thanks again, and more apologies for the novel of a comment. i'm a writer and i have a terrible habit of feeling like "This really is the shortest i can make this, AND be as detailed as i can about it" I prolly really do got autism my <removed>, X'D
 
Jul 29, 2019
109
33
You would need to add code like the following to the JavaScript section of the project...
Code:
if (!window.harlowe){
    window.harlowe = {"State": State};
}
...which would create a harlowe JavaScript variable that you could use to access the story format's State from the Console...
Code:
harlowe.State.variables
WARNING:
Harlowe's History system is based on , so it doesn't work the same as SugarCube's. Harlowe also uses its own custom implementations of the Array & Data-map objects internally, so they don't always behave the same as the Standard JavaScript implementation.
Because of this care needs to be taken when using JavaScript to altering an Array or a Data-map variable, because you can easily corrupt previous Moments in History if you update the object without first cloning it.

eg. if a DataMap variable was last updated in the project three Passage's ago, then the most recent instance of that object would exist in the Moment that represents three steps in the 'past'. And if you directly altered that object (without cloning it first) then you would be altering that past Moment as well as the ones between that one and the 'current' Moment.
Hi, I got that working, and can now change variables in Accidental Woman, but I'm just wondering, there's still several variables I can't find, such as stats, clothing, etc, whereas I can see items, cash, and other stuff. Also, do you know a way of freezing a variable? I know how to do it in cheat engine, but not html console.
 

greyelf

Well-Known Member
Nov 16, 2016
1,071
787
I got that working
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.
 
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.
Thanks! But do you know what can I really do then? Cheat engine isn’t really that viable for the type of stuff I’m trying to do.