It looks like you're new here. If you want to get involved, click one of these buttons!
(set: $player_height to 8)
And you can use variables easy enough. $player_height
And you can put if statements easy enough
(if: $player_height < 10)[(set: $player_height to it + 1)]
That's awesome, straightforward, slightly different from normal programming syntax in other languages but fine - nothing overwhelming.Passage:PlayerAdjustment
IncreasePlayerHeight($adjustment)
{
(if: $player_height + $adjustment < 10)
[(set: $player_height to it + $adjustment)]
(if: $player_height > 7)
[(set: $player_height_desc to "tall")]
(else if: $player_height > 5)
[(set: $player_height_desc to "average")]
(else:)
[(set: $player_height_desc to "short")]
}
Passage:Start
[(set: $player_height to 7)]
[(set: $player_height_desc to "average")]
The character is $player_height_desc
Do you want the player's height to grow? Click this hook: [singleHook]<cl1|.
(click: ?cl1)[$IncreasePlayerHeight(1); The character is now $player_height_desc]
Yea, no idea how that would look getting called in / tied to a 'hook' (ie button) either..
Comments
Harlowe currently does not allow Authors to create their own macros but you can simulate this by using the (display:) macro and functional passages.
Using your example as a base, the following would do what you want:
(note: using TWEE notation, lines starting with two colons indicate a new passage, the passage's title is the text following the double colons) The IncreasePlayerHeight passage acts like a function, (display:)ing the passage is similar to calling the function, and assigning $adjustment a value is like passing a parameter.
Harlowe does allow an Author to create new Javascript functions within the Edit Story Javascript editor, but currently using/calling these functions is very messy.