Solved Everything you can do with options?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

KarimAKL

Active Member
Apr 20, 2018
50
2
0
29
I wanna make a script where you can just change 1 option either something like this:
Code:
Options:
    type: GUI
    # type can be either "GUI" or "Text"
or something like this:
Code:
Options:
    GUI: true
    Text: false
And then of course i wanna be able to check if it's true or false, if i use the first one i wanna be able to check with something like this:
Code:
if {@type} is "GUI":
Anyway, how would i do that? I've never had the need for it before now. :emoji_stuck_out_tongue:
Btw the title is "Everything you can do with options?" because if you could i would like for you to type what you can use the "options" for other than for editing messages much easier. :emoji_stuck_out_tongue:
 
Not really sure what your question is here, because what you typed is correct
If you did
options:
text: gui

and then
if {@text} is "gui":
#do something
Is correct
Also this is straight from Njol's skript page

If a normal variable was used all players would recieve the name of the last player who joined since normal variables are unique.
Local variables are also automatically deleted when they are not needed anymore and do not clutter the variables file, but their data is lost when the server stops (which does not matter that much as all scripts also stop running and won't resume where they left off when the server restarts).
The last kind of variables are options which are not actually variables at all. You can add a section ‘options’ to your script like this:You can then use these options anywhere in your scripts with {@option name}. The reason why I stress anywhere is because options will be replaced one-to-one with their values just before the script is parsed. Thus you can put anything into options, even whole script lines or parts thereof. Remember to not use percent signs around options in text though as the percent signs will remain.
 
Not really sure what your question is here, because what you typed is correct
If you did
options:
text: gui

and then
if {@text} is "gui":
#do something
Is correct
Also this is straight from Njol's skript page

If a normal variable was used all players would recieve the name of the last player who joined since normal variables are unique.
Local variables are also automatically deleted when they are not needed anymore and do not clutter the variables file, but their data is lost when the server stops (which does not matter that much as all scripts also stop running and won't resume where they left off when the server restarts).
The last kind of variables are options which are not actually variables at all. You can add a section ‘options’ to your script like this:You can then use these options anywhere in your scripts with {@option name}. The reason why I stress anywhere is because options will be replaced one-to-one with their values just before the script is parsed. Thus you can put anything into options, even whole script lines or parts thereof. Remember to not use percent signs around options in text though as the percent signs will remain.
I have this:
Code:
Options:
    type: GUI
And then later i have this:
Code:
if {@type} is "GUI":
But when i reload the script with "/sk reload (script-name)"
It comes with the following error:
Code:
'GUI' is not an entity type (script-name.sk, line 9: if {@type} is "GUI":')
 
Status
Not open for further replies.