Hi guys,

I have made a timer to countDown from 10 seconds
to zero and it works but I cannot understand why I
had to subtract an additional value of one from the following line:

  gMyTime = 10 - (gMyTime -1) -1

without this the counter will start from 11 rather than 10.

I would have thought that :
  gMyTime = 10 - (gMyTime -1)
would do the job but...


Can anyone be kind enough to explain this to me?


Here is the full code:

on prepareFrame
  set the text of field "Ten" = ""  --resets the text to empty
end


on exitFrame me
  global gMyTime
  startTimer
  go to the frame
  repeat while the timer <= 10*60  --10 seconds
    Ctime
    put gMyTime into field "Ten"
  end repeat
  halt

end

on Ctime
  global gMyTime
  gMyTime = the timer /60  -- set the timer to seconds
  gMyTime = 10-(gMyTime-1)-1  --detract one with each second

end

Thanks

JohnT



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to