search
View the thread on skUnity Forums
Tab completer is the command's argument completer, in a manner of speaking, obviously.
In this case we can complete the /gamemode arguments using the TAB key
To use the tab completer in skript, we need a script with our command, this is the mine:
- command /gm
: - trigger:
- set player's gamemode to arg-1
- send "&aChanged your gamemode to %arg-1%"
- on tab completer for "/gm":
- #In this line we need to put the command.
- set {_completers::*} to "adventure", "creative", "spectator" and "survival"
- #In this line we need to put the arguments to complete.
- loop {_completers::*}:
- add loop-value to completions
Now, our command has the tab completions.
![[IMG]](https://forums.skunity.com/proxy.php?image=https%3A%2F%2Ffotos.subefotos.com%2F3c7df9ecc2910c429864833211ec20cao.png&hash=22139026c410682820e89aa446239bc9)
Here more examples:
addSpoiler: /home
Command script:
Completer script:
Screenshot:
- command /sethome <string>:
- trigger:
- if {homes::%player%::*} is set:
- set {home::%player%::%arg-1%} to player's position
- add "%arg-1%" to {homes::%player%::*} #set {homes::%player%::*} to "%{homes::%player%::*}%" and "%arg-1%"
- send "&aYour house %arg-1% was set"
- else:
- set {home::%player%::%arg-1%} to player's position
- set {homes::%player%::*} to "%arg-1%"
- send "&aYour house %arg-1% was set"
- command /home <string>:
- trigger:
- if {home::%player%::%arg-1%} is set:
- teleport player to {home::%player%::%arg-1%}
- send "&aYou was teleported to %arg-1%"
- else:
- send "&4Invalid house name"
- command /homes:
- trigger:
- send "&aYour houses: %{homes::%player%::*}%" to player
- command /delhome <string>:
- trigger:
- if {home::%player%::%arg-1%} is set:
- delete {home::%player%::%arg-1%}
- remove "%arg-1%" from {homes::%player%::*}
- send "&aYour house was deleted"
- else:
- send "&4Invalid house name"
- on tab completer for "/home":
- set {_completers::*} to {homes::%player%::*} #We can use variables
- loop {_completers::*}:
- add loop-value to completions
![[IMG]](https://forums.skunity.com/proxy.php?image=https%3A%2F%2Ffotos.subefotos.com%2Fe66fbf08a68103a67ac6c1012b9b7e53o.png&hash=76a1373bfeeb133eaf3f19be62562766)

RESOURCES
skUnity ©2013-2023. Site created by Wrong and BaeFell