Grammar Naziism - right up my street!

Silver
17 Feb 2015, 23:19
msg ("What is your forename?")
get input {
player.forename = LTrim (result)
}
msg ("What is your surname, " + CapFirst (LCase (player.forename)) + "?")
get input {
player.surname = LTrim (result)
}
msg ("Nice to meet you " + CapFirst (LCase (player.surname)) + ", of the " + CapFirst (LCase (player.forename)) + " variety.")

jaynabonne
17 Mar 2015, 23:19
I just noticed: this code sample doesn't work properly. Did you want to fix it or remove it? (The surname query and get input should be *inside* the forename get input block, and the final msg needs to be inside *that* block.)

Edit: I thought this was in the Library section. Now that I see it isn't, I guess it's not important.

Silver
17 Mar 2015, 23:46
I think I was showing off and obviously got it wrong lol. What did I do wrong, it looks right to me?

jaynabonne
18 Mar 2015, 08:05
You need to nest the code so that the second part only happens within the first, etc. If you run it as is, you'll see all three messages print at once, and probably an error about trying to use "get input" more than once at a time.

Something like:
msg ("What is your forename?")
get input {
player.forename = LTrim (result)
msg ("What is your surname, " + CapFirst (LCase (player.forename)) + "?")
get input {
player.surname = LTrim (result)
msg ("Nice to meet you " + CapFirst (LCase (player.surname)) + ", of the " + CapFirst (LCase (player.forename)) + " variety.")
}
}

Silver
18 Mar 2015, 08:18
Oh right, yeah, that bit hasn't properly sunk in yet. :oops: