Selected Harlowe Macros

Setting Variables

  (set: $hasKey to false)
  (set: $numberOfMonsters to 5)
  (set: $player to "George")
  

Prompting from the user

  (set: $player to (prompt: "What is your name", "default"))
  (set: $number to (num: (prompt: "Pick a number between 1 and 10", "5")))
  

Rolling a random number

  (set: $die to (random: 1, 6))
  (set: $percentage to (random: 1, 100))
  

If / Else

  (set: $player to (prompt("What is your name? ", ""))
  (if: $player is "Andy)[
    Are you the teacher of this class?
  ](else)[
    Have you seen Andy around?
  ]
  
  (if: $hasKey is true)[
    [[open the door->open]]
  ] (else:) [
    [[look for the key->search]]
  ]
  

Combat set-up

  (set: $weapon to "dagger")
  (set: $myMaxDamage to 3)
  (set: $myHP to 30)
  (set: $eMaxDamage to 3)
  (set: $eHP to 40)
  

Combat

  (set: $myDamage to (random: 1, $myMaxDamage))
  (set: $eDamage to (random: 1, $eMaxDamage))
  (set: $eHP to $eHP - $myDamage)
  (set: $myHP to $myHP - $eDamage)
  You hit the ogre with your $weapon.
  You do $myDamage points of damage to the Ogre.
  The Ogre does $eDamage points of damage to you.
  Your HP: $myHP
  Ogre HP: $eHP
  (if: $eHP <= 0)[
    [[You defeated the Ogre!->start]]
  ](else-if: $myHP <= 0)[
    [[You were defeated by the Ogre->start]]
  ](else:)[
    [[Hit the Ogre with your $weapon->fight]]
    [[Run away->run]]
  ]
  

Combat upgrade weapon

  (set: $weapon to "sword")
  (set: $myMaxDamage to 6)
  

Combat health potion

  (set: $myHP to $myHP + 10)