r/liftosaur•
Tyrwing79

Question on state variables

Hi, I was playing around with liftoscript and have an issue, I don't understand.

I want to cycle through set variations after I fail on set for three times.

The cycle to the next variation works as expected. Failure starts with 0 and after 3 fails it takes the next set variation - however the state of failure is set from 2 to 1 instead of 3 to 0

as per the output of the playground. As a result, in the next cycle, it takes only two failures to go to the next variation...

How can I reset failure to 0 after the variation changes?

This is my code:

t-1kg / used: none / 3x5 115s / 5x3 60s / 3x3 120s / warmup:none / progress: custom(failure: 0) {~

if (setVariationIndex == 1) {

if (completedReps >= reps) {

weights += 1kg

state.failure = 0}

else {

state.failure +=1 {

if (state.failure == 3) {

state.failure = 0

setVariationIndex = 2

weights -= 3kg

}

}

}

}

if (setVariationIndex == 2) {

if (completedReps >= reps) {

weights += 1kg

state.failure = 0}

else {

state.failure +=1 {

if (state.failure == 4) {

state.failure = 0

setVariationIndex = 3

}

}

}

}

if (setVariationIndex == 3) {

if (completedReps >= reps) {

weights += 1

state.failure = 0}

else {

state.failure +=1 {

if (state.failure == 4) {

setVariationIndex = 1

weights -= 3kg

state.failure = 0

}

}

}

}

~}

Thanks in advance.

Posted Dec 29, 2025, 8:00 PM UTC

14
Loading comments…