So if I want to start a game by compiling info on the player (Race, Class, Sex, ect). How do I do that? I know how to ask the questions in the Start Area. But if I have multiple questions, they all appear at once. How do I tell the program "Wait until valid input to previous question before asking next question."
I use a switch script for stuff like this. Below is an example of how this works.
0a. Maybe for each question you want to ask, create a function. Perhaps call the first function 'GenderFunction'. In this function, you could do the following...
0b. Print message "Are you a male or female?"
There are probably more eloquent ways of doing this, but that's how I would try it. There will probably be someone who comes along and clears this up for me.
There is also this if you can understand it. http://textadventures.co.uk/forum/samples/topic/bt2tyfsdpuqwlawkbgfszq/character-creator
Ok. In case anyone else comes here looking for this answer. This is what I did. I created two (or more if you need them) functions. Say I call them "racefunction" and "classfunction". In those functions I followed the online help for asking a question with a menu. At the result step of "racefunction" I have it call the function "class function". Then in startup I had it call the "racefunction". So you could daisy chain all your functions together that way.
there's also the 'character creation' guide doc by pixie (probably more useful than Anonynn's character creation code for her game):
http://docs.textadventures.co.uk/quest/guides/character_creation.html
if you need help, ask and we'd be glad to help
My system was a list of questions, with a function that removes a question when the player has answered it and checks if there's another in the list. It works, but I think that daisy-chaining functions like that is a little inefficient (as the frames for all the previous function calls are still in memory). I wonder if it might be more elegant to have a turnscript that checks if all of the questions have been answered, and if not asks the next one. (Are turnscripts called after responding to a ShowMenu prompt? I don't have the script in front of me to check, so it's just an idea bouncing round my head right now)
Are you talking about doing tail-recursion (a function calling itself) or just a chain/nesting of function calls?
do both methods retain the 'activation records' (function's/whatever's data) in memory (aka: wasting memory) until the entire/full scripting ends (I presume it does free up the memory once it ends, lol) ???
If that's the case... is there an alternative to tail-recursion (which works with getting user input/selection: aka, unfortunately 'while' doesn't work with getting user input/selection, thus my use of tail-recursion)... ???
(also maybe using Data Structures: iterators and linked lists, trees, maps, dictionaries, etc... would be another, and probably still too advanced for me lol, method?)
I just basically set up a chain of functions. The startup calls the first function, which has a menu selection (say..Race), and at the end of that it calls the next function, which has a menu selection (say..Class), and at the end of that it calls the next function, etc. Not sure if it's pretty. I would hope its clearing out of memory once the function is complete. But it works. Now I just have to think of the best/cleanest/easiest way to do skills. :P
you can just nest/indent (in code) (or via GUI/Editor) your scripting, you don't need multiple functions and their calling/usage, see the 'character creation' guide link by pixie in my post above. A quick example, below
// Function/Verb/Command/Turnscript/Timer or Object+Script_Attribute+(optional)_Delegate scripting:
msg ("Name?")
get input {
player.alias = result
show menu ("Sex?", split ("male;female", ";"), false) {
player.sex = result
show menu ("Race?", split ("human;dwarf;elf;gnome;halfling;giant", ";"), false) {
player.race = result
show menu ("Class?", split ("warrior;archer;thief;cleric;mage", ";"), false ) {
player.class = result
}
}
}
}
my previous post's question was more to mrangel (or whoever), on quest's inner workings, in whether the memory is wasted (retained) or freed, as I've been using tail-recursion... but if it's retaining memory until the entire scriptings operations is done, that's bad. I thought with tail-recursion, that the previous scripting operation is done, so memory is freed, as it calls/does the next scripting operation (which uses up memory for it of course). But, if it's retaining the memory of all of the scripting opertions until the entire chain of scripting operations is done... that's very bad (lots of used/wasted memory)