menu or list ask questions
ChrisC20
07 Sept 2015, 22:28Hi there. Lets say I have a set of questions to ask another object, eg. just like when giving the object "Angi" a ask/tell and then typing in "ask Angi about gun" then she should reply "I don't own a gun", that I get... its fine.
but now I have come across an idea that could work better, if its possible: using a "show menu" with "if" statements. I create a stringlist in 'game' Game Object which eg. contains strings "gun" and "knife".
So lets say I name the stringlist just "list", then use "show menu" with text "what would you like to ask?", then the "list/dictionary" will be "game.list" numbered. How do I make it so that I can input 1 ("gun") or 2 ("knife") and make Angi respond with a message?
eg. get input->if input =1->print message "I don't own a gun"
Get input->if input=2->print message "the knife is in the kitchen"
Any help please.
but now I have come across an idea that could work better, if its possible: using a "show menu" with "if" statements. I create a stringlist in 'game' Game Object which eg. contains strings "gun" and "knife".
So lets say I name the stringlist just "list", then use "show menu" with text "what would you like to ask?", then the "list/dictionary" will be "game.list" numbered. How do I make it so that I can input 1 ("gun") or 2 ("knife") and make Angi respond with a message?
eg. get input->if input =1->print message "I don't own a gun"
Get input->if input=2->print message "the knife is in the kitchen"
Any help please.

XanMag
07 Sept 2015, 22:54So... you want to give the player a list of things that can be asked about and then they choose from that list?
I'll look in to helping you with that if that's what you want to do, but I would suggest using a switch command and let the player ask whatever they feel like asking about. Just my opinion.
I'll look in to helping you with that if that's what you want to do, but I would suggest using a switch command and let the player ask whatever they feel like asking about. Just my opinion.
HegemonKhan
07 Sept 2015, 23:15before we get into 'using lists' and~or 'using dictionaries'...
---------------------
a Dialogue system can be very simple or very complex... and your design of it, can be very simple or very advanced.
here's some links on Dialogue:
http://docs.textadventures.co.uk/quest/guides/ (scroll through and find the conversation~dialogue links in it)
and Jay's professional (uber advanced) dialogue system:
viewtopic.php?f=5&t=4883 (Jay's professional 'Spondre' game, check it out, it's an incredible game!")
https://www.youtube.com/watch?v=ULjIjSQhgVw (youtube video of someone playing the game, try to ignore the youtube person's illiteracy...)
viewtopic.php?f=18&t=4889 (Jay awesomely has made his source code publically available for us!)
----------------
as for Lists and Dictionaries:
viewtopic.php?f=18&t=5137 (extensive guide on using lists and dictionaries)
viewtopic.php?f=18&t=5138 (example of List~Dictionary usage in action, albiet a bit advanced and not for dialogue )
viewtopic.php?f=18&t=4988 (has some examples of exactly what you mention doing in your OP)
-------
ask if you got any questions, are confused by anything, and~or if you still need help with anything!!!
---------------------
a Dialogue system can be very simple or very complex... and your design of it, can be very simple or very advanced.
here's some links on Dialogue:
http://docs.textadventures.co.uk/quest/guides/ (scroll through and find the conversation~dialogue links in it)
and Jay's professional (uber advanced) dialogue system:
viewtopic.php?f=5&t=4883 (Jay's professional 'Spondre' game, check it out, it's an incredible game!")
https://www.youtube.com/watch?v=ULjIjSQhgVw (youtube video of someone playing the game, try to ignore the youtube person's illiteracy...)
viewtopic.php?f=18&t=4889 (Jay awesomely has made his source code publically available for us!)
----------------
as for Lists and Dictionaries:
viewtopic.php?f=18&t=5137 (extensive guide on using lists and dictionaries)
viewtopic.php?f=18&t=5138 (example of List~Dictionary usage in action, albiet a bit advanced and not for dialogue )
viewtopic.php?f=18&t=4988 (has some examples of exactly what you mention doing in your OP)
-------
ask if you got any questions, are confused by anything, and~or if you still need help with anything!!!
ChrisC20
08 Sept 2015, 14:11XanMag, you are correctm that is exactly what I want. And I will be grateful to if you could help me with it.
The Pixie
08 Sept 2015, 14:55Look at this library, it might do what you want:
http://docs.textadventures.co.uk/quest/ ... tions.html
Rather than items in a string list, it has each topic as an object, and if the object is selected, a script is run on that object.
http://docs.textadventures.co.uk/quest/ ... tions.html
Rather than items in a string list, it has each topic as an object, and if the object is selected, a script is run on that object.

XanMag
10 Sept 2015, 03:11I think a simpler alternative to adding lists and dictionaries and what not is creating your own "menu" using the ask a question & get input scripts followed by a switch command. If you copy-paste the code below into a new game, you should be able then to see it in the editor. I'm not 100% sure yet how exactly to use a menu as I have avoided using dictionaries so far (and I think you would need to use one in this case). If this is not what you want or want clarification, let me know and I will try to give you an example using an actual pop-up menu.
Let me know and thanks for being patient!
<object name="show use menu room">
<inherit name="editor_room" />
<alias>show and use menu room</alias>
<description type="script">
</description>
<object name="Minnie Menu">
<inherit name="editor_object" />
<inherit name="namedfemale" />
<look>This is Minnie. She is very cute. If you talk to Minnie, you will see she has a very specific set of things you can talk to her about. Give it a try!</look>
<talkto type="script"><![CDATA[
msg ("\"Dear, what would you like to talk about?\"<br/>1 - this tutorial<br/>2 - Magoo<br/>3 - Minnie<br/>4 - the meaning of life<br/>5 - a date")
get input {
switch (LCase(result)) {
case ("1","tutorial","this tutorial","game","the game","the tutorial") {
msg ("\"Yep,\" Minnie replies, \"This tutorial is supposed to be helpful to you solving problems or answering questions you have about Quest. If you have any problems with the tutorial, please PM Xanadu Magoo or leave a message in the comments section.\"")
}
case ("2","magoo","me") {
msg ("\"You want to talk about yourself?\" She looks you up and down. \"Okay, let talk about you. You seem interesting enough.\" She gives you a sly smile.")
}
case ("3","minnie") {
msg ("\"Aww. That's sweet,\" Minnie says as she bats her long-eyelashed eyes at you. \"I'm just your girls next door type here to talk to you about using a switch script in conversation. Thanks for asking!\"")
}
case ("4","life","meaning of life","meaning","the meaning of life") {
msg ("\"I'm not the Dalai Lama, dear.\" She looks sheepishly away and then back at you again. \"However, the meaning of life is to make sure you have fun. Write text adventure games that make you and other people happy.\"")
}
case ("5","date","a date","dating") {
msg ("\"Oh? Really?\" She says, seemingly a bit shocked. \"I'm afraid I am a bit out of your league. That and I already have a man. I'm flattered though. No hard feelings, okay?\"")
}
}
}
]]></talkto>
</object>
<object name="Magoo">
<inherit name="editor_object" />
<inherit name="editor_player" />
<look>You're Magoo. A simple being trapped in a test game.</look>
<attr name="pov_look">You're Magoo. A simple being trapped in a test game.</attr>
</object>
<command>
<pattern>talk to; speak to</pattern>
<script>
msg ("Hi.")
</script>
</command>
</object>
Let me know and thanks for being patient!
HegemonKhan
10 Sept 2015, 06:16@XanMag (or Chris ! if this code stuff doesn't scare you, hehe):
lists and dictionaries are slightly different from each other, but if you're interested in a quick look at a very simple dictionary usage:
or
--------------------------
dictionaries have a vast range of applications
such as for dialogue (wink)...
you can put in any string (a single word or a sentence or a paragraph ~ though use its vertical structure for sentences and paragraphs ~ don't use the 'simplestringdictionary' type unless just doing single words or letters) for the 'key' (the left side of the equals or if doing vertical, the 'key' is the 'key' lol), and its the same for the value too (the right side of the equals, I forgot how the vertical structure looks, but it should be obvious as to where the value goes~is with it), it can be a single letter or word, or a sentence, or a paragraph.
Though using Objects (Pixie's expert advice), is much more effective~powerful~better than using lists or dictionaries.
---------------------------
the above 2 dictionaries are the same thing as [excluding my laziness with typing in the full msgs of ("You were born in {month}.") ] below:
or
----------------------------
notice how much shorter using a Dictionary Attribute is to the 'if' script
lists and dictionaries are slightly different from each other, but if you're interested in a quick look at a very simple dictionary usage:
<game name="xxx">
<attr name="month_number_to_month_name" type="simplestringdictionary">1=january; 2=february; 3=march; 4=april; 5=may; 6=june; 7=july; 8=august; 9=september; 10=october; 11=november; 12=december</attr>
<start type="script">
msg ("What month were you born in? (type in the number: 1 to 12)")
get input {
player.month = StringDictionaryItem(game.month_number_to_month_name, result)
msg ("You were born in " + player.month + ".")
}
</start>
</game>
or
<game name="xxx">
<attr name="alphabet_letter_to_month_name" type="simplestringdictionary">a=january; b=february; c=march; d=april; e=may; f=june; g=july; h=august; i=september; j=october; k=november; l=december</attr>
<start type="script">
msg ("What month were you born in? (type in a lower case letter: a to l (that's an L)")
get input {
player.month = StringDictionaryItem(game.alphabet_letter_to_month_name, result)
msg ("You were born in " + player.month + ".")
}
</start>
</game>
--------------------------
dictionaries have a vast range of applications
such as for dialogue (wink)...
you can put in any string (a single word or a sentence or a paragraph ~ though use its vertical structure for sentences and paragraphs ~ don't use the 'simplestringdictionary' type unless just doing single words or letters) for the 'key' (the left side of the equals or if doing vertical, the 'key' is the 'key' lol), and its the same for the value too (the right side of the equals, I forgot how the vertical structure looks, but it should be obvious as to where the value goes~is with it), it can be a single letter or word, or a sentence, or a paragraph.
Though using Objects (Pixie's expert advice), is much more effective~powerful~better than using lists or dictionaries.
---------------------------
the above 2 dictionaries are the same thing as [excluding my laziness with typing in the full msgs of ("You were born in {month}.") ] below:
<game name="xxx">
<start type="script">
msg ("What month were you born in? (type in the number: 1 to 12)")
get input {
if (result = 1) {
msg ("january")
} else if (result = 2) {
msg ("february")
} else if (result = 3) {
msg ("march")
} else if (result = 4) {
msg ("april")
} else if (result = 5) {
msg ("may")
} else if (result = 6) {
msg ("june")
} else if (result = 7) {
msg ("july")
} else if (result = 8) {
msg ("august")
} else if (result = 9) {
msg ("september")
} else if (result = 10) {
msg ("october")
} else if (result = 11) {
msg ("november")
} else if (result = 12) {
msg ("december")
}
}
</start>
</game>
or
<game name="xxx">
<start type="script">
msg ("What month were you born in? (type in a lower case letter: a to l (that's an L)")
get input {
if (result = "a") {
msg ("january")
} else if (result = "b") {
msg ("february")
} else if (result = "c") {
msg ("march")
} else if (result = "d") {
msg ("april")
} else if (result = "e") {
msg ("may")
} else if (result = "f") {
msg ("june")
} else if (result = "g") {
msg ("july")
} else if (result = "h") {
msg ("august")
} else if (result = "i") {
msg ("september")
} else if (result = "j") {
msg ("october")
} else if (result = "k") {
msg ("november")
} else if (result = "l") {
msg ("december")
}
}
</start>
</game>
----------------------------
notice how much shorter using a Dictionary Attribute is to the 'if' script

ChrisC20
10 Sept 2015, 15:27Thanx XanMag, I appreciate all the help. Though, I think I will be following Pixie's advice with the objects... its quite a longer route, but being a novice with quest I think that using objects will suit me best. I will keep the coments that you gave me, if and when I need them (and understand them) I can use it. Unless the site deletes the posts when there is no more activity (please dont hahaha lol). Thanx again everyone.
ChrisC20
10 Sept 2015, 16:56Pixie, I am currently using your post. Working like dream. Its exactly what I wanted
ChrisC20
11 Sept 2015, 06:03I hope I don't have to create a new subject for this. But now I'm struggling with a successful Elevator object. It is set as a room at the moments, however when creating a up (lets say Level 1) it wil take the player to level 1 room. But then the player object wil exit the elevator room by itself. I would like to keep the player in the Elevator until he states to exit the Elevator, but then the player should exit to the level he went to.
I don't know if that makes sence, but plainly put, I want an Elevator. if this can't be achieved I shall make stairs instead.
I don't know if that makes sence, but plainly put, I want an Elevator. if this can't be achieved I shall make stairs instead.
The Pixie
11 Sept 2015, 06:50Again, there is a library to handle elevators:
http://docs.textadventures.co.uk/quest/ ... vator.html
http://docs.textadventures.co.uk/quest/ ... vator.html