Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Timer Toggle

KresslackKresslack Florida, United StatesMember Posts: 6,694 @@ - Legendary Achaean
edited May 2013 in Tech Support
How would one go about making a toggable tigger, which is turned on and off using an alias, such as TN | TF? Any help would be greatly appreciated. 




Misspelled titles make me cry.
Post edited by Gaia on

Comments

  • JonathinJonathin Retired in a hole.Member Posts: 3,423 @@ - Legendary Achaean
    edited May 2013
    Instead of having the timer run indefinitely, you could always use enable/disableTimer()

    Alternatively, if you don't want to use a variable you can use isActive().

    Example:

    if isActive("timerName","timer") == 1 then  --1 because isActive returns as 0 or 1
      disableTimer("timerName")
      echo("timerName disabled!")
    else
     enableTimer("timerName")
     echo("timerName enabled!")
    end

    My site will remain up, but will not be maintained. The repository will continue to have scripts added to it if I decide to play another game. Maybe I'll see you around in Starmourn!
    Tutorials and scripts  The Repository

  • EldEld Member Posts: 3,946 @@ - Legendary Achaean
    Daeir said:
    Does lua evaluate 0/1 as true/false like other C languages? A bit unrelated, but you should just be able to use isActive without the equals evaluation.
    Lua evaluates false and nil as false and anything else (including 0) as true.
    [Deleted User]
  • IocunIocun Member Posts: 3,695 @@ - Legendary Achaean
    Yeah. isActive() actually returns a count of active aliases/triggers/timers by that name, not a boolean value. It would return 2 if you had two timers by that name.
    VadimusesJonathin
  • JonathinJonathin Retired in a hole.Member Posts: 3,423 @@ - Legendary Achaean
    My bad. I don't have more than 1 of anything with a particular name, so it's always returned 0 or 1 for me. Good to know though.

    My site will remain up, but will not be maintained. The repository will continue to have scripts added to it if I decide to play another game. Maybe I'll see you around in Starmourn!
    Tutorials and scripts  The Repository

  • KresslackKresslack Florida, United StatesMember Posts: 6,694 @@ - Legendary Achaean
    Completely forgot about this, but thanks for all the advice. About to try it out.
Sign In to Comment.