Name Games

Baconside
24 Jul 2013, 21:47
Hi guys! I am a bit new to all of this and I hope to have lots of fun with you guys and with Quest. But I wish to know. How can I make it so someone is allowed to make their own name in game or choose their own gender? And is it limited to Text adventures only or Gamebook only?

Here's a example of what i'm thinking:

What is your characters name?

>Elizabeth

Hello Elizabeth!

While in another session:

What is your characters name?

Bellingfartlordz

Hello Bellingfartlordz!
-----------------------------------
The same above goes for gender. Do you want female or male? So is it possible to do that and is it limited to only one or can I do it to both?

Liam315
24 Jul 2013, 22:21
I have no experience with gamebooks so I can only speak for text adventure, but yes, it is perfectly possible to do this. See the following wiki article on character creation, it should have all the answers you need. If you get stuck on any point, just write back.
http://quest5.net/wiki/Character_Creation

The tutorial is worth going through if you haven't already:
http://quest5.net/wiki/Tutorial

The section on custom attributes should be particularly helpful in establishing any variable or option you might want to add to your character or other game object.

Baconside
25 Jul 2013, 14:54
Well there is one problem still. I put it so before you enter the room the script plays. But the room is entered in the middle of the script.... Right before player.gender is added.

msg ("Before we begin, we need to know more about you! ")
msg ("What is your name?")
get input {
player.alias = result
msg ("Hello, " + player.alias)
ShowMenu ("Your gender?", Split ("Male;Female", ";"), false) {
player.gender = result
msg ("Well you are a healthy " + player.gender)
msg ("Now go ahead and play! Enjoy your life and make the best of it.")
}
}



jaynabonne
25 Jul 2013, 15:04
Yes, functions like ShowMenu and get input do not block, so the script will continue on and do what it would do normally. The easiest way I can think of to solve this is to have a special startup room which has nothing but your initial input scripts. Then once you've gotten the needed info, move the player to the first real room.

HegemonKhan
26 Jul 2013, 00:59
I'm checking on this now (give me a few minutes to edit this with a more accurate response), but I'm positive I've gotten it to work, using the same~similar script block structure as yours, and before I've gone and checked, I can see that you're using "ShowMenu", whereas I use "show menu", so this might be your problem, but I'm not sure yet. Let me now go check on my own code, to see if I have it working, without it mentioning the room description before the character creation process is finished.

Err, I also use the Game Object's "Start" script, using a "Call function" to the~my character creation script block (as the type: Function), so maybe that's why mine works, whereas your direct script block doesn't.

here's my code, which works fine (the character creation script finishes first, before the room description and etc occurs):

<game name="testing game stuff">
<start type="script">
character_creation_function
</start>
</game>

<function name="character_creation_function"><![CDATA[
msg ("What is your name?")
get input {
player.alias = result
msg ("-" + player.alias)
msg ("What is your age?")
get input {
player.age = result
msg ("-" + player.age)
if (ToInt (player.age) < 13) {
player.age = 13
}
if (ToInt (player.age) >= 13 and ToInt (player.age) < 20) {
player.age_status = "teen"
} else if (ToInt (player.age) >= 20) {
player.age_status = "adult"
}
msg ("-" + player.age_status)
show menu ("What is your gender?", split ("male;female",";"), false) {
player.gender = result
}
}
}
</function>

tlk
26 Jul 2013, 12:47
jaynabonne wrote:Yes, functions like ShowMenu and get input do not block, so the script will continue on and do what it would do normally. The easiest way I can think of to solve this is to have a special startup room which has nothing but your initial input scripts. Then once you've gotten the needed info, move the player to the first real room.

This is exactly what I do in a game I've been working on that gets a custom name from the player. Works like a charm.