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 into
State.variables.cash
in order to be accessed (
_temp
into
State.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, in
State.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 using
document.getElementById('player_CP')
and not the SugarCube
<<set>>
macro, hence the reason
State.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 the
SugarCube.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 at
15
, now the player uses the console and sets
$love to 1000
the game can't make sense of the value
1000
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