Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2.3.5
Story Format: Harlowe 3.1.0
Hello, I’m starting out a project and one of the first questions is asking for name. I’m using (prompt:) to obtain that (thus getting the JavaScript popup box to collect user input), and then using (confirm:) to showcase the name and let the user confirm if they like that name or want to change it (storing the result in a boolean variable).
These macros are working more or less fine for me (the actual name in the confirm prompt is showing up as " " instead of the value collected in (prompt:) but it’s showing up correctly outside of (confirm:) so I’ll mess with it later), but what I would like to do is loop the two popups ((prompt:) and (confirm:)) until $confirmName returns true.
I tried using the (for:) macro (and swapped out (for:) for (loop:) since they appear to be interchangeable), but by the looks of it, (for:) was designed more with cycling through array values and datasets and less for what I’m intending. If it helps, the script I was attempting to execute with this macro looked something like this:
(set: $name to (prompt: "What is your name?" "name"))
(set: $confirmName to (confirm: $name. Is that correct?))
(for: _confirmCount where $confirmName is false)[
(set: $name to (prompt: "What is your name?" "name"))
(set: $confirmName to (confirm: $name. Is that correct?))
]
Your name is $name.
So what I’m trying to find out is if I can use the (for:) macro like a way I would use a loop in say Java and my syntax is just wrong, if this macro isn’t appropriate for my intended purpose and there’s another one that’s more appropriate (though I couldn’t find one in the documentation), or if I’m going to need two passages linked to each other with if/else statements and create the loop that way. Or if I could potentially build my own macro to plug in with JavaScript. Thanks!