Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enums / Enumerations #5921

Closed
1 task done
andriemc opened this issue Aug 19, 2023 · 5 comments
Closed
1 task done

Enums / Enumerations #5921

andriemc opened this issue Aug 19, 2023 · 5 comments
Labels
waiting for reply The report needs a response from the reporter to determine course of action.

Comments

@andriemc
Copy link

Suggestion

Skript currently doesnt have support for enums, which can be kinda useful at times.

Basically lets say you have a list of items, and you want them to be easy to access so something such as {_enumName}.%itemName%, it can possibly be defined using set {_enumName} to (enumeration|enum) [(with|of)] %list%

Why?

This can improve ease-of-use for skripters.

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
@Shroobz
Copy link

Shroobz commented Aug 19, 2023

Agreed, been wanting this for 6 months

@AyhamAl-Ali
Copy link
Member

This is not English-friendly syntax but can you give a good usage for this?

@AyhamAl-Ali AyhamAl-Ali added the waiting for reply The report needs a response from the reporter to determine course of action. label Aug 19, 2023
@Fusezion
Copy link
Contributor

Fusezion commented Aug 19, 2023

I don't see the use in this if going based off set {_enumName} to (enumeration|enum) [(with|of)] %list%
it's just a shorter form of

set {_list::DIAMOND} to diamond
set {_list::GOLD_DIAMOND} to gold ingot
set {_list::GREEN_DIAMOND} to emerald
send {_list::GREEN_DIAMOND}

you'd make the "name" the index

@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Aug 19, 2023

You can already do this with aliases and only enum classinfos that have been registered.

on target:
    the target cause is target cause.nether portal
    the target cause is target cause.nether_portal
    the target cause is target cause.NETHER_PORTAL

This feature only exists so that you can explicitly tell Skript what enum classinfo to parse as. Example being a visual effect, a block and an itemtype can all be called fire so you would define like particle.fire

You shouldn't ever need to do this with the active efforts we've done to ensure Skript parses correctly and won't get confused. Also addons must be using the .lang files to tell Skript exact values. Example being attempting to parse setting a block to fire but Skript reads fire as a particle and causes a "cannot understand" error. This will not happen in 2.7+.

Variables can be changed instantaneously, so Skript would not know the enum classinfo type. This is very unsafe to be doing. We'd only be allowed to see the type of a local variable with this pull request #5457 which opens some interesting possibilities for variables. Gives it an approval to show your interest in the pull request. Either way it should be on track for v2.8.

@Moderocky
Copy link
Member

I'm going to close this because it is incredibly unclear what the suggestion is for, and the issue-maker has not commented to add any more information or to clarify this.
Due to its vagueness this isn't a good issue to be a base for any kind of enum discussion.

If the issue-maker wants to have another go at explaining what they are suggesting we can re-open this issue, or they can make a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for reply The report needs a response from the reporter to determine course of action.
Projects
None yet
Development

No branches or pull requests

6 participants