Okay so I'm trying to write a fight but I've ran into 2 problems. First I need to find a way that when you click the [attack] hook it refreshes so you can essentially attack again. As you can see I tried to use (click-replace:) but it didn't solve the problem. So pretty much after you click the hook it just turns into text of the word. My second issue is when you attack the $enemyhp variable doesn't update, it just stays at 100, atleast on the page. I also tried to have the $enemyhp variable live on another passage that I would just display but that also didn't work.
(set: $enemyhp to 100)
[attack]<attack|
(click-replace: ?attack)[ (set: $enemyhp to $enemyhp - (random: $weapon-2 , $weapon+2)) [attack]<attack| ]
$enemyhp
Comments
2. Harlowe's Sensor Macros like (click:) and (click-replace:) are single use only, so if you want the hook to be converted into a click-able link again then you have to re-apply the sensor macro again.
The following consists of two passages:
1. Attack Logic
This contain the code to create the attack link, the code that gets run when the link is clicked, the code to updates the displaying of the $enemyhp output and the code that makes the link click-able again. 2. The passage in which the link and enemyhp are shown: