I have now been playing around with this problem for a bit more than a week.
I have found out that when I enter a field and then set a variable to the fields height the set var step will record the height as it was before I entered a field unless I add a pause before the set var step.
I have also found out that setting number variables and then use them in comparisons $j > $k may work at first but then it stops working and won't start working again until I change the comparison to getasnumber ($j) > getasnumber ($k)
I've tried this on several machines over here and it seems to be the same on them all.
I've tried this on Mac-OS and Windows
I have included a demo file with two scripts. The script ending in the number 1 works while the script ending in the number 2 doesn't
I tried adding the file to this message but couldn't figure out how to do it so I placed it under the heading VarTester_2.fmp12
I would like to know if anyone besides me experiences the same problems as I have described.