@XanMag (or Chris ! if this code stuff doesn't scare you, hehe):
lists and dictionaries are slightly different from each other, but if you're interested in a quick look at a very simple dictionary usage:
<game name="xxx">
<attr name="month_number_to_month_name" type="simplestringdictionary">1=january; 2=february; 3=march; 4=april; 5=may; 6=june; 7=july; 8=august; 9=september; 10=october; 11=november; 12=december</attr>
<start type="script">
msg ("What month were you born in? (type in the number: 1 to 12)")
get input {
player.month = StringDictionaryItem(game.month_number_to_month_name, result)
msg ("You were born in " + player.month + ".")
}
</start>
</game>
or
<game name="xxx">
<attr name="alphabet_letter_to_month_name" type="simplestringdictionary">a=january; b=february; c=march; d=april; e=may; f=june; g=july; h=august; i=september; j=october; k=november; l=december</attr>
<start type="script">
msg ("What month were you born in? (type in a lower case letter: a to l (that's an L)")
get input {
player.month = StringDictionaryItem(game.alphabet_letter_to_month_name, result)
msg ("You were born in " + player.month + ".")
}
</start>
</game>
--------------------------
dictionaries have a vast range of applications
such as for dialogue (wink)...
you can put in any string (a single word or a sentence or a paragraph ~ though use its vertical structure for sentences and paragraphs ~ don't use the 'simplestringdictionary' type unless just doing single words or letters) for the 'key' (the left side of the equals or if doing vertical, the 'key' is the 'key' lol), and its the same for the value too (the right side of the equals, I forgot how the vertical structure looks, but it should be obvious as to where the value goes~is with it), it can be a single letter or word, or a sentence, or a paragraph.
Though using Objects (Pixie's expert advice), is much more effective~powerful~better than using lists or dictionaries.
---------------------------
the above 2 dictionaries are the same thing as [excluding my laziness with typing in the full msgs of ("You were born in {month}.") ] below:
<game name="xxx">
<start type="script">
msg ("What month were you born in? (type in the number: 1 to 12)")
get input {
if (result = 1) {
msg ("january")
} else if (result = 2) {
msg ("february")
} else if (result = 3) {
msg ("march")
} else if (result = 4) {
msg ("april")
} else if (result = 5) {
msg ("may")
} else if (result = 6) {
msg ("june")
} else if (result = 7) {
msg ("july")
} else if (result = 8) {
msg ("august")
} else if (result = 9) {
msg ("september")
} else if (result = 10) {
msg ("october")
} else if (result = 11) {
msg ("november")
} else if (result = 12) {
msg ("december")
}
}
</start>
</game>
or
<game name="xxx">
<start type="script">
msg ("What month were you born in? (type in a lower case letter: a to l (that's an L)")
get input {
if (result = "a") {
msg ("january")
} else if (result = "b") {
msg ("february")
} else if (result = "c") {
msg ("march")
} else if (result = "d") {
msg ("april")
} else if (result = "e") {
msg ("may")
} else if (result = "f") {
msg ("june")
} else if (result = "g") {
msg ("july")
} else if (result = "h") {
msg ("august")
} else if (result = "i") {
msg ("september")
} else if (result = "j") {
msg ("october")
} else if (result = "k") {
msg ("november")
} else if (result = "l") {
msg ("december")
}
}
</start>
</game>
----------------------------
notice how much shorter using a Dictionary Attribute is to the 'if' script