Game save triggered by button press

Harlowe is tricky to customize with JavaScript.

I figured out a method to trigger Harlowe macros via JavaScript in this section of my tips and tricks documentation… Integrating JavaScript - Triggering Harlowe Macros

So make a Harlowe link that saves your game as you normally would. However, you wrap the link in a hook and then CSS style it to be hidden.

Then you create a JavaScript keyboard event listener as you normally would, or however you are doing keybindings.

In your key binding code you create a simulated click on the link in the hook that’s hidden. It will trigger the associated Harlowe save code in the link.

I wish Harlowe would expose it’s API, but it’s not impossible to find workarounds.

Let me know if this helps.

However, if you are having any difficulty with this… please provide the code you are using for keybindings and saving your Harlowe game, and we’ll try to figure it out.

Edit: I should also mention that targeting Harlowe hooks is an execellent way to output content from your custom JavaScript as well.

1 Like