find one unset variable and set them.

  • 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.

nfvlryy

Member
Mar 29, 2021
4
0
1
hi guys so i have the code:
and i want to find an unset variable and set them but not set all 10 variables just a one example i have set {test::myusername::1} so i want to function to set next variable be set it would like to be {test::myusername::2}

function test(p: player):
loop 10 times:
if {test::%{_p}%::%loop-value%} is not set:
set {test::%{_p}%::%loop-value%} to "[test]"

thank you
 
be sure to add 4 spaces in front of your set, right now it is at the same order of your loop (and you do nothing if your IF is valid)

or place your code in ['code] brackets.

just reread your post, you want to break from the loop after you've added the variable.
why are you not just using 'add'?

Code:
function test(p: player):
    add "[test]" to {test::%{_p}%::*}

that should automatically put your value at the end of the list
 
Last edited:
Status
Not open for further replies.