Hi All,
First time poster so hopefully I do this right.
Twine 2.0.11, Sugarcube 2.8.0
I've created an array and successfully sorted it like so:
<<silently>>
<<set _statroll = [["will",random(1,20) +$player.will],
["str", random(1,20) +$player.str],
["dex", random(1,20) +$player.dex],
["con",random(1,20) +$player.con],
["wis",random(1,20) +$player.wis],
["int",random(1,20) +$player.int],
["chr",random(1,20) +$player.chr]
]>><</silently>>
before:<<print _statroll >>
<<print _statroll.sort(function(a,b){return a[1] - b[1];})>>
<<print _statroll [6]>>
My goal is to determine the maximum roll each time this passage is visited and provide different options based on what that maximum was.
My issue is that when I print the _statroll[6] I'll get something like "will, 13" when all I really want to see is "will".
Is there a way to do that?
Any help is appreciated.
Thanks!
Comments
For example: