×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

timer count down problem

timer count down problem

timer count down problem

(OP)
am using this code beloew: but when i run it i can not get it to count down for 30 sec, instead i get like -5945 :S any help would be very grateful

cheers chris

global gEndTime


on startMovie
  
  -- game ends 30 seconds from now
  gEndTime = the ticks + 30*60
  
  
  showTime
end

on showTime
  -- convert ticks to seconds remaining
  timeLeft = (gEndTime - the ticks + 30)/60
  
  -- use this text
  text = "Time:"&&timeLeft
  
  -- if text is different than text displayed
  if member("Time").text <> text then
    member("Time").text = text
  end if
  
  -- time up?
  if timeLeft <= 0 then
    go to frame "gameover"
  end if
end

RE: timer count down problem

Your script works just fine. I'd place "showTime" event in the frame loop so the display will be updated, something like:
--
on exitFrame me
   showTime
   go the frame
end
--
Also I wouldn't use "text" as a variable name as "text" is predefined property name in Lingo: you (or Director) will get confused otherwise!

Kenneth Kawamoto
www.materiaprima.co.uk

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close