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

Parse section is broken in custom event #88

Open
Lotzyprod opened this issue Jan 27, 2024 · 1 comment
Open

Parse section is broken in custom event #88

Lotzyprod opened this issue Jan 27, 2024 · 1 comment

Comments

@Lotzyprod
Copy link

Describe the bug
You can't do anything in parse section. Variables isn't saved to use it in check section, you cant get literals and e.t.c

To reproduce

event "custom_event":
	pattern: custom_event [<(.+)>]
	event-values: string
	parse:
		set {_regex} to first element of regex-1
		set {_a} to 1
		continue
	check:
		broadcast "%{_a}%"
		broadcast "%{_regex}%"
		continue

on custom_event regex:
	broadcast "Event called"

on load:
	set {_evt} to custom event "custom_event"
	call event {_evt}

Expected behavior
{_a} variable is 1 at start of check section
{_regex} will = "regex"

Server information

  • skript-reflect 2.4 (last actions)
  • Skript 2.8
  • PaperSpigot 1.20.4
@Lotzyprod
Copy link
Author

Lotzyprod commented Feb 7, 2024

Analysing this problem further, a new problem emerged, I believe that now Skript is trying to parse events before structures (or custom event parsed before custom event creation section for no reason).
Because of this, when parsing a custom event (not the custom event creation section), on this line:

Boolean bool = StructCustomEvent.parseSectionLoaded.get(which);

always be null if we has custom event structure and handler in same script file.
It turns out that regardless of the presence of a parse section, the event can be used before loading parse section.

In the case when the event handler is located in another script file, everything seems to be fine, but the parse section still works strangely.
Somehow, magically, instance of SyntaxParseEvent is automatically marked to continue, even if 'continue' was not specified in the parse section:
https://github.com/SkriptLang/skript-reflect/blob/7c3cbfdb24e1c59e836c7f04276aae87c66fdb66/src/main/java/org/skriptlang/reflect/syntax/event/elements/CustomEvent.java#L66C1-L76C37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant