Skip to content

calloption function #4786

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

Closed
1 task done
Zabrid opened this issue Jun 5, 2022 · 6 comments
Closed
1 task done

calloption function #4786

Zabrid opened this issue Jun 5, 2022 · 6 comments
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). up for debate When the decision is yet to be debated on the issue in question

Comments

@Zabrid
Copy link

Zabrid commented Jun 5, 2022

Suggestion

I was talking to some people yesterday in the SkUnity discord to try and see if it was possible to get skript options without hard code calling them.

on example being
command /getoption [<text>]: trigger: send "{@%arg 1%}"

Figured out this was impossible but I had an idea, what if there was a function for example, calloption(), that would allow you to get an option converted into a string like calloption("prefix") and it would return the prefix as a string, even if the prefix wasn't necessarily written as a string. You could maybe make this work with numbers or integers but idk enough about java for that.

Just thought this would be a neat idea and would help with making better configs in script.

Why?

Would be very useful

Other

No response

Agreement

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

A default function to get an option would certainly be possible (likely after #4108 is merged). Either that or an expression maybe
the script option[s] %strings%

@APickledWalrus APickledWalrus added feature Pull request adding a new feature. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). labels Jun 6, 2022
@TPGamesNL TPGamesNL added enhancement Feature request, an issue about something that could be improved, or a PR improving something. and removed feature Pull request adding a new feature. labels Jun 6, 2022
@TPGamesNL
Copy link
Member

I don't think options should be used for this purpose, this is what variables are for: #1140 (comment)

@TheBentoBox
Copy link
Member

Also, if you really wanted to use an option but be able to reference it at runtime in addition to at parse time, you can already do that by setting a variable to the option on script load, so it's not like there isn't a way to do this already.

@AyhamAl-Ali
Copy link
Member

A default function to get an option would certainly be possible (likely after #4108 is merged). Either that or an expression maybe the script option[s] %strings%

It might be useful IMO, sometimes you may not want to use variables to avoid storing specific data in variables file as they may not need to be there (for any reason) and just use it directly from options.

I just don't see a disadvantage in such enhancement unless it's complex to implement.

@Zabrid
Copy link
Author

Zabrid commented Jun 7, 2022

The original thought I had for this came after trying to figure out a way to make a configurable shop-gui. Basically the idea was, if someone wanted to make a shop they would just have an option named like <shop-name> [gui.name]: "Blah" and that would allow me to call the shop and it would basically be created just from writing an option, similar to how it's possible to do using YAML. I've tried making a YAML shop in skript (https://www.spigotmc.org/resources/%E2%9C%B6-dinoshop-%E2%9C%B6-1-18-support-skript-fully-configurable-shop-gui.98096/) It's a pain in the fucking ass

And I think that it would just be kinda weird to make the user write code like set {-shop.%{_name}%::gui-name} to "Blah" when if this feature was a thing they could just do <shop-name> [gui.name]: "Blah" making it much more user friendly.

Oh also this would help a great amount with just making one config file for a script has many files. Instead of needing to make a function that makes you account for every option individually, you could just make a function that's like

function callconfigstringoption(t: text) :: text:
return the script option {_t}

This would also allow (for custom item making scripts) to be much better.

For example what if you could make a script where you could create a fully custom item just by doing this:

name [<item-name>]: "&8Bob's Stick"
item [<item-name>]: stick
lore [<item-name>]: "&7Bob uses this stick to summon lightning"
nbt [<item-name>]: "{lightning-wand:1,HideFlags:63}"
glowing [<item-name>]: true/false
And if you didn't want one of of these attributes, you would just simply remove the option and no error would occur.

Idk if this made any sense I'm not very good at getting my points across in written words.

Basically: Would make, making scripts that are more complex but also user non-developer friendly, possible.

@AyhamAl-Ali AyhamAl-Ali added the PR available Issues which have a yet-to-be merged PR resolving it label Jun 9, 2022
@TheLimeGlass TheLimeGlass reopened this Mar 11, 2023
@APickledWalrus APickledWalrus added up for debate When the decision is yet to be debated on the issue in question and removed PR available Issues which have a yet-to-be merged PR resolving it labels Jul 12, 2024
@Moderocky
Copy link
Member

This is not an appropriate use of options, there are many other (better) ways to achieve the same thing.

@Moderocky Moderocky closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). up for debate When the decision is yet to be debated on the issue in question
Projects
None yet
Development

No branches or pull requests

7 participants