Solved will this skript work? if not please fix it

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

jeff1231

Member
Mar 22, 2024
38
1
8
on earth :o
www.costco.com
Code:
command /randomgem:
permission: gem.random
permission message: You cannot execute that command!
trigger:
# Define the list of available commands
set {_commands} to ["say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13", "say 14"]
# Check if the player has already used any command
loop 14 times:
set {_randomIndex} to random integer between 1 and 14
set {_selectedCommand} to {_commands} at {_randomIndex}
if {_selectedCommand} is not set:
continue
else:
set {_commands} at {_randomIndex} to null
execute console command "execute as %player% run {_selectedCommand}"
 
Code:
command /randomgem:
permission: gem.random
permission message: You cannot execute that command!
trigger:
# Define the list of available commands
set {_commands} to ["say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13", "say 14"]
# Check if the player has already used any command
loop 14 times:
set {_randomIndex} to random integer between 1 and 14
set {_selectedCommand} to {_commands} at {_randomIndex}
if {_selectedCommand} is not set:
continue
else:
set {_commands} at {_randomIndex} to null
execute console command "execute as %player% run {_selectedCommand}"
I have the same question as these other two guys on the thread @bigD, @FindME. What are you trying to make ?>?>
 
im trying to make a thing that when the command is executed it will choose a random command from a list of 14 commands and only do a command no one has done before, when the command is completed it will remove it from the list of available commands.
 
I made this so far and it works, have a great time and mark this thread as "Solved".

Code:
on load:
    set {commands::*} to "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14"

command /randomcommand:
    trigger:
        if {commands::*} is not set:
            send "&cThere aren't any commands to use!"
        else:
            set {_f} to random element of {commands::*}
            remove {_f} from {commands::*}
            execute console command "sudo %player% %{_f}%"
 
Last edited:
  • Like
Reactions: jeff1231
hey, im not sure if this is what you need, but thats what i understand.
Code:
on load:
    add "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14" to {commands::*}
    loop {usedcommands::*}:
        remove loop-value from {commands::*}

command /randomgem:
    permission: gem.random
    permission message: You cannot execute that command!
    trigger:
        set {_selectedcommand} to random element out of {commands::*}
        execute console command "execute as %player% run {_selectedCommand}"
        remove {_selectedcommand} from {commands::*}
        add {_selectedcommand} to {usedcommands::*}
 
Last edited:
hey, im not sure if this is what you need, but thats what i understand.
Code:
on load:
    add "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14" to {commands::*}
    loop {usedcommands::*}:
        remove loop-value from {commands::*}

command /randomgem:
    permission: gem.random
    permission message: You cannot execute that command!
    trigger:
        set {_selectedcommand} command to random element out of {commands::*}
        execute console command "execute as %player% run {_selectedCommand}"
        remove {_selectedcommand} from {commands::*}
        add {_selectedcommand} to {usedcommands::*}
Thats not even functioning right and has syntax errors.
 
hey, im not sure if this is what you need, but thats what i understand.
Code:
on load:
    add "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14" to {commands::*}
    loop {usedcommands::*}:
        remove loop-value from {commands::*}

command /randomgem:
    permission: gem.random
    permission message: You cannot execute that command!
    trigger:
        set {_selectedcommand} command to random element out of {commands::*}
        execute console command "execute as %player% run {_selectedCommand}"
        remove {_selectedcommand} from {commands::*}
        add {_selectedcommand} to {usedcommands::*}
I fixed the syntax errors but still doesnt Function. Maybe consider re-writing it ?
Made by @DanRub

Code:
on load:
    add "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14" to {commands::*}
    loop {usedcommands::*}:
        remove loop-value from {commands::*}

command /randomgem:
    permission: gem.random
    permission message: You cannot execute that command!
    trigger:
        set {_selectedcommand} to random element of {commands::*}
        execute console command "sudo %player% %{_selectedcommand}%"
        remove {_selectedcommand} from {commands::*}
        add {_selectedcommand} to {usedcommands::*}


This one (Which is mine) Functions right and doesnt have syntax errors, im cool innit? :emoji_grinning:
Made by @HeliumBoi

Code:
on load:
    set {commands::*} to "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14"

command /randomcommand:
    trigger:
        if {commands::*} is not set:
            send "&cThere aren't any commands to use!"
        else:
            set {_f} to random element of {commands::*}
            remove {_f} from {commands::*}
            execute console command "sudo %player% %{_f}%"
 
I fixed the syntax errors but still doesnt Function. Maybe consider re-writing it ?
Made by @DanRub

Code:
on load:
    add "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14" to {commands::*}
    loop {usedcommands::*}:
        remove loop-value from {commands::*}

command /randomgem:
    permission: gem.random
    permission message: You cannot execute that command!
    trigger:
        set {_selectedcommand} to random element of {commands::*}
        execute console command "sudo %player% %{_selectedcommand}%"
        remove {_selectedcommand} from {commands::*}
        add {_selectedcommand} to {usedcommands::*}


This one (Which is mine) Functions right and doesnt have syntax errors, im cool innit? :emoji_grinning:
Made by @HeliumBoi

Code:
on load:
    set {commands::*} to "say 1", "say 2", "say 3", "say 4", "say 5", "say 6", "say 7", "say 8", "say 9", "say 10", "say 11", "say 12", "say 13" and "say 14"

command /randomcommand:
    trigger:
        if {commands::*} is not set:
            send "&cThere aren't any commands to use!"
        else:
            set {_f} to random element of {commands::*}
            remove {_f} from {commands::*}
            execute console command "sudo %player% %{_f}%"
What exactly is not working man :emoji_grinning:
 
So thats why you have on load set to every command, okay man XD
When I use /randomgen it's using the same command again and again which isnt removing anythign from any variable, which the operator of this thread clearly mentioned saying "when the command is completed it will remove it from the list of available commands." So yea yours doesnt have "Used command detections"
 
Yep, it has to be loaded. Unlike yours, mine actually works.
Loaded with every command that could be used before, gj, tell me what exactly doesnt work in my code? If you mean this line
Code:
execute console command "execute as %player% run {_selectedCommand}"
Then idk if i want to cry or laugh XD
also idk if you know what loop is, but okay :emoji_slight_smile: