Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Improve command expressions for command events and script commands

Open APickledWalrus opened this issue 3 years ago • 7 comments

Description

This PR adds support for script commands to ExprCommand. This allows users to determine the alias used in a script command if that script command has aliases. It removes the "arguments" option in ExprCommand, as I have added command event support to ExprArgument, which has been completely reworked.


Target Minecraft Versions: Any Requirements: None Related Issues: I don't think so

APickledWalrus avatar Jun 19 '21 05:06 APickledWalrus

this actually already exists: https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54

Pikachu920 avatar Jun 21 '21 14:06 Pikachu920

this actually already exists:

https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54

That expression can only be used in on command events, not custom commands

TPGamesNL avatar Jun 21 '21 14:06 TPGamesNL

this actually already exists: https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54

That expression can only be used in on command events, not custom commands

I wonder if I could merge this new expression into that one. I will take a look at it.

EDIT: actually, that might cause conflicts with ExprArgument, and the other two things probably aren't necessary for a user

APickledWalrus avatar Jun 23 '21 01:06 APickledWalrus

this actually already exists:

https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54

I honestly think it'd be better to adapt the ExprCommand to support our custom command trigger instead, at least for the label and full command patterns (the arguments as a whole could as well be supported but it's rather useless, but if someone wants to do it for sake of completeness so be it)

FranKusmiruk avatar Jun 24 '21 01:06 FranKusmiruk

this actually already exists: https://github.com/SkriptLang/Skript/blob/e72349ec8dda606a947c3568b3f387fb5007863d/src/main/java/ch/njol/skript/expressions/ExprCommand.java#L54

I honestly think it'd be better to adapt the ExprCommand to support our custom command trigger instead, at least for the label and full command patterns (the arguments as a whole could as well be supported but it's rather useless, but if someone wants to do it for sake of completeness so be it)

I ended up removing the arguments pattern from ExprCommand and just added support for command events to ExprArgument. I also combined this new class with ExprCommand instead. I'll push these changes later today once I am done testing.

APickledWalrus avatar Jun 24 '21 05:06 APickledWalrus

There is a related issue

  • #1455

AyhamAl-Ali avatar Sep 11 '22 08:09 AyhamAl-Ali

There is a related issue

I'm not sure if that issue applies. It's not possible to do loop all arguments because it doesn't really have a good use case. I don't think that something like %texts% is multiple arguments - it's just one argument that accepts multiple values. Really, I think you would have to do something like loop text-argument?

APickledWalrus avatar Sep 18 '22 01:09 APickledWalrus