• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to actually make a countdown timer?

Dban1

To Be The Best ROM Hacker
  • 27
    Posts
    13
    Years
    I wanted to make a situation where there would be a timer counting down and when 1 minute is up, the event would trigger something.


    I've googled around but I still don't have enough information.

    I heard some sources say to copy the bug contest and use some map update script of some sort, but I'm still lost. Anyone?
     
    Well you could use time functions:

    Code:
    def initialize
      @startTime = time.now.to_i
      @activated = false
    end
    
    def update
      if Time.now.to_i - @startTime >= 60 & !@activated # 60 seconds = 1 minute
        @activated = true
        # do whatever it is here.
      end
    end

    Although, this is a rough copy of a method, it should be enough to get you on track.

    If you need something more specific I could help you with that.
     
    Back
    Top