I am trying to make a loop to detect if something has changed. Normally I'd use a previous and current variable, like so:
:set_integer var="prev_val" value="current_val"; // <- store previous value
:gosub("randomly_change_current_val");
:if (prev_val != current_val){ // <- test for change
: print "something changed.";
}
, but I can't seem to get the value to be evaluated as an integer, it just thinks I keep meaning the word. I've tried lots of permutations but I can't seem to assign the value of a variable into another variable. Is this possible? I'm implementing a workaround for now using a loop, but I suspect I'll blow the stack if I'm not careful. It's a nasty hack :)
make_equal : subroutine {
: if (prev_val < current_val) { :increment "prev_val"; :gosub "make_equal"; }
:else_if (prev_val > current_val) {:decrement "prev_val"; :gosub "make_equal";}
}