Counter increments by two?
Posted: Tue Sep 18, 2012 12:03 pm
I have a script linked to a button. Press the button, and a counter increments.
If the counter value is equal or greater than 9, it resets (to zero). The initial value is zero.
This is my script
When I press the button the script prints the counter value to the screen.
First press = 1
Second press = 3
Third press = 5 (and so on)
After the counter resets the value to zero, the first press after this prints the value as 2 [then 4, 6, 8, 10]
After the counter [again] resets (when the value is 9 or greater), the subsequent values are always the even ones, never the odd.
What's going on here?
If the counter value is equal or greater than 9, it resets (to zero). The initial value is zero.
This is my script
Code: Select all
function activate()
counter_1:increment()
CellNum = counter_1:getValue()
print(CellNum)
if CellNum>=9 then counter_1:reset() end
endFirst press = 1
Second press = 3
Third press = 5 (and so on)
After the counter resets the value to zero, the first press after this prints the value as 2 [then 4, 6, 8, 10]
After the counter [again] resets (when the value is 9 or greater), the subsequent values are always the even ones, never the odd.
What's going on here?