Skript dev37c, paper spigot 1.12.1
Reproduce:
command /test [<texts>]:
trigger:
set {_args::*} to arguments split at " "
loop {_args::*}:
send loop-value
"can't do that because the latter is not an object"
i have also attempted loop arguments:, but that returns a single value only, no matter the amount of arguments
If you want to take in text and split it at " ", you can just make the argument text (not plural) and then set {_args::*} to text-argument split at " ". I'm not sure if I'm misunderstanding but I don't think there is a bug here, there just isn't an arguments expression within command events so you're not going about it properly.
That worked, thank you!
I'm unsure wether i'm doing it wrong or this is unintentional behaviour, hence why i posted this
I believe it was just wrong but there's an argument to be made for an arguments expression in commands which would be a list containing all arguments as Skript parsed them. Could be useful for checking args as a group, getting the number of them entered (for optional args), and seeing how Skript parsed more complex commands.
@SkriptLang/developers ? Not sure how doable or valuable that is.
It would be quite useful, it's exactly what i'm trying to work on right now - although the same can be achieved with that help you gave me there. Here's what i'm using this for (dynamic arguments for intuitive command use):
Long story short on that code below is that you can use it in any way:
/flyspeed player value mode
/flyspeed value player mode
/flyspeed mode player
etc
/edit:
released this as a download: https://forums.skunity.com/resources/meinkraft.619/
command /flyspeed [<text>]:
trigger:
command sender has permission "mk.speed"
set {_args::*} to argument split at " "
loop {_args::*}:
{_mode}, {_player} and {_value} are set:
exit loop
{_mode} is not set:
loop-value = "set", "get" or "reset"
set {_mode} to loop-value
delete {_args::%loop-index%}
continue
{_player} is not set:
set {_player} to loop-value parsed as player
{_player} is set
delete {_args::%loop-index%}
continue
{_value} is not set:
set {_value} to loop-value parsed as number
{_value} is set
delete {_args::%loop-index%}
continue
{_player} is not set:
set {_player} to command sender
{_mode} is not set:
set {_mode} to "get"
{_args::*} is set:
loop {_args::*}:
set {_args::%loop-index%} to """%loop-value%"""
send "&cUnused arguments: %{_args::*}%"
if {_mode} = "get":
send "Flight speed of %{_player}% = %{_player}'s flight speed%"
else if {_mode} = "set":
if {_value} is not set:
send "{@prefix} &cMissing value-argument"
else:
set {_player}'s flight speed to {_value}
argument does not contain " !s"
send "{@prefix} Set flight speed of %{_player}% to %{_value}%"
else if {_mode} = "reset":
reset {_player}'s flight speed
send "{@prefix} Reset flight speed of %{_player}%"
Most helpful comment
It would be quite useful, it's exactly what i'm trying to work on right now - although the same can be achieved with that help you gave me there. Here's what i'm using this for (dynamic arguments for intuitive command use):
Long story short on that code below is that you can use it in any way:
/flyspeed player value mode/flyspeed value player mode/flyspeed mode playeretc
/edit:
released this as a download: https://forums.skunity.com/resources/meinkraft.619/