I’m trying to create dialogue boxes in my story as pop-up boxes. I tried each type of pop-up box, but none of them work.
The (dialog:) macro gave me this error:
Unexpected string
This error message was reported by your browser’s Javascript engine. I don’t understand it either, but it usually means that an expression was badly written.
My code was (link:"dialog")[(dialog: "Confirm?" "Yes" "No")] which seems correct to me?
The (confirm:) macro gave me this error in a pop-up box (the irony stings):
Sorry to interrupt, but this page’s code has got itself in a mess.
TypeError: d.render is not a function
TypeError: d.render is not a function
at HTMLElement.
at Function.each
at w.fn.init.each
at Object.execute
at Object.renderInto
at clickEvent
at HTMLElement.
at HTMLElement.dispatch
(This is probably due to a bug in the Harlowe game engine.)
The (prompt:) macro just didn’t do anything – I had it nested in a link, which disappeared when I clicked it and nothing else happened.
Well, I’m pretty much the walking how-to-make-a-tiny-formatting-mistake-that-ruins-everything guidebook. XD I just realized I forgot the commas, and that fixed most of my problems. For some reason, though, I’m still unable to bind a variable to the dialog macro?
As you’ve realised, and as it’s shown in the usage section of the (dialog:) macro documentation. you need to use a coma to separate each argument being passed to a macro.
The following is a variation of the above that persists to a variable named $confirmed the String value of which button (“Yes” or “No”) was used to close the shown dialog.
You can use basic debugging code like the following to test what was assigned to the $confirmed variable. Select the “dialog” link first, then the “Check” link to confirm the current value of the variable.