String List - List Count question

XanMag
11 Nov 2015, 22:12So... I'm getting so close to finishing this game and I ran into another little snag and hoping someone can help me interpret what I did wrong.
I have this code run when entering one of two hallways if the flag "execution" is true.
I have an StringList called 'execute' in the attributes of the North South Hallway1 where I have a bunch of messages like: Over the roars of the crowd inside, you can hear a voice. "The rule of the Dingo Empire is upon us. We shall not bow down to weakness."
When I enter the north south hallway1 I get the following error message - Error running script: Error compiling expression '"You crane your neck and listen, " + StringListItem(North South Hallway1,execute, n)': Unknown object or variable 'execute'
I'm sure it is something you code savvy folks will think I'm stupid for asking, but...
As always, I appreciate your help!
XanMag
I have this code run when entering one of two hallways if the flag "execution" is true.
if (GetBoolean(Commons, "execution")) {
play sound ("crowd1.wav", false, false)
n = GetRandomInt (0, ListCount (North South Hallway1.execute) - 1)
msg ("You crane your neck and listen, " + StringListItem(North South Hallway1,execute, n))
}
I have an StringList called 'execute' in the attributes of the North South Hallway1 where I have a bunch of messages like: Over the roars of the crowd inside, you can hear a voice. "The rule of the Dingo Empire is upon us. We shall not bow down to weakness."
When I enter the north south hallway1 I get the following error message - Error running script: Error compiling expression '"You crane your neck and listen, " + StringListItem(North South Hallway1,execute, n)': Unknown object or variable 'execute'
I'm sure it is something you code savvy folks will think I'm stupid for asking, but...
As always, I appreciate your help!
XanMag
HegemonKhan
11 Nov 2015, 22:48try changing the comma to a period-dot 
(just a stupid-simple typo mistake, even the best programmers, are still human, making stupid mistakes)
msg ("You crane your neck and listen, " + StringListItem(North South Hallway1,execute, n))
it should be:
msg ("You crane your neck and listen, " + StringListItem(North South Hallway1.execute, n))
-----------------
HK is impressed, your use of Lists is perfect! now on to dictionaries, or do you already understadn these too? hehe

(just a stupid-simple typo mistake, even the best programmers, are still human, making stupid mistakes)
msg ("You crane your neck and listen, " + StringListItem(North South Hallway1,execute, n))
it should be:
msg ("You crane your neck and listen, " + StringListItem(North South Hallway1.execute, n))
-----------------
HK is impressed, your use of Lists is perfect! now on to dictionaries, or do you already understadn these too? hehe


XanMag
11 Nov 2015, 23:00Nope... I stumbled on to this bit of code somewhere in the forum and simply referenced it later. I'm still clueless!
And... it works! I hate commas and periods!!

And... it works! I hate commas and periods!!

The Pixie
12 Nov 2015, 08:23XanMag wrote:...
I have this code run when entering one of two hallways if the flag "execution" is true.
if (GetBoolean(Commons, "execution")) {
play sound ("crowd1.wav", false, false)
n = GetRandomInt (0, ListCount (North South Hallway1.execute) - 1)
msg ("You crane your neck and listen, " + StringListItem(North South Hallway1,execute, n))
}
I have an StringList called 'execute' in the attributes of the North South Hallway1 where I have a bunch of messages like: Over the roars of the crowd inside, you can hear a voice. "The rule of the Dingo Empire is upon us. We shall not bow down to weakness."...
This is something I do a lot, so created a new function that takes a list and returns a string. Reading this has inspired my to post that and some other possibly useful functions:
viewtopic.php?f=18&t=5614&p=38649#p38647

XanMag
13 Nov 2015, 02:49This will be incredibly helpful! Thanks again!