User-input text conversation with NPC, help!

Hello!

Writing with a question, I’m not sure how to even approach this or whether it’s possible.

I’ve been creating my first game in Harlowe 3.2.2. over the last month or so, it’s gotten pretty expansive! That said, I’m polishing certain features up a bit and was wondering if there’s a way to have an user-input typing option in a pop-up box.

By this I mean something similar to what Inform7 does but very simple. I was hoping to have it so when a player meets a NPC, a pop up box appears with dialogue from the NPC and a prompt for the player to type their answer.

I know there’s a lot of logic that can go into this, you can’t control what the player types, but I just need a way for the player to type simple, short, answers that prompt the next piece of dialogue, until finally the conversation leads to a passage depending on how the talk went.

I tried to mess around with the prompt feature… something like:

(set: $creature to (prompt: "He's a...", "Answer"))
(set: $correct to "Monster")

(if: $creature is $correct)[
	(go-to: "Correct Answer Passage")
]
(else:)[
	(go-to: "Incorrect Answer Passage")
]

But I can’t seem to have it persist for what feels like a conversation… It works well with one and done answers.

How would I go about getting this accomplished?

Twine Version: 2.3.14
Story Format: Harlowe 3.2.2.

Conversations are tricky in choice-based systems. I can understand the impulse to give the player freedom to type something, but when presented with a text-input field, you open up the chance of the player typing something correct but with “extra” stuff that will cause problems because you will need to check every possible variation of correct input.

If the right answer is “monster” what if the player types “creature”? Will that also do? What about “lovable monster” “ugly monster” “complete monster”?

The way I tend to do this is avoid the type-in field and give the player some leeway with the correct answers by having several:

He’s a…

  • person
  • human
  • monster <-correct
  • COMPLETE monster <-correct
  • a monster, but with feelings and emotions like everyone else <-correct
  • brick…house

As far as carrying on a conversation, again, that’s stylistic. One sort of trick I do is simulate a back and forth by updating the text, making it seem like passages update but don’t advance (even though they do.)

:Passage1
“Really, you don’t think Herbert’s a human do you?”

  • He’s a human. [passage2]
  • He’s a monster [passage3]
  • I don’t know. Hey, are you hungry? [lunch]

:Passage2
“Really, you don’t think Herbert’s a human do you?”
“Of course he’s a human,” you insist.
“Well, what makes you believe that?”

  • He’s been nice to me. [nice]
  • I’ve done a battery of tests. [tests]
  • Just a hunch, I guess. [hunch]
  • I don’t care. Where are we eating today? [lunch]

:Passage3
“Really, you don’t think Herbert’s a human do you?”
“No, he’s a monster. I’ve confirmed that,” you reply.
“Well. That’s good. What do you think we should do about it?”

  • Obviously, we’ll need to hunt him down in the air vents. [vents]
  • I figure if we just put food out at night, he’ll not get hungry and leave us alone. [alone]
  • Is it possible that in reality we are the monsters? [wearemonsters]
  • I think we should go to lunch. [lunch]

:lunch
“I can’t believe you don’t find this situation with Herbert more important.”

  • Yeah fine, are we getting sushi? [sushi]
  • I brought my lunch, do you want to trade a rice krispie treat? [krispie]
  • Wait, something’s wrong with Herbert? [Passage1]

You don’t have to trace back the entire conversation in each passage, especially if the dialogue is circuituitous, but it just requires planning out conversation in nodes and it helps if you write trickily so each passage can be a lead-in to any other - either by non-specifity or text variation. You can set variables where if you come from a passage where the other character gets angry, it varies the response accordingly even if multiple passages or conversation nodes lead there.

1 Like

Thank you for the response! This is a good idea, I have something similar for my “combat system”, where the descriptions allow more than one choice to be “correct” during a combat scenario.

I probably should leave it at this, you’re right to say user text-inputs can be more frustration for the player than liberating in it’s illusion of freedom. You know how it is, you want to shove as much into a project as possible haha, I was just curious if there was an easier way to accomplish text-inputs, but the simplest way is often the best.

Thank you again for the example, it helps a lot to see how someone else does it!!

1 Like