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?
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!
You can always check out skUnity Downloads for downloads and any other information about Skript!
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 optionNow you have "hello" and "bye" in one list, I hope you meant something like this.Code:add "hello" to {strings::*} add "bye" to {strings::*}
on load:
add "levels add" to tab completions
add "levels get" to tab completions
add "levels set" to tab completions
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
is there a way to do it in normal skript and skbeeDo 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
k thanksYou 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.