Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Harlowe gotcha: Browser can freeze due to a typo

I've noticed that some people (myself included) have taken to reloading the same page when the user clicks a hook (usually in order to force something to redisplay). This works pretty well, but a typo - not in the click handler itself, but *before* it - will cause strange behavior during testing.

Usually, no text is output on the page, and the browser freezes for some period of time (could be short, could be longer). The javascript console usually prints some kind of error, but it's not always a useful error. I got "<span style="color:red">call stack exceeded</span>" in a previous test, but my current example just says "&lt;error&gt;" and leaves it at that.

Here's the sort of typo that will cause you trouble.
Here is a good hook: (hook:"good_hook")[A good hook]
Here is a bad hook: (hook: "bad_hook"[A bad hook]

(click: ?good_hook)[
(goto:"Crash Twine")
]
The missing right paren after <b>(hook:&quot;bad_hook&quot;</b> is the problem. It's mostly harmless unless you've got a handler going to the same page. The 'goto' gets executed without waiting for a click, which creates an infinite loop.

As you can see from the above example, the click handler doesn't have to be pointing at the malformed hook - it just have to be after it on the page.

I have a hard time calling this a 'bug,' because it depends on the writer making a particularly unfortunate typo, and I'm not sure what I'd *expect* to happen. Still, it's a bit difficult to diagnose, so I thought I'd make a note of it in case somebody else experiences the same behavior and happens to run across the thread. If your page is completely blank and your browser's slow to respond during testing, check to make sure you're not missing a right paren somewhere.
Sign In or Register to comment.