Create a timer that only is active for specified time?!

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

pepper82

Member
Jan 26, 2017
272
1
18
Hi all,
I know there is the "Periodical" event in Skript, but I am looking for a performance friendly way to check some variables every second.

In Skript I would do it like this:

every 1 second:
do something

But the event is always running, even when I am doing nothing or it is not needed (e.g. Minigames, Events etc.)

Does anybody know of another option to have such a timer running but only as long as I need it?

I think in Java you can create tasks for specific period and then delete them again. How to do something similar in Skript?

Thanks for your help!
 
Just add a condition to the event. Check for whether a variable is set or something...
 
:emoji_grinning: I know, but not what I am looking for. I do not even want to check anything after my event / minigame is over / not active.
 
Hmm i'm not so good in english, but in skript. so, do you mean maybe like this?

code_language.skript:
command /minigame:
  trigger:
    send "Bla"
    send "here set up team or somethings"
    #theeennnn example
    set {_bla} to true #Sset some variables to true
    while {_bla} is true: #And check if variables is true (He will start to loop while minigame active)
        #Reamin add some Wait events. example 1 seconds
        wait a seconds
        if size of {_Team.A::*} less than 1:
            delete {_bla} #End the Loop(Timer)
            send "Team B won!"
         else:
             send "Time are running and running..."
 
Status
Not open for further replies.