A question about open questions

Nicole
16 Jul 2013, 16:39
Hi everyone,
I'm working on this story about a prince or princess in disguise. The start script let's the player choose a name (player.alias) and gender (player.gender).

I am still an absolute beginner in Quest and I would love to include the following in my game:
Another character asks the player: 'What's your name?'
Get input, then:
- If the player gave his/her 'real name' (i.e. input equals player.alias): scenario A
- Else: scenario B

Are such open questions even possible in Quest?
The second best option would be to have a menu showing up with several names to choose from, with the player.alias as one of the possible answers, but at the moment I haven't figured out if that's possible either.

Sorry for this chaotic post, being a non-native speaker of English doesn't help, I guess. Any help would be much appreciated!

jaynabonne
16 Jul 2013, 19:36
It's definitely possible and doable. One thing to keep in mind is how exact you want the answer to be (e.g. if they type "Nicole" at startup, does "nicole" match later?)

Using scripting, you can print out the question, get input, and then act based on that input.

HegemonKhan
17 Jul 2013, 01:43
here's a guide for expanded character creation:

http://quest5.net/wiki/Character_Creation

------------------------------------------------------------------

First, press the "select all" button on this post to highlight the text in the code box (below) and then copy it (ctrl + C)

<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<start type="script">
character_creation_function
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="prince_charming">
<inherit name="editor_object" />
<verb name="chat">
msg (this.name + ": Hello young lady, what is your name?")
get input {
if (game.pov.alias = result) {
// "Scenerio A"
} else {
// "Scenerio B"
}
// rest of your dialogue
}
</verb>
</object>
</object>
<function name="character_creation_function">
msg ("What is your name?")
get input {
game.pov.alias = result
msg ("-" + game.pov.alias)
show menu ("What is your gender?", split ("male;female",";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("european;african;asian;american;australian",";"), false) {
game.pov.race = result
show menu ("What is your skin_color?", split ("white;orangish;tanned;black;light_brown;dark_brown;reddish;yellowish;olive",";"), false) {
game.pov.skin_color = result
show menu ("What is your eye_color?", split ("blue;green;blue_green;brown;amber;hazel;grey",";"), false) {
game.pov.eye_color = result
show menu ("What is your hair_color?", split ("light_yellow;bright_yellow;dirty_yellow;orange;red;light_brown;dark_brown;black;grey;white",";"), false) {
game.pov.hair_color = result
show menu ("What is your hair type?", split ("straight;wavy;curly",";"), false) {
game.pov.hair_type = result
show menu ("What is your hair style?", split ("spiked;pigtails;ponytail;bald;buzzed;dreadlocks;flat;bunned",";"), false) {
game.pov.hair_style = result
show menu ("What is your hair length?", split ("long;short;medium",";"), false) {
game.pov.hair_length = result
// (whatever else you want for your character's description)
}
}
}
}
}
}
}
}
}
</function>
</asl>


[HK EDIT: this is incomplete, as you now need some means of displaying your character description, that you've just created. I'll try to remember to finish this up when I've got the time)

Now, start Quest, create a new game, then at the top, click on the button that looks like a piece of paper (between the "play" and "?" buttons). This piece of paper button is a toggle button that goes back and forth between the noob-friendly GUI-Editor mode and Code View mode. So, now in the Code View mode, select all (ctrl + A) to highlight, then paste (ctrl + P) to replace the highlighted code text with the code text from this post, save the game~file, press the paper button again to go back to the GUI~Editor mode, and finally choose the option from the bar at the top (I think it's under "File", but maybe it's under something else), to start the game (hopefully it works), to try out the game.

-----------

if you want to create a menu:

Add a script -> Output -> Show menu -> (then click on what options you want with it)

http://quest5.net/wiki/Showing_a_menu

-------------

ask if you need any help or if you're unclear on anything, and I'll try to do a better job to help you.

Nicole
17 Jul 2013, 09:23
First of all: Thanks to both of you. I'm learning a lot!

I think I have 2 new questions.

1) I can now include the following:
msg ("What's your name?")
get input {
if (player.alias=result) {


and then work out the different options. I think I would prefer this option, as it's the most natural. The problem is, as jaynabonne already pointed out, player.alias is case-sensitive: if the player types "Nicole" at the start of the game and answers the question above with "nicole", the game would not recognise it to be equal to player.alias. Is there a way to solve that?

2) One way to prevent typos in the answer is of course to create a menu with several names or answers in it, like:
 msg ("What's your name?")
ShowMenu ("Naam", Split ("player.alias;Romeo;I'd rather not tell you", ";"), false) {

But when you do it like this, the menu literally shows 'player.alias', instead of the name the player gave in at the start of the game. Is it possible to display that name in a menu and if so, how?

jaynabonne
17 Jul 2013, 09:37
1) Try: if (LCase(player.alias)=LCase(result))

LCase is a function that converts a string to lower case. If you lower-case them both, then they will compare without considering case.

2) Try: ShowMenu ("Naam", Split (player.alias+";Romeo;I'd rather not tell you", ";"), false) {

This builds the string from player.alias plus the rest.

Nicole
17 Jul 2013, 11:15
I tried 1, and it's amazing! Thank you so much!
2 is very interesting as well.

tlk
17 Jul 2013, 12:23
On the topic, it might not be something you're interested in but you can also automatically capitalize the first letter of whatever the player input is by doing this:

msg ("Enter your name.")
get input {
player.alias = CapFirst(result)
}


Then whether the player enters "nicole" or "Nicole" it will set it to "Nicole". I like it because it keeps the formatting consistent between the player and NPC names in the output. You can also use CapFirst on a case by case basis (by replacing the "(result)" with "(player.alias)" or whatever other attribute name), but for a name I like to do it right at the outset and not have to remember to do that.

jaynabonne
17 Jul 2013, 13:06
I'm sure e. e. cummings would protest the presumption! :)

Nicole
17 Jul 2013, 17:23
I like it! You're right, it's nice to make it consistent (too bad, e.e. cummings :)). Thanks!