Restart a time?

Is it possible to restart a timer?

Comments

  • ArmellineArmelline Member, PRO Posts: 5,408

    If you mean the "Timer" behaviour, then yes. There are several ways, but wrapping it in a rule triggered by a boolean is probably the easiest way.

    If you mean a timer you've made based on game.Time/self.Time, then yes. Just base the timer on the value of self.Time when the timer starts, and reset that value to reset the timer.

    If you mean something else, then probably yes, but I don't know :D

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline‌ How would I do this? How would I make the boolen?

  • ArmellineArmelline Member, PRO Posts: 5,408

    Make a boolean, e.g. self.Restart. Make a rule, and put the timer inside that rule. Have the condition for the rule be "When self.Restart is false". In the otherwise, (i.e. when self.Restart is true), add a Change Attribute self.Restart to false.

    When you want to restart the timer, just change self.Restart to true. It'll immediately be set back to false, and the timer will trigger again.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Armelline‌
    This what I have
    1. self.Restart is false
    2. Do:
    3. Timer
    4. Otherwise
    5. change attribute to false

    I don't understand what you want me to do for when the self.Restart is true?

  • ArmellineArmelline Member, PRO Posts: 5,408

    You need to make the rule containing the timer NOT be active for a short period of time, so when it is made active again it will run the timer again. To do this you just have to make the rule be not active. Since the rule is active when self.Restart is false, you need to set self.Restart to true.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited September 2014

    @armelline okay I think I got it. So you want me to check self.Restart then do this
    1. self.Restart is false 2. Do: 3. Timer 4. Otherwise 5. change attribute to false right? :)

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    bump?

  • ArmellineArmelline Member, PRO Posts: 5,408

    I suggest you try making what I've said in GameSalad, and playing around with it to see if what you're doing is right. If it doesn't work, try to figure out why, and refer back to my explanations. There are only so many ways I can say the same thing.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @armelline okay..

Sign In or Register to comment.