I'm trying to create triggers for each science module with a loop, and running into some trouble. The following should print the numbers 1 through 10 (not necessarily in order, I'm not sure if triggers are always checked in order of creation?), but it doesn't. Now, if the use of locals was totally broken in triggers, you might expect that it would print "10" ten times, or maybe do nothing at all.
Instead, none of those things happen. It just prints "1", once.
{
local trig to false.
local a to 0.
until a > 10 {
local b to a.
on trig {
print b.
}
}
set trig to true.
}
Here's another case, this time with a for loop.
set offsets to list(1,2,3,4,5).
for t in offsets {
local offset to t.
local utime to time:seconds + offset.
when time:seconds > utime then {
print "t: " + t + " offset: " + offset.
}
}
wait until 0.
This should print something every second for five seconds. At worst, you might expect it to wait five seconds, then print five lines. Instead, it simply prints t: 5 offset: 1.