Jump to content

How to use arguments?


Uravunos

Recommended Posts

Hello, I don’t have any problems in general, although I wanted to learn a bit more about skript arguments, so anything related to arguments is fine! 
the main questions I have is:

-how do you use skript arguments

-what would you use them for

- some examples

Thanks for letting me understand arguments better!

Link to comment
Share on other sites

Skript arguments are things that are used when making commands. The argument is what comes after a main command like in the vanilla command /tp _Tarna_. _Tarna_ is the first argument in the command. There are multiple different types of arguments such as integer, number, player, offline player, text, timespan and many more. 

This site shows a list of arguments you can use and what each one means. https://dev.bukkit.org/projects/skript/pages/custom-commands

Here is an example of a command that uses multiple arguments. 

command /eco <text> <offline player> <number>:
  	permission: eco
  	trigger:
  		if arg-1 is "add":
  			add arg-3 to {bal::%arg-2's uuid%}
  		else if arg-1 is "remove":
  			remove arg-3 from {bal::%arg-2's uuid%}
  		else if arg-1 is "set":
  			set {bal::%arg-2's uuid%} to arg-3

Offline player is just any player that is online or offline. If you just use <player>, you can only put a player that is online on the server at the time. number is just any number like 5, 7.24, 1.6. If you use <integer>, it would have to be a number without a decimal. 

And for text, it is just any kind of text. But if the text argument is used as the last argument in a command, it includes all the text following it. Like here is an example. 

command /broadcast <text>:
  	aliases: /bc
  	permission: bc
  	trigger:
  		broadcast "[BROADCAST] %arg-1%"

With this, you can do /broadcast hello everyone. and it will broadcast all of it.

There are many more different types of arguments but these are just a few common ones I gave examples for. I'm not the best at skript but if you have any other questions or need help, just reply or message me on Discord if you have one. Tarna256#8675. 

  • Like 1
  • Thanks 1

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 - 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - 12/20/22

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

1 hour ago, _Tarna_ said:

Skript arguments are things that are used when making commands. The argument is what comes after a main command like in the vanilla command /tp _Tarna_. _Tarna_ is the first argument in the command. There are multiple different types of arguments such as integer, number, player, offline player, text, timespan and many more. 

This site shows a list of arguments you can use and what each one means. https://dev.bukkit.org/projects/skript/pages/custom-commands

Here is an example of a command that uses multiple arguments. 


command /eco <text> <offline player> <number>:
  	permission: eco
  	trigger:
  		if arg-1 is "add":
  			add arg-3 to {bal::%arg-2's uuid%}
  		else if arg-1 is "remove":
  			remove arg-3 from {bal::%arg-2's uuid%}
  		else if arg-1 is "set":
  			set {bal::%arg-2's uuid%} to arg-3

Offline player is just any player that is online or offline. If you just use <player>, you can only put a player that is online on the server at the time. number is just any number like 5, 7.24, 1.6. If you use <integer>, it would have to be a number without a decimal. 

And for text, it is just any kind of text. But if the text argument is used as the last argument in a command, it includes all the text following it. Like here is an example. 


command /broadcast <text>:
  	aliases: /bc
  	permission: bc
  	trigger:
  		broadcast "[BROADCAST] %arg-1%"

With this, you can do /broadcast hello everyone. and it will broadcast all of it.

There are many more different types of arguments but these are just a few common ones I gave examples for. I'm not the best at skript but if you have any other questions or need help, just reply or message me on Discord if you have one. Tarna256#8675. 

Thanks for the in depth reply! That really helped!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...