Switch - Show Menu Issue [SOLVED]

Anonynn
18 Jun 2016, 18:22
So I'm trying to set up a "Debug" sort of item that will allow Donator's to change anything they want about their character just by clicking "use" on the item. I did a "switch script" with a LCase(result) and then once the player "types" something a "show menu" script is supposed to happen afterward. But for some reason nothing happens once the player types one of the categories.

Here's the code.

msg ("<br/>What would you like to modify? Please type in your response without quotations. <br/><br/>\"gender\"<br/>\"race\"<br/>\"haircolor\"<br/>\"eyecolor\"<br/>\"hairlength\"<br/>\"skin\"<br/>\"fur\"<br/>\"feathers\"<br/>\"scales\"<br/>\"height\"<br/>\"weight\"<br/>\"lips\"<br/>\"nails\"<br/>\"background\"<br/>\"speciality\"<br/>\"tail\"<br/>\"wings\"<br/>\"thiefskill\"<br/>\"resist\"<br/>\"maximum carry\"<br/>\"transform\"<br/>\"piercing\"<br/>\"clothing\"<br/>\"weapon\"<br/>\"name\"<br/><br/>Or type anything else to cancel. <br/>")
switch (LCase("result")) {
case ("gender") {
menulist = NewStringList()
list add (menulist, "female")
list add (menulist, "male")
ShowMenu ("Please Choose Your New Gender From The List Below.", menulist, true) {
if (result="male") {
SetTo ("gender", "male")
msg ("<br/>You are now male!<br/>")
}
else if (result="female") {
SetTo ("gender", "female")
msg ("<br/>You are now female!<br/>")
}
}
}



Anyone know what's going wrong?

The Pixie
18 Jun 2016, 20:39
You are missing a get input command, I guess, before:
switch (LCase("result")) {

You may need more brackets to balance.

Also, a quick way to get a string list is with Split, one line instead of three
menulist = Split("male;female", ";")

Anonynn
18 Jun 2016, 20:49
Doh! I'm such a goofus. Sorry to waste your time @_@ Can't believe I missed that.


Also, a quick way to get a string list is with Split, one line instead of three
menulist = Split("male;female", ";")



^ also that is a fantastic tip! Thank you!

jaynabonne
18 Jun 2016, 21:10
Also it's

switch (LCase(result)) {

without the quotes. Otherwise, you're always comparing the string "result" instead of the result variable.

jaynabonne
18 Jun 2016, 21:13
You can also boil the gender result handling down to:

SetTo ("gender", result)
msg ("<br/>You are now " + result + "!<br/>")


rather than the if/else.

Anonynn
18 Jun 2016, 21:43
Hey Jayna! Long time no see. And yeah, I put the quotes there cause it wasn't working (because I didn't have "get input" and was trying to figure out what the problem was lol). I'm a goofus. e____________e

jaynabonne
18 Jun 2016, 22:05
As they say, the expert is just the one who has already made the mistakes. So each mistake brings you that much closer!

Hope it's working now... :)

Anonynn
18 Jun 2016, 22:53
Yup! All the things I've tested seem to work just fine! Thank you!

XanMag
19 Jun 2016, 00:46
jaynabonne wrote:As they say, the expert is just the one who has already made the mistakes. So each mistake brings you that much closer!

Hope it's working now... :)



Son of a...!

I've made so many mistakes I should be an expert 100 times over. Why am I not an expert?!? :lol:

Anonynn
19 Jun 2016, 00:53
You are Xan! Think of all the people you've helped and provided answers for ^_^ I'm one of them and am very grateful for your expertise!

HegemonKhan
19 Jun 2016, 02:08
I've been trying to learn to code+quest for ~4 years now... why am I not learning faster?!... (because I'm stupid!) :(

jaynabonne
19 Jun 2016, 03:59
HegemonKhan wrote:I've been trying to learn to code+quest for ~4 years now... why am I not learning faster?!... (because I'm stupid!) :(

Just saw this the other day. Maybe it will help. :)

https://medium.freecodecamp.com/one-doe ... 5bacdc5b62

HegemonKhan
19 Jun 2016, 05:10
Also, being lazy doesn't help when it comes to learning to code. It takes a lot of dedication, patience, and commitment. And having an uncomfortable chair doesn't help either, when you got to sit in front of the computer all down long, trying to learn to code more, and practicing coding stuff.

I think the problem is that at first you're able to learn a lot, as it's the easiest/most basic stuff, but then you're trying to learn harder and harder stuff, so what you learn and how much new stuff you learn, starts to really slow down, especially if you hit a plataeu, and are not able to jump up quickly to that higher/next next level of coding and/or organizational/designing thinking that is needed.

---------

decent "cheer up" article, though I assume the site also has coding lessons, so I'll definately take a look at it at some point (still got a lot of code academy lessons to do, along with haven't tried udemy either, along with trying to practice at java and assembly and circuitry/architecture, my laziness is the biggest problem, as it gets a bit boring when you're just trying to learn to code on your own. I'll definately like coding, when I can code faster and get finished works done and done faster/more-soon, but when you're limited in what you can tangibly accomplish/show for your hard work, it's demoralizing and boring, at this early learning/struggling stage).

The Pixie
19 Jun 2016, 07:49
jaynabonne wrote:Just saw this the other day. Maybe it will help. :)

https://medium.freecodecamp.com/one-doe ... 5bacdc5b62

Made me go through my tutorials on Quest and see how often I use "simply". Only twice (and one of those was "simply cannot")!
HegemonKhan wrote:Also, being lazy doesn't help when it comes to learning to code. ...

Yes it does.

http://blogoscoped.com/archive/2005-08-24-n14.html

I am not a coder by profession, but i have coded for my job, and I did it to save me effort. In the log run, it was easier to get the computer to do the drudgery, rather than me.

HegemonKhan
19 Jun 2016, 08:37
HK simply looks away and whistles... I simply like using "simply" way too much, as I know what I'm simply posting about... but others simply don't... doh!

my big problem is I simply don't pay attention between when the word is suppose to be "simpl-E" vs "simpl-Y", lol.