I think I'm in the right place for this question. If not, please let me know.
Okay, into the question: How can I set up an initial stat assignment? And I'm using Harlowe btw.
I just started using Twine 2 for my courses in Game Design. I love Twine and have so many great ideas that I want to keep working on this story I'm making even after the assignment for school is done. So, I've set up stats for the player to have that I want to have checks later on for and I can't seem to find anything by searching that will help me set this up properly. So far I have this:
<img src="
https://twinery.org/forum/uploads/Uploader/61/d5415f3ff56baaff43ffa12df9384e.png" />
This is the page where stats are explained to the player/reader and then they get to choose which stat they want their first (out of three) initial points put into. Once the player clicks one of these it'll go to this page:
<img src="
https://twinery.org/forum/uploads/Uploader/94/9ed90f01cee33ea154ba2c878e0140.png" />
However, when I test this Second Point page I get this:
<img src="
https://twinery.org/forum/uploads/Uploader/da/e0faf4b3cd534a0160d0591a75032c.png" />
I clicked Strength as the first point so what I
wanted to happen is it read:
Strength (2)
Intelligence (1)
Dexterity (1)
Endurance (1)
Agility (1)
Speed (1)
Instead, it's apparently changing
ALL the stats to 2 instead of only the stat clicked in the first point assignment page.
Perhaps I'm missing something stupidly simple but like I said, I just started working with Twine 2 and I'm honestly proud of how far I've gotten so far. Am I maybe missing something like "if this is clicked
then add 1 to $str? Because in debug mode I'm seeing it running all of those (set:$stat to $stat+1) instead of
only the one being clicked.
Comments
Your chief issue is that you're placing the (set:) within the link text portion of the links, which are processed as the link is being constructed, not when the link is activated. That should be obvious if you think about it for a second—if they weren't processed immediately, how could Strength($str) possibly hope to show the current value of $str.
In other words, the following constructs: Are equivalent to these: Beyond that, I'd get into the habit of using space within your macros and learning what the it keyword does within (set:).
What you want to use here is something which will only execute the (set:) when the link is activated. One way to do so would be with a combination of the (link:) and (goto:) macros—in addition to (set:). For example:
SEE: