If you can remember that it was ever any better, then you weren’t doing it right
![]()
…
And you’re correct on both counts
I like the array thing though, because its a neat way of keeping stuff together (if only in my head). So the (full) - and now tested! - way of using two arrays (and some non-array variables, just for added fun) to do the same thing and handle where the stats are equal …
*comment - in the startup file
*create varNames_1 "Str"
*create varNames_2 "Agi"
*create varNames_3 "Int"
*create varValues_1 40
*create varValues_2 10
*create varValues_3 40
*create mycounter 3
*create i 0
*create remi1 1
*create remi2 0
*create remi3 0
*create highest_val_is 0
*comment - Add more remiX - and increase mycounter - if you got more variables
*comment - In Scenes File(s)
*comment set highest value and rememberID to be first value pair (at the moment, they are highest!) ... note NOT i!
*set highest_val_is {varValues[1]}
*set remi1 1
*comment start the loop
*label looper
*set i +1
*if (i < mycounter)
*if highest_val_is < {varValues[i +1]}
*comment if new > old add new
*set highest_val_is varValues[i+1]
*set remi1 i+1
*comment Reset any earlier "ties/equals!
*set remi2 0
*set remi3 0
*goto looper
*elseif highest_val_is = {varValues[i +1]}
*comment - New val = Current Highest - check whether a tie already exists
*if remi2 !=0
*comment - we already have a tie for high value, so remember another index/item.
*set remi3 i+1
*goto looper
*comment ----- NOTE: If you have more than 3 stats, you'd add ELSEIFs here
*comment - no current tie for high value, so remember the index/item
*set remi2 i +1
*goto looper
*else
*comment highest value is still old value - do nothing
*goto looper
*comment --- Print To Screen
*if remi2 = 0
Your highest value stat is: ${varNames[remi1]} with a value of ${varValues[remi1]}
*finish
*elseif remi3 = 0
You have two highest value stats: ${varNames[remi1]} with a value of ${varValues[remi1]} and ${varNames[remi2]} with a value of ${varValues[remi2]}
*finish
*else
All three of your stats - ${varNames[remi1]}, ${varNames[remi2]}, ${varNames[remi3]} - have a value of ${varValues[remi1]}.
So, look, I know … but at the moment, it’s probably safest if I stay indoors anyway ![]()
Credits:
String Stuff (“fun”, but didn’t use it): Reverse Concatenation - #9 by CJW
Arrays: Initialising arrays (and programming language implementation)
