• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
    12
    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?
     
  • 1,748
    Posts
    14
    Years
    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