0 votes
by (8.7k points)

Dear Twinelords,

So I've built this array:

/* define a new array */
<<set $decisionLinkArray = []>>

/* populate the array with the correct value */
<<set $decisionLinkArray.push("setup.orcAttackDescriptions")>>

I test it's working with:

$decisionLinkArray[0]

Which prints:  setup.orcAttackDescriptions

So far, so good!  Now I'd like to have my game print a random value from $decisionLinkArray[0].

I tried:

<<set $decision.linkText to Array.random($decisionLinkArray[0])>>

But when I test it with $decision.linkText, the game just prints a random character from the string setup.orcAttackDescriptions instead of printing a random value from setup.orcAttackDescriptions.  Is there a way to make it do the latter?

1 Answer

+1 vote
by (61.7k points)
selected by
 
Best answer
Is it literally printing "setup.orcAttackDescriptions"? Because that's probably not what you want. Lose the quotes around the setup variables in the push() call and see if that helps.
by (8.7k points)
Bingo!  Thank you.  :-)
...