SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.06k stars 368 forks source link

Colons in Options #2189

Open Wealthyturtle opened 5 years ago

Wealthyturtle commented 5 years ago

Description

Currently, options don't support colons that are at the end of the option (example: for use in periodical options)

Steps to Reproduce

options:
    test: every 1 second:

{@test}
    broadcast "Test"

Expected Behavior

For Test to be broadcasted every 1 second

Errors / Screenshots

Line 2: Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. (line 2: test: every 1 second:')
Line 5: Indentation error: expected 0 spaces, but found 4 spaces (line 6: broadcast "Test"')
Line 2: Invalid line in options (script.sk, line 2: test: every 1 second:')
Line 2: Invalid line - all code has to be put into triggers (line 3: stop')
Line 4: Invalid line - all code has to be put into triggers (line 5: {@test}')

Server Information

Additional Context

Perhaps get the end of an option string by testing for the end of line character?

Moderocky commented 5 years ago

Although I believe options should allow colons (for use in strings or whatever), I do not see this as limiting what you're doing in this situation.

You could just as easily do: every {@test} seconds: and set the option test to 1.

Even if (for some reason) you really, really wanted to make options for your events (although this seems wholly unnecessary to me?) you could use {@option}: with the colon after it, to avoid using it in the option name.

I agree in principle (as it is something of a limitation), though not with the usage in your example.

AyhamAl-Ali commented 5 years ago
Wealthyturtle commented 5 years ago
  • The Ability to use options inside other options this would help a lot.

That one might be harder to achieve, because it would have to check for nested options first, then handling non-nested options, then continuing handling of nested options, starting from the lowest order

AyhamAl-Ali commented 5 years ago
  • The Ability to use options inside other options this would help a lot.

That one might be harder to achieve, because it would have to check for nested options first, then handling non-nested options, then continuing handling of nested options, starting from the lowest order

I know it might be hard to achieve but it would be really useful sometimes but not really necessary all the time.