Show menu problems

Bttflover5566
02 Aug 2018, 21:15I'm trying to use show menu to make a gender option, and I've been trying everything for hours, but either I get errors, or when I click an option the options disappear and the game crashes. here's the code I'm using:
msg ("Welcome to The School of Magic Text Adventure. Before you begin Day 2, I have a few questions.")
ShowMenu ("gender_string", Split ("male;female", ";"), false) {
switch (gender_string) {
case (male1) {
msg ("Ah, so a male. Did I ever tell you what I do to males when they--
kidding, kidding. Anyway next question... ")
ChangePOV (male1)
}
case (female2) {
msg ("Female huh, this should spice things up a little. Anyway, next
question...")
ChangePOV (female2)
}
}
}
mrangel
02 Aug 2018, 23:04I think you want:
msg ("Welcome to The School of Magic Text Adventure. Before you begin Day 2, I have a few questions.")
ShowMenu ("What is your gender?", Split ("male;female"), false) {
switch (result) {
case ("male") {
msg ("Ah, so a male. Did I ever tell you what I do to males when they-- kidding, kidding. Anyway next question... ")
ChangePOV (male1)
}
case ("female") {
msg ("Female huh, this should spice things up a little. Anyway, next question...")
ChangePOV (female2)
}
}
}
In your version, you start with ShowMenu ("gender_string", Split ("male;female", ";"), false) {
Taking the parameters in turn. The first parameter, "gender_string"
here, is the message you want to display to the player. I think this probably isn't "gender_string".
The second parameter, Split ("male;female", ";")
, is the options. So after the player has chosen an option from the menu, the result
variable will be set to either "male"
or "female"
.
After the ShowMenu, you are trying to see whether the object named gender_string
is equal to an object named male1
or an object named female2
. This will never be true, because objects with different names can't be equal.
Maybe gender_string
is a variable that you've previously set to be equal to one of those objects? But this won't work, because variables aren't saved one the script finishes running.
If you're trying to check the player's selection, it's in a variable named result
.
Hope that makes sense; I'm not so good at explaining.

Bttflover5566
03 Aug 2018, 19:14Thanks a bunch, Your a life saver! You have no idea how long I spent on that.