Solved Help with skript loop stopping after some 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.

aescraft

Well-Known Member
Mar 1, 2017
295
13
0
I don't know why, but after some time, the code stop working.

code_language.skript:
every 1 minute in world "world":
  loop all players:
    if {sono.%loop-player%.bypass} is set:
      stop
    if {sono.%loop-player%} is not set:
      set {sono.%loop-player%} to 80
    remove 1 from {sono.%loop-player%}
    broadcast
    send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
    if {sono.%loop-player%} > 210:
      remove speed from the loop-player
      apply speed 1 to the loop-player for 70 seconds
      remove night vision from the loop-player
      apply night vision 1 to the loop-player for 70 seconds     
    if {sono.%loop-player%} < 1:
      set {sono.%loop-player%} to 1
    if {sono.%loop-player%} < 30:
      apply slowness 1 to the loop-player for 60 seconds
    if {sono.%loop-player%} < 5:
      remove blindness from the loop-player
      apply blindness 2 to the loop-player for 70 seconds
      stop
    if {sono.%loop-player%} < 10:
      remove blindness from the loop-player
      apply blindness 1 to the loop-player for 70 seconds
      stop

Also, WHY can't i use just "every 1 minute"? The skript asks for the "in wirld "world"...

[doublepost=1491848006,1491846994][/doublepost]Ok, looks like the bypass was the issue.
Can someone help me with another way to give players a toggle function for the loop? This part " if {sono.%loop-player%.bypass} is set: stop" breaks the skript.
 
You can try to use in any loop part "if check" expression

stop loop
 
The code now:

code_language.skript:
every minute:
  loop all players:
    if {sono.%loop-player%.bypasss} = true:
    else:
      if {sono.%loop-player%} is not set:
        set {sono.%loop-player%} to 80
      remove 1 from {sono.%loop-player%}
      send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
      if {sono.%loop-player%} > 210:
        remove speed from the loop-player
        apply speed 1 to the loop-player for 70 seconds
        remove night vision from the loop-player
        apply night vision 1 to the loop-player for 70 seconds     
      if {sono.%loop-player%} = 1:
        set {sono.%loop-player%} to 2
      if {sono.%loop-player%} < 30:
        apply slowness 1 to the loop-player for 60 seconds
      if {sono.%loop-player%} < 5:
        remove blindness from the loop-player
        apply blindness 2 to the loop-player for 70 seconds
        stop
      if {sono.%loop-player%} < 15:
        remove blindness from the loop-player
        apply blindness 1 to the loop-player for 70 seconds
        stop

When I first load the skript it works, but when I return to the server later, it does not work for me.


--

You can try to use in any loop part "if check" expression

stop loop
Sorry, I don't get it. Can you show me in my code?
 
Here you go, instead of "stop" use "stop loop", which will completely stop the loop...

code_language.skript:
every 1 minute in world "world":
  loop all players:
    if {sono.%loop-player%.bypass} is set:
      stop loop
    if {sono.%loop-player%} is not set:
      set {sono.%loop-player%} to 80
    remove 1 from {sono.%loop-player%}
    broadcast
    send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
    if {sono.%loop-player%} > 210:
      remove speed from the loop-player
      apply speed 1 to the loop-player for 70 seconds
      remove night vision from the loop-player
      apply night vision 1 to the loop-player for 70 seconds    
    if {sono.%loop-player%} < 1:
      set {sono.%loop-player%} to 1
    if {sono.%loop-player%} < 30:
      apply slowness 1 to the loop-player for 60 seconds
    if {sono.%loop-player%} < 5:
      remove blindness from the loop-player
      apply blindness 2 to the loop-player for 70 seconds
      stop
    if {sono.%loop-player%} < 10:
      remove blindness from the loop-player
      apply blindness 1 to the loop-player for 70 seconds
      stop
 
Here you go, instead of "stop" use "stop loop", which will completely stop the loop...

code_language.skript:
every 1 minute in world "world":
  loop all players:
    if {sono.%loop-player%.bypass} is set:
      stop loop
    if {sono.%loop-player%} is not set:
      set {sono.%loop-player%} to 80
    remove 1 from {sono.%loop-player%}
    broadcast
    send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
    if {sono.%loop-player%} > 210:
      remove speed from the loop-player
      apply speed 1 to the loop-player for 70 seconds
      remove night vision from the loop-player
      apply night vision 1 to the loop-player for 70 seconds   
    if {sono.%loop-player%} < 1:
      set {sono.%loop-player%} to 1
    if {sono.%loop-player%} < 30:
      apply slowness 1 to the loop-player for 60 seconds
    if {sono.%loop-player%} < 5:
      remove blindness from the loop-player
      apply blindness 2 to the loop-player for 70 seconds
      stop
    if {sono.%loop-player%} < 10:
      remove blindness from the loop-player
      apply blindness 1 to the loop-player for 70 seconds
      stop
Still not working.
:emoji_frowning:
 
Try to remove the "Stop" or "stop loop"

example:

code_language.skript:
every 1 minute in world "world":
  loop all players:
    {sono.%loop-player%.bypass} is not set#everyone who... has NOT bypass will stop here.
    if {sono.%loop-player%} is not set:
      set {sono.%loop-player%} to 80
    remove 1 from {sono.%loop-player%}
    send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
    if {sono.%loop-player%} > 210:
      remove speed from the loop-player
      apply speed 1 to the loop-player for 70 seconds
      remove night vision from the loop-player
      apply night vision 1 to the loop-player for 70 seconds  
    if {sono.%loop-player%} < 1:
      set {sono.%loop-player%} to 1
    if {sono.%loop-player%} < 30:
      apply slowness 1 to the loop-player for 60 seconds
    if {sono.%loop-player%} < 5:
      remove blindness from the loop-player
      apply blindness 2 to the loop-player for 70 seconds
      stop
    if {sono.%loop-player%} < 10:
      remove blindness from the loop-player
      apply blindness 1 to the loop-player for 70 seconds
      stop




btw "Every seconds" is very bad. you should use instead "while player is online:" in "on join" events.
 
code_language.skript:
every minute in world "world":
    loop all players:
        {sono.%loop-player%} is not set:
            set {sono.%loop-player%} to 80
        else:
            {sono.%loop-player%.bypass} is not set:
                remove 1 from {sono.%loop-player%}
                broadcast
                send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
                if {sono.%loop-player%} > 210:
                    remove speed from the loop-player
                    apply speed 1 to the loop-player for 70 seconds
                    remove night vision from the loop-player
                    apply night vision 1 to the loop-player for 70 seconds   
                if {sono.%loop-player%} < 1:
                    set {sono.%loop-player%} to 1
                if {sono.%loop-player%} < 30:
                    apply slowness 1 to the loop-player for 60 seconds
                if {sono.%loop-player%} < 5:
                    remove blindness from the loop-player
                    apply blindness 2 to the loop-player for 70 seconds
                    stop
                if {sono.%loop-player%} < 10:
                    remove blindness from the loop-player
                    apply blindness 1 to the loop-player for 70 seconds
                    stop
            else:
                stop loop
 
  • Like
Reactions: aescraft
btw "Every seconds" is very bad. you should use instead "while player is online:" in "on join" events.

Like this:

code_language.skript:
on join:
  while player is online:
    wait 1 minute
    if {sono.%player%.bypass} is not set:
      if {sono.%player%} is not set:
        set {sono.%player%} to 80
      remove 1 from {sono.%player%}
      send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%player%}%/240" to player
      if {sono.%player%} > 210:
        remove speed from the player
        apply speed 1 to the player for 70 seconds
        remove night vision from the player
        apply night vision 1 to the player for 70 seconds  
      if {sono.%player%} = 1:
        set {sono.%player%} to 2
      if {sono.%player%} < 30:
        apply slowness 1 to the player for 60 seconds
      if {sono.%player%} < 5:
        remove blindness from the player
        apply blindness 2 to the player for 70 seconds
        stop
      if {sono.%player%} < 15:
        remove blindness from the player
        apply blindness 1 to the player for 70 seconds
        stop

?
[doublepost=1491949794,1491949716][/doublepost]
code_language.skript:
every minute in world "world":
    loop all players:
        {sono.%loop-player%} is not set:
            set {sono.%loop-player%} to 80
        else:
            {sono.%loop-player%.bypass} is not set:
                remove 1 from {sono.%loop-player%}
                broadcast
                send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
                if {sono.%loop-player%} > 210:
                    remove speed from the loop-player
                    apply speed 1 to the loop-player for 70 seconds
                    remove night vision from the loop-player
                    apply night vision 1 to the loop-player for 70 seconds
                if {sono.%loop-player%} < 1:
                    set {sono.%loop-player%} to 1
                if {sono.%loop-player%} < 30:
                    apply slowness 1 to the loop-player for 60 seconds
                if {sono.%loop-player%} < 5:
                    remove blindness from the loop-player
                    apply blindness 2 to the loop-player for 70 seconds
                    stop
                if {sono.%loop-player%} < 10:
                    remove blindness from the loop-player
                    apply blindness 1 to the loop-player for 70 seconds
                    stop
            else:
                stop loop
Trying it now
[doublepost=1491950058][/doublepost]
code_language.skript:
every minute in world "world":
    loop all players:
        {sono.%loop-player%} is not set:
            set {sono.%loop-player%} to 80
        else:
            {sono.%loop-player%.bypass} is not set:
                remove 1 from {sono.%loop-player%}
                broadcast
                send action bar from "&o&c§l-1 §7[§a-§7] §6%{sono.%loop-player%}%/240" to loop-player
                if {sono.%loop-player%} > 210:
                    remove speed from the loop-player
                    apply speed 1 to the loop-player for 70 seconds
                    remove night vision from the loop-player
                    apply night vision 1 to the loop-player for 70 seconds
                if {sono.%loop-player%} < 1:
                    set {sono.%loop-player%} to 1
                if {sono.%loop-player%} < 30:
                    apply slowness 1 to the loop-player for 60 seconds
                if {sono.%loop-player%} < 5:
                    remove blindness from the loop-player
                    apply blindness 2 to the loop-player for 70 seconds
                    stop
                if {sono.%loop-player%} < 10:
                    remove blindness from the loop-player
                    apply blindness 1 to the loop-player for 70 seconds
                    stop
            else:
                stop loop
Ok, it's working!

But my first code was working at the beginning, and stop working later.
When I reconnect to the server after some time, it stops looping it for me.
I'll come back later to tell if your code kept working after some time.
Thanks!

Thank you all @HiiqhFive @ChisleLP @TheIronMinerLv

--

Just one thing, @HiiqhFive:

Is it possible to keep the action bar for some seconds? By using the wait X tickets and repeating the code? Thanks.
[doublepost=1491958381][/doublepost]Yep.
It stopped working after some time. :emoji_confounded::emoji_confounded::emoji_confounded:

[doublepost=1491966110][/doublepost]THE SOLUTION!

Just remove the

code_language.skript:
            else:
                stop loop

From the @HiiqhFive posted code.
 
Ah, k.
Skript only shows The actionbar for 1 second, Just repeat The Code.
 
Status
Not open for further replies.