Solved Loop doesnt work

  • 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 comminuty!

    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.

MrNygus

Active Member
Jan 28, 2017
116
2
18
26
I have skript:

Code:
function graczeObok(p: player) :: boolean:
    loop all players in radius 50 around {_p}:
        set {vdate::%{_p}%::%loop-player%} to round(distance between loop-player and {_p})
    delete {vdate::%{_p}%::%{_p}%}
    return true
   
every 5 seconds:
    delete {vdate::*}
    loop all players in "world":
        graczeObok(loop-player)
   
command /pokaz:
    trigger:
        #doesnt work
        loop {vdate::*}:
            send "P:%loop-index%" to player
            send "W:%loop-value%" to player
        #works
        loop {vdate::%player%::*}:
            send "P2:%loop-index%" to player
            send "W2:%loop-value%" to player

doesnt work first loop in cmd /pokaz but second works... How to repair it?
[doublepost=1622150033,1621966431][/doublepost]f5 brothers
 
ok, try this:
setting the vallue in {vdate::%player%} to true. and test your not working loop if it works as you wanted it.

Code:
function graczeObok(p: player) :: boolean:
    set {vdate::%{_p}%} to true
    loop all players in radius 50 around {_p}:
        set {vdate::%{_p}%::%loop-player%} to round(distance between loop-player and {_p})
    delete {vdate::%{_p}%::%{_p}%}
    return true
 
every 5 seconds:
    delete {vdate::*}
    loop all players in "world":
        graczeObok(loop-player)
 
command /pokaz:
    trigger:
        #doesnt work
        loop {vdate::*}:
            send "P:%loop-index%" to player
            send "W:%loop-value%" to player
        #works
        loop {vdate::%player%::*}:
            send "P2:%loop-index%" to player
            send "W2:%loop-value%" to player

alternatively change your command part to this:
Code:
command /pokaz:
    trigger:
        #doesnt work
        loop indexes of {vdate::*}:
#            send "P:%loop-index%" to player
            send "W:%loop-value%" to player
        #works
        loop {vdate::%player%::*}:
            send "P2:%loop-index%" to player
            send "W2:%loop-value%" to player
[doublepost=1622285271,1622241083][/doublepost]please elaborate which of the things worked for you. it might help other people who search the forum

also, with my first post. as i said, you didn't have a {vdate::*} as you didn't put any values at that level, you only had lists at that level. which is not a value itself.
 
Status
Not open for further replies.