Trouble understanding setup objects

Twine Version: 2.3.16 (Sugarcube 2)

Hi all! I’ve been making great use of questions and answers on the forums here for a little bit but I’ve now run into a question that I’m not able to find an answer to with my current knowledge, though I suspect it’s probably a simple issue.

I’m in the early stages of learning any kind of coding. Based on advice I’ve seen, I’ve been trying to cut down on story variables by putting values that will remain static as setup objects. This sounds good in practice, but I’ve run into a bit of a problem. I can’t figure out how to access the values in setup objects!

Given my current understanding, I understand I could have variables $CurHP and $MaxHP set to certain values and if I want to display them or use them in a function, I can just type them as such. This makes health values easy enough to display, but I was wondering if I could set different characters’ MaxHP values to static values since they won’t need to change.

So I’ve tried something to the following effect in my StoryInit:

<<set setup.redKnightMaxHP = 100>>

And now I just don’t know how to access that value at all! Is there a symbol such as $ or _ that accesses these values, or is there something else entirely? Is what I’m trying to do feasible, or should I be using a different method altogether?

Thank you for taking the time to consider my ignorance!


<<print setup.nameofthevar>>
Note: the setup are fixed variables that cannot/should not be changed.

But you can also do:

<<set $var to setup.nameofthevar>>
$var ← printed on the page.


Thank you so much! It’s so simple now that you put it in front of me!