Solved Command List

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

Neelix_bear

Active Member
Aug 11, 2023
215
7
18
How can I create a command with a text argument that has a list like when you add <player> and it lists the players for you to select from but instead a custom list of texts you can select from?
 
Code:
add "hello" to {strings::*}
add "bye" to {strings::*}
Now you have "hello" and "bye" in one list, I hope you meant something like this.
 
Code:
add "hello" to {strings::*}
add "bye" to {strings::*}
Now you have "hello" and "bye" in one list, I hope you meant something like this.
no like how when you put "command /test <player>" for the "<player>" argument will have a list of options you can set and when you press "TAB" it will autofill the top option
 
Do you mean like how with vanilla commands that have a text argument, you can click tab and it will show you the texts you can use? In which case this resource created using skript-reflect adds exactly the custom syntax you need. https://forums.skunity.com/resources/tab-completer.780/

Its very simple.
If i have a command for levels and i have /levels <text> <player> <number>, I can just do
Code:
on load:
    add "levels add" to tab completions
    add "levels get" to tab completions
    add "levels set" to tab completions

I've tested this on my server and as far as I can tell it works fine with skript 2.7+ and skript-reflect 2.4
 
I also made a command that goes along with this to be able to add, get, remove, and clear tab completions from in game if you'd like
Python:
command tabcompletions [<text>] [<text>]:
    trigger:
        if arg-1 is not set:
            loop {tabcompletions::*}:
                send "%loop-value%" to sender
        else if arg-1 is "get":
            loop {tabcompletions::*}:
                send "%loop-value%" to sender
        else if arg-1 is "remove":
            arg-2 is set:
                remove arg-2 from tab completions
                send "&cRemoved %arg-2% from tab completions" to sender
            else:
                message "&cYou have to take something from the tab completions, you fool!"

        else if arg-1 is "add":
            arg-2 is not set:
                message "&cYou have to add something to the tab completions, you fool!"
            else:
                add arg-2 to tab completions
                send "&cAdded %arg-2% to tab completions!"


        else if arg-1 is "clear":
            clear {tabcompletions::*}
            send "&cCleared all tab completions!" to sender

        else:
            send "&cIncorrect arguments!" to sender
 
Do you mean like how with vanilla commands that have a text argument, you can click tab and it will show you the texts you can use? In which case this resource created using skript-reflect adds exactly the custom syntax you need. https://forums.skunity.com/resources/tab-completer.780/

Its very simple.
If i have a command for levels and i have /levels <text> <player> <number>, I can just do
Code:
on load:
    add "levels add" to tab completions
    add "levels get" to tab completions
    add "levels set" to tab completions

I've tested this on my server and as far as I can tell it works fine with skript 2.7+ and skript-reflect 2.4
is there a way to do it in normal skript and skbee
 
This is the event used the reflect version I sent (its just imported from bukkit events using reflect, rather than done with SkBee), try playing with it.
Shouldn't take long, its very simple, I just figured the reflect skript was easier due to the custom syntax and such.
 
K also does this disable any other arguments from being put or do I have to add a if statement to the command?
 
You can input anything into the text argument, this simply adds recommendations. If you want to disable other arguments you must use if/else/else if statements.