A different way of doing character creation
mrangel
25 Jan 2018, 17:28There's been a lot of threads about different ways of doing character creation. And quite often, someone comments that it looks inelegant using tail recursion [which isn't as inefficient as it looks, because Quest doesn't do lexical scope], or stacking a load of ShowMenu blocks inside each other.
Here's a slightly different way of doing it, in case anyone's interested.
Here's a turnscript:
if (not HasAttribute(game.pov, "alias")) {
Ask ("What's your name?") {
game.pov.alias = result
}
}
else if (not HasAttribute(game.pov, "class")) {
displayClassMenu()
}
else if (not HasAttribute(game.pov, "race")) {
displayRaceMenu()
}
else if (not HasAttribute(game.pov, "gender")) {
displayGenderMenu()
}
else {
msg ("Congratulations, character creation is finished! Now you can start to play.")
DisableTurnScript (this)
game.showdescriptiononenter = true
ShowRoomDescription
}
And because turnscripts don't run until you've taken a turn, put do (character creation turnscript, "script")
in the game's start script :)
I'm actually building a library on this base, making a CharacterCreationQuestion type, so that the turnscript will keep on asking questions as long as there's one in the inventory. You can just put objects to represent a race/class/job etc inside the Question object, and they will be presented as options. You can put more questions inside a question object to have them only be asked after the first one; and questions inside a Race/Class/etc to have them only asked if you choose that option.

K.V.
25 Jan 2018, 17:44That is pure genius!
Thanks, MrAngel!

Anonynn
25 Jan 2018, 19:10Mr.Angel! Did you ever get my message :D?
mrangel
25 Jan 2018, 20:12Probably. I've put off replying to a lot of things while I didn't have a computer for a month; trying to catch up now I'm not in panic most days.