Can't set variable in 5.3?

demonboy
17 Jan 2013, 15:33
I've been copying http://quest5.net/wiki/Character_Creation (Character Creation), using the script builder (i.e. not hard coding). However since downloading 5.3 it appears as if I can't set a variable correctly.

Screen shot here:



My code here, which I've checked against the code from the link above, as produced using the above screen shot:


<start type="script">
IncTime (960)
msg ("Welcome. Before we begin, please let me know your name:")
get input {
}
player.alias = result
msg ("Hello and welcome to the game, player.alias.")
show menu ("Your gender?", Split ("Male;Female", ":"), false) {
}
player.gender = result
show menu ("Your character class?", Split ("A;B;C", ";"), false) {
}
player.class = result
msg ("")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg ("")
msg ("Now press a key.")
wait {
}
</start>


I can see straight away that the code differs, but why is this? Is this a bug?

Alex
17 Jan 2013, 15:40
You would need to put that inside the "Get input, then run script" section - "result" won't exist anywhere else.

demonboy
17 Jan 2013, 16:00
Gotcha, thanks Alex.

HegemonKhan
17 Jan 2013, 18:36
I think it would and should look like this:

(the #s after the } and { are to show the connections, 1 connects to 1, and, 2 connects to 2. So, you just need to delete the numbers out of this code below, if you want to copy and paste it)

<start type="script">
IncTime (960)
msg ("Welcome. Before we begin, please let me know your name:")
get input { 1
player.alias = result
msg ("Hello and welcome to the game, player.alias.")
show menu ("Your gender?", Split ("Male;Female", ":"), false) { 2
player.gender = result
show menu ("Your character class?", Split ("A;B;C", ";"), false) { 3
player.class = result
msg ("")
msg (player.alias + " was a " + LCase (player.gender) + " " + LCase (player.class) + ".")
msg ("")
msg ("Now press a key.")
wait { 4
} 4
} 3
} 2
} 1
</start>


the { ____ } signifies what is inside of it, which also requires correct indentation, to signify the same thing. So you got to put the } at the ends of each of its parts and at its correct indentation spot (character count from the left) too.

think of it like this (hopefully you know algebra, lol)

Solve for X (only 1 equation to do):

AX + BY = CZ {1a
-> AX = CZ - BY {2a
->-> X = (CZ - BY) / A
-> }2a
}1a

Solve for X (with 2 equations to do):

AX + BY = CZ {1a
-> AX = CZ - BY {2a
->-> X = (CZ - BY) / A
-> }2a
}1a
DX + EY = FZ {1b
-> DX = FZ - EY {2b
->-> X = (FZ - EY) / D {3b
->->-> F = 9, E = 6, D = 5
->->-> X = (9Z - 6Y) / 5
->-> }3b
-> }2b
}1b

(the #s after the } and { are to show the connections, 1 connects to 1, and, 2 connects to 2)

for the correct indentation:

let's take the "}2" (this code section's end) and the "AX = CZ - BY {2" (this code section's beginning)

see how the "}" of the "}2" lines up to the "A" in the "AX = CZ - BY {2" ... ??? (See below)

->_AX = CZ - BY {
...|... [ the smaller-part code, "X = (CZ - BY) / A", that is inside, "of", it, the larger-whole code, "AX = CZ - BY" ]
...V... [ the smaller-part code, "X = (CZ - BY) / A", that is inside, "of", it, the larger-whole code, "AX = CZ - BY" ]
->_}

--------------

if this confuses you worse, than ignore it, lol, as it's just a different way of trying to explain-show the same thing.

{ = Beginning of "this line's code"
... = "smaller code 1" that goes inside of "this line's code" { = "smaller code 1" beginning
....... = "smaller smaller code 1" that goes inside of "smaller code 1"
... = } = "smaller code 1" ending
... = "smaller code 2" that goes inside of "this line's code" { = "smaller code 2" beginning
....... = "smaller smaller code 2" that goes inside of "smaller code 2"
--- = } = "smaller code 2" ending
} = Ending of "this line's code"

-----------

if you were constructing it via the GUI, then you simply missed hitting the correct drop down arrow button of the:

Get Input, then: (V) = (this "(V)" circle arrow button is the correct drop down, to put the rest of the 'smaller' code inside of the larger code, which is the "Get Input" code itself, which you must do so)

instead, you hit the incorrect button:

Get Input, then: (V) = correct
(V) = incorrect
.|
.V
this is merely the drop down circle arrow button for the NEXT code following the Get Input Code, and thus the wrong spot for your small code that goes into the Get Input Code, as this is outside of the Get Input Code, as, again, this button is for the NEXT code following AFTER the Get Input code.

demonboy
17 Jan 2013, 18:59
Got it sussed now, thanks HegemonKhan.

HegemonKhan
17 Jan 2013, 19:19
awesome, if interested I edit more explanations and etc of it which may help you, if you want to look over my previous post.