WHat's wrong with this?

<<set: $difficulty to 14>>
<<set: $roll to random(1,20) + constitutionModifier>>
<<if $roll > difficulty>>You slam into the ground, miraculously uninjured.<>You slam into the ground, stunned.<<set: $health to 75>><>

2 Likes

You’ll want to wrap your code within a “preformatted text” marker so that we can see all of it, since this forum usually hides the contents of SugarCube macros.

That said, I see two problems right off the bat.

  1. Your <<set>> macros shouldn’t have a “:” in them like that. So, the first line should just be this: <<set $difficulty to 14>>
  2. Your variables all need to start with “$” for story variables or “_” for temporary variables. Thus the rest of the above should probably be like this:
<<set $roll to random(1, 20) + $constitutionModifier>>
<<if $roll > $difficulty>>\
	You slam into the ground, miraculously uninjured.\
<<else>>\
	You slam into the ground, stunned.<<set $health to 75>>\
<</if>>

(The “\” prevents a line break.)

Have fun! :wink:

That fixed it! thanks so much! I’m used to harlowe, so I didn’t know about the set difference.