I’m trying to add to variable inside a passage by using a click macro. (Part of a character creation system I’m working on.) This is what I have so far;
(set: $Health to 8)
Health = $Health [Health +1]<Health1|
(click: ?Health1)[
(set: $Health to $Health +1)
]
So when Health + 1 is clicked the following function happens and is supposed to add + 1 to $Health. However when Health +1 is clicked the value of $Health does not change. Does anyone know what I might be missing?
Thanks!
Comments
This means that any changes to the variable's value will not be seen on the current page unless you cause either the page or parts of it to be updated, and you can use macro's like the (replace:) macro to do this.
I'm new to twine so I'm sure the answer is once again very simple, I’m missing the correct syntax probably, but I’m currently trying to replace Health +1 when it is clicked with the same clickable piece of text. Essentially allowing the player to allocate points into health and later on other statistics. So far, the code will replace Health +1 with text but it will not be clickable or in this case it simply disappears.
I'm thinking the code needs a line of logic that will make the clickable button appear only if there if there is a certain amount of attribute points but I'm not sure if twine will recognize that's what I'm trying to do?
Any suggestions?
Since the above meantioned solution was written a [url="http://"](link-repeat: ) macro[/url] has been added to Harlowe. note: I needed to add Collapsing whitespace markup to the above to stop the page becoming a little longer each time the link was clicked, the increase in page length was due to the line-breaks on the end of each statement within the (click:)/(link-repeat:) macro's associated hook.
I looked at the collapsing whitespace markup and that does seem to work for a the code I have already but doesn't include code that is created afterwards =/