Note that there are some explanatory texts on larger screens.

plurals
  1. POPython tree-based chat bot
    primarykey
    data
    text
    <p>I'm working on a text-based RPG in Python, but I'm stuck on NPCs. I need something that's kind of like a tree. For example:</p> <pre> Bot: hello there. 1. Hi, what's your name? 2. Hi, Where do you live? > 2 Player: Where do you live? Bot: That's a creepy question. Why do you ask? 1. I was just curious. 2. Never mind. 3. Hide yo kids, hide yo wife > 1 Player: I was just curious. Bot: Okay. 1. Do you like cheese? 2. Bye. > 1 Player: Do you like cheese? Bot: Yes! I LOVE cheese. </pre> <p>Each choice you make would branch off to other choices, A.K.A. if the user had answered '1' for the first question the bot would answer "My name is Bob. What's yours?"</p> <p>My game is designed in a way where a level editor would not be an impossible prospect (every place you can visit is stored as a key in a dictionary, then a tuple containing everything in it [I have a shop class, an enemy class, a 'portal' class, and soon an NPC class]). So I'd like this created in a way so I can hold it all in a variable that my NPC class has stored (not a bunch of 'if' statements)</p> <p>Just to clarify, I am NOT asking for someone to write code for me, I am just unsure about how to approach the problem.</p> <hr> <h3>Shortened description of <em>exactly</em> what I need:</h3> <p>Tree-like structure that begins with one string with a number of strings that 'branch off' from it</p> <p>Each one of those strings has more 'branches'</p> <p>The difference from this and a tuple of tuples is that there needs to be a string where they branch off rather than an immediate split.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload