Streams #6715
Labels
enhancement
Feature request, an issue about something that could be improved, or a PR improving something.
up for debate
When the decision is yet to be debated on the issue in question
Suggestion
The only thing that is close to streams right now is "filtering", which barely even works since you can only have one line. Streams aren't required but they do for sure make life easier
Streams have alot of features but the only thing that would fit skript are:
Mapping: Example
loop entitytypes mapped as ["%entitytype input%"]
<-- filters entitytypes to stringsFiltering: Exists
AnyMatch: Example
if all players matches at least [{bal::%uuid of player input%} >= 1000}] <-- True if there's at least one player with 1000 coins, false otherwise
AllMatch: Same as AnyMatch but all have to match
Sorting: This would require a
compare
function which does Integer.compare(..). Exampleset {_sorted::*} to {_list::*} sorted using [compare(length of input-2, length of input-1)]
<-- Returns {_list::*} from the longest to the shortestI feel like the current predicate system isn't really that efficient since they only allow one line, a good way to solve it is to allow functions or custom sections to be passed in like SkriptReflect proxy system. There should also be the old system for quicker streaming
here are 2 examples on how this could be done
Something that makes Streams unique is that you can stack multiple streams in one line, how this could be done is when u use a stream it actually returns a stream and u have to mark it with
to list
at the end. This might be annoying to some people so it'd be nice if you can disable it from the Skript configExample:
The way this would be done right now is like this
I know there's descending order in Skript, but I wanted to keep it simple. In some cases for example you want to sort pets from legendary to common, the only way is to do it manually with a loop
Why?
Saves some lines and makes code more readable in some cases
Other
No response
Agreement
The text was updated successfully, but these errors were encountered: