Need help with basic player information systems

If you are requesting technical assistance with Twine, please specify:
Twine Version: 2.3.16
Story Format: Harlowe 3.2.3

I’m a complete and utter newbie at this system, so apologies in advance if this is a stupid question, but I’ve been trying to make a simple system for the player to input their name and gender, and for those to be used all throughout the story.
For the name, I’d prefer to use code that has a little input box below the prompt (instead of the in-your-face-dialog-box I get when using the browser version), asking for the name, and below appearing a choice between male and female, where one of the choices disappear when selecting the other one and more text appears below it, as well a list of choices for species (therefore the ‘born a…’ line at the end).

Here’s my code so far:

(set: $name to (prompt: "What is your name, bold adventurer?", "Kvathe"))
Excellent. Now, you are a...

(link: "male")[(replace: ?links)[male]]
(link: "female")[(replace: ?links)[female]]
(set: $gender to ?links)\

Born a...

Thanks in advance for the help!

Here’s the documentation for the input-box macro, which if I’m understanding correctly is what you want for the name. So the following…

What is your name, bold adventurer?

(input-box: bind $name, =X=, 1, "Kvathe")

… will get you the “What is your name” text and on the next line a text entry box that is 33% of the passage width and one line high and that will set the $name variable to whatever is typed in the box, displaying the text “Kvathe” as the default.

As for the gender, I think that’s throwing an error because by having (set: $gender to ?links) inside of ?links, the value to which you’re trying to set $gender includes the command to set $gender, if that makes sense. The easy way around this is:

(link: "male")[(replace: ?links)[male](set: $gender to "male")]
(link: "female")[(replace: ?links)[female](set: $gender to "female"]\

Not very elegant, but it works. Someone who’s more adept with Harlowe might be able to give you a neater way of doing this.

Hey there! Sorry for responding so late, and thanks for the help!
For this:

What is your name, bold adventurer?

(input-box: bind $name, =X=, 1, "Kvathe")

It was suggested to use ‘*’ instead of ‘X’ in here:

bind $name, =X=

Although doing that gave me this error:

Unexpected token ‘,’
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.

(Small edit, I was able to solve the issue by making it:

What is your name, bold adventurer?

(input-box: bind $name, "=X=", 1, "Kvathe")

I did get a box that asks for an input, but there wasn’t a way to confirm the name choice, so I’m confused about that.)

For this part:

(link: "male")[(replace: ?links)[male](set: $gender to "male")]
(link: "female")[(replace: ?links)[female](set: $gender to "female"]\

The replace part worked well, but after that I added:

So you are a $gender...

But sadly, it didn’t really print out, probably because I was doing it in the same passage.
I’ll try to look more into it, but more help would be appreciated!
Also thanks for the help!

Whoops, yes, my bad, it should be "=*=". The missing quotation marks are my fault and the X/* is the documentation’s fault, but at least it gave you a helpful error message!

There isn’t a “confirm” button because it’s not necessary – if you run it in debug mode, you can see that the $name variable is set to whatever you type in the box as soon as you type it. If you wanted to do something like you’re doing with the gender, that would be along the lines of:

(input-box: bind $name, "=*=", 1, "Kvathe")
(link: "Confirm")[(replace: ?name)[$name]]\

And yeah, adding “So, you are a $gender…” (I’m assuming this is a replacement for the “Born a…” prompt to select your species?) underneath the “links” hook won’t work because it calls the variable when it loads the passage, at which point it’s blank.

If you want to do that, the easiest way is to split your character creation up into multiple passages. If you have a “continue” link under the gender selection that goes to the passage “character creation 2” or whatever and start the new passage with “So, you are a $gender…” that will work fine.

If you have your heart set on doing it all in one passage, you could do something like:

(link: "male")[(set: $gender to "male")(replace: ?links, ?gender)[$gender]]
(link: "female")[(set: $gender to "female")(replace: ?links, ?gender)[$gender]]

So, you are a |gender>[]...

Which will display “So, you are a …” before you select a gender and then insert “male” or “female” where the “gender” hook is.