Multiple Start Questions

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."


The answers you seek can be found here:

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?"

  1. I used a Get input script. Then I added a switch script.
  2. In the Switch script box, type in 'LCase(result)'. This makes all responses typed by the player lower case and recognized in your cases! Very useful!
  3. I added each word as a case for the switch script. Be sure to write it as follows for Case 1: "male","m","dude","guy", etc... For Case 2: "female","f","girl","lady", etc... If the player types 'male', 'm', 'dude', or 'guy' (or whatever other response you want to be acceptable), you can then run a script to handle the input for the player selecting a male character.
  4. For each script for each acceptable case, you will need to do things that I am unfamiliar with. There are libraries for this kind of thing too, but it sounds like you CAN manage this part. Maybe?
  5. Make sure you add a default for any comment you do not want him to recognize. The default in your case would probably be to run the function again so there is no way the player can skip this. Perhaps include a print message prior to calling the function? Maybe "Hey, ding dong! I said 'Are you male or female?' Please answer this question before continuing. Then, Call function 'GenderFunction'.

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.

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):

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) { = 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)

Well, that was much easier. :P Thanks!

This topic is now closed. Topics are closed after 60 days of inactivity.