SkQuery Tab Completer

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

Status
Not open for further replies.

sofabeddd

Member
Oct 14, 2020
1
0
1
19
The Internet
So I am trying to make a tab completer for my command. Is there any way to detect which argument is being used? Here's my code:

on tab completer for "/gens":
if player has permission "gens.admin":
if argument at 2 is not set:
clear {subcommandSuggestions::*}
add "genInfo", "giveGen", "removeAllGens", "setMaxOwnableSlots", "setSlotsOwned", "toggleDrops", and "toggleGenSFX" to {subcommandSuggestions::*}
loop {subcommandSuggestions::*}:
add "%loop-value%" to suggestions
else if argument at 3 is not set:
if argument at 2 is "genInfo", "giveGen", "setMaxOwnableSlots", or "setSlotsOwned":
loop all players:
add "%loop-player%" to suggestions
else if argument at 4 is not set:
if argument at 2 is "setMaxOwnableSlots" or "setSlotsOwned":
add "1" to suggestions
else if argument at 2 is "giveGen":
clear {subcommandSuggestions::*}
add "Black", "Gray", "LightGray", "White", "Pink", "Red", "Orange", "Lime", "Green", "Cyan", "LightBlue", "Blue", "Purple", and "Magenta" to {subcommandSuggestions::*}
loop {subcommandSuggestions::*}:
add "%loop-value%" to suggestions
else if argument at 5 is not set:
if argument at 2 is "giveGen":
add "1" to suggestions

The script has no errors but it doesn't work. Here is a little thing I made showing the command and possible arguments since it gives a better visual than the actual code:

/gens {
genInfo {
<player>;
}

giveGen {
<player> {
Black {
<amount>;
}

Gray {
<amount>;
}

LightGray {
<amount>;
}

White {
<amount>;
}

Pink {
<amount>;
}

Red {
<amount>;
}

Orange {
<amount>;
}

Yellow {
<amount>;
}

Lime {
<amount>;
}

Green {
<amount>;
}

Cyan {
<amount>;
}

LightBlue {
<amount>;
}

Blue {
<amount>;
}

Purple {
<amount>;
}

Magenta {
<amount>;
}


}

}

removeAllGens;

setMaxOwnableSlots {
<player> {
<amount>;
}

}

setSlotsOwned {
<player> {
<amount>;
}


}

toggleDrops;

toggleGenSFX;

}
 
Format your code in the post so it's easier to read through. You can do this by editing your post, pressing the plus icon on the post toolbar and select code. Paste your code there:emoji_slight_smile:
 
Status
Not open for further replies.