- Mar 15, 2024
- 6
- 7
sorry sis.I never knew girls would be interested in this kind of game.It's actually sis
Keep in mind I'm a beginner with HTML and Twine SugarCube...
Variables in a twine SugarCube game most always start with the$
sigil e.g.$cash
or$item1
in this game, and are global. Temporary variables start with an underscore e.g._cash
and will only be usable within the one passage.
Twinescript variables are javaScript variables,$cash
is parsed intoState.variables.cash
in order to be accessed (_temp
intoState.temporary.temp
). HTML as such does not have variables and need to be set using JavaScript.
This kind of parsing happens on multiple levels (in passage when printing naked variables ($cash
), in macro arguments, inState.getVar()
...). The<<set>>
macro parses its contents this way. (e.g. how a variable is set,<<set $cash to 1000>>
).
In this game for example the CP or (confidence points) are set usingdocument.getElementById('player_CP')
and not the SugarCube<<set>>
macro, hence the reasonState.metadata.set("CP")
.
But yeah, most SugarCube games use$variables
(can be found in a passage called "StoryInit", used for pre-story-start initialization tasks, like variable initialization (happens at the beginning of story initialization)).
Hence theSugarCube.State.variables.
...
If you look inside the game code you can find every variable, however, always have this at the back of your mind though;
Using the console command can break the game, so use them at your own risk!
Also, this may lead to;
1. Missing events
2. Triggering events that weren't supposed to happen at certain parts
3. An experience more buggy than it would without using the cheat
Reason: Sometimes a dev sets a max on a variable, meaning if you go over said maximum the game can't process the variable anymore and the player is stuck and can't level up or progress with the story for example.
Lets say the variable love is set to<<set $love to 0, maxLove to 100>>
and triggers an event when$love
is at15
, now the player uses the console and sets$love to 1000
the game can't make sense of the value1000
and the event that was suppossed to trigger at$love 15
doesn't. Hence the reason player effing up games and think it's a bug...
...anyway, sorry for my lenghty rambling
anyway,thanks for reply.I'm going to take some HTML courses, I guess that would be more fun than this game