I'm encountering a weird issue with a small project I'm working on and was hoping for some answers as to what's going on. Essentially my player goes through a set of trials (let's call it 5 trials) made up of x steps (let's call it 10 steps). As errors are accrued in performing each step they are tallied in an array. I currently use one array for all the trials and load them into a spreadsheet-style format of text objects. This part works perfectly.
However, I want to tally the number of errors accrued in each trial, which is where the problems are starting. Currently I'm looping through the array 5 times (one time per trial) with the number of loops increasing by 10s (loop 10 times, 20 times etc.) and adding the array.at(loopindex-1) to a local variable for each trial (loop1, loop2 etc.), and then setting text for the tallies like so:
set text trial 5: clamp((loop5-loop4),0,loop5)
set text trial 4: clamp((loop4-loop3),0,loop4)
I can't figure out why this isn't working at all. It correctly tallies about 80% of the time and the other times it randomly drops or adds values of 1 per trial. It was doubling values per trial at one point but I added a "Once While True" value (though it only occurs "at start of layout") which fixed that issue.
I'm thinking of just loading each trial into it's own array and going through this without a big looping tally system but I have to know why this isn't working regardless of what comes next lol. Am I missing some piece of theory or logic here??
Thanks in advance for your help!!!!