Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Allow sorting based on expression with input

Open Fusezion opened this issue 4 years ago • 4 comments

Skript/Server Version

[19:25:23] [Server thread/INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[19:25:23] [Server thread/INFO]: [Skript] Skript's documentation can be found here: https://skriptlang.github.io/Skript
[19:25:23] [Server thread/INFO]: [Skript] Server Version: 3171-Spigot-610a8c0-fb556bf (MC: 1.17.1)
[19:25:23] [Server thread/INFO]: [Skript] Skript Version: 2.5.3
[19:25:23] [Server thread/INFO]: [Skript] Installed Skript Addons:

This was also tested on 2.6-Beta3 just wasn't on that server while making this

Bug Description

When you go over to the docs you search sorted you'll see the expression sorted %objects% however whenever I run code such has send "%sorted (items within player's inventory)%" it just replaces with <none> while send "%items within player's inventory%" will respond correctly with all my items just not sorted

Expected Behavior

I expected it to sort every item in my inventory

on inventory click:
  click type is middle mouse button
  set items within event-inventory to sorted items within event-inventory

Steps to Reproduce

using this code it should replicate the same issue I've been getting it'll load without any errors however sorting will just set it to <none>

on inventory:
  player's gamemode is survival
  click type is middle mouse button
  send "%sorted items within event-inventory%"
  # in skript 2.6-beta3 this'll just clear the inventory
  # set items within event-inventory to sorted items within event-inventory

Errors or Screenshots

No errors are shown or sent to console

Other

Not too sure if I should have put this under suggestion

Agreement

  • [X] I have read the guidelines above and confirm I am following them with this report.

Fusezion avatar Sep 11 '21 19:09 Fusezion

How do think items should be sorted then? By amount? This doesn't really make sense to me.

Mwexim avatar Sep 12 '21 11:09 Mwexim

How do think items should be sorted then? By amount? This doesn't really make sense to me.

By name preferably it's no different than by alphabetically sorting text. well besides being items I don't mind the amount but sorting items to at least go from (stone, dirt, grass) to (dirt, grass, stone) would be what I'd want to see

and along side that I only view this as a bug as unlike numbers and string when they get sorted it'll be the same as they are but when we do items it just sets it to doesn't even keep the items

Fusezion avatar Sep 12 '21 14:09 Fusezion

This isn't a bug: image

I also don't think items should be comparable, but it would be a good idea to allow more sorting possibilities, such as {_items::*} sorted with raw name of input. For that, I'm marking this as an enhancement

TPGamesNL avatar Sep 12 '21 16:09 TPGamesNL

alternative syntax suggestion: %objects% sorted based on %expression% e.x. {_items::*} sorted based on name of item

Pikachu920 avatar Dec 05 '21 22:12 Pikachu920