Discord Thread is there a way to use "goto :#" in skript?

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

This thread came from the skUnity Discord. You can't reply to it here but if you join the skUnity Discord, you'll be able to post a reply there. The thread link is part of the thread's message.
Status
Not open for further replies.

skUnity Discord

Site Manager
Aug 5, 2023
12,755
0
0
The skUnity Discord
discord.gg
i want to do it so that, if a number in a list already exists, it goes back to a previous step until it chooses a number that doesnt exist in that list.

for example:
(the #'s are supposed to represent what i need help with)
`command /test <number>:
trigger:
set {i} to 0
loop arg 1 times:
set {i} to {i} + 1
:1
set {number%{i}%} to a random integer between 1 and 6
if {numbers::*} contains {number%{i}%}:
goto :1
add {number%{i}%} to {numbers::*}
send "%{number%{i}%}%"`

Posted by: jacknug from the skUnity Discord. View the thread on skUnity Discord here
 
didnt seem to work...

´command /test <number>:
trigger:
set {i} to 0
loop arg 1 times:
set {i} to {i} + 1
set {number%{i}%} to a random integer between 1 and 6
while {numbers::*} contains {number%{i}%}:
set {number%{i}%} to a random integer between 1 and 6
add {number%{i}%} to {numbers::*}
send "%{number%{i}%}%"´

Posted by: jacknug from the skUnity Discord.
 
its still repeating numbers

`command /test <number>:
trigger:
set {i} to 0
loop arg 1 times:
set {i} to {i} + 1
set {number%{i}%} to a random integer between 1 and 6
do while {numbers::*} contains {number%{i}%}:
set {number%{i}%} to a random integer between 1 and 6
add {number%{i}%} to {numbers::*}
send "%{number%{i}%}%"`

or do you mean to do this?

`command /test <number>:
trigger:
set {i} to 0
loop arg 1 times:
set {i} to {i} + 1
set {number%{i}%} to a random integer between 1 and 6
do set {number%{i}%} to a random integer between 1 and 6 while {numbers::*} contains {number%{i}%}
add {number%{i}%} to {numbers::*}
send "%{number%{i}%}%"`

Posted by: jacknug from the skUnity Discord.
 
did sadly not work but will probably fix issues later on
not really i dont think, its mostly to randomize a list of 6, so if you do "/test 2" then 2 out of 6 will be true and the rest will be false, so like a guessing game
(in my screenshots im using "/test 5"

Posted by: jacknug from the skUnity Discord.
 
code_language.skript:
loop {_true} times:
     add true to {_list::*}
loop {_false} times:
     add false to {_list::*}
broadcast shuffled {_list::*}
However idk why this code wouldnt work

Posted by: mr_darth from the skUnity Discord.
 
Makes a shuffled list with {true} true values, and {false} false values
{_true} would be the arg, false would be 6 - arg

Posted by: mr_darth from the skUnity Discord.
 
oh that could actually work
ill try that rq
is there a way to shuffle the list on its own without sending it in chat?
nvm i figured out how set {numbers::*} to shuffled {numbers::*}
alright, i think i can continue my skript from here on out. thanks for the help!

Posted by: jacknug from the skUnity Discord.
 
Status
Not open for further replies.