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

1.14 - Local variables disappear in the same trigger #2316

Closed
antoinech2 opened this issue Jul 30, 2019 · 5 comments
Closed

1.14 - Local variables disappear in the same trigger #2316

antoinech2 opened this issue Jul 30, 2019 · 5 comments
Labels
duplicate For bugs or requests that have already been made and are currently open.

Comments

@antoinech2
Copy link

Description

Hello, I'm using the skript-bd add-on to be able to use MySql requests in Skript.
But since Skript 2.4 in 1.14, the local variables disappear when I use a skript-bd's syntax.
This is a Skript issue, because it work fine in Skript 2.2 in 1.12.2. I juste updated Skript and it does not work anymore!
Furthermore, I reported this bug to @btk5h, the skript-bd addon developer. He told me that it is a Skript issue.

I think it is related to thread desynchronization but I don't know myself.

Steps to Reproduce

	send "BEFORE: %{_test}%" to player
	execute unsafe "SELECT log_console,log_ingame,log_script,log_global FROM skript_log_config WHERE script = '%{_script}%'" in {mysql_db} and store the result in {_mysql_result::*}
# The bug works whatever the request is
	send "AFTER: %{_test}%" to player

Expected Behavior

The local value {_test} still has its value, "test" after the SQL request.

Errors / Screenshots

After the request, the value of test {_test} variable is deleted, as you can see:
image

Server Information

  • Server version/platform: PaperSpigot 1.14.4 # 152
  • Skript version: Skript 2.4-beta4 (bug only in 2.4 versions, work in 2.2 versions)
  • skript-db version: 0.1.1 or 0.2.1 (bug in all versions with Skript 2.4)

Additional Context

Please fix this bug because it break all my scripts with these syntax.

@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Jul 31, 2019

Skript is not designed to work asynchronously from the main thread. Skungee has the same issue.
Once the event changes/removes, the variables get deleted from the currentEvent as it's a local variable and only present on the event.

You have to either set it again from an effect of the addon (which is what Skungee does to handle local variables asynchronously) or use global variables (the ones without the _)

This is not a new bug either, as this has been present since the $ thread syntax existed in SkQuery and I would have expected w00t to know that.

Could be fixed by a database recode which bensku and the team have been meaning to do for awhile. Maybe we could use H2 over SQLite for multi threading potential.

@TheLimeGlass
Copy link
Collaborator

SkQuery/SkQuery#8

@Blueyescat
Copy link
Contributor

Yes it is new and started after 237b3dd. Skript devs know about this, addons has to fix that issue themselves. See btk5h/skript-db#14

@antoinech2
Copy link
Author

antoinech2 commented Jul 31, 2019

Thank you very much for your quick answer,

If I understand correctly it is skript-bd who must solve the problem on his side?
And maybe this fix can work (btk5h/skript-db#14)? (It had been approved by the dev but never been put in place)

@bensku
Copy link
Member

bensku commented Aug 4, 2019

Kind of duplicate of #1817. This pretty much needs a new variable system to solve.

@bensku bensku closed this as completed Aug 4, 2019
@bensku bensku added the duplicate For bugs or requests that have already been made and are currently open. label Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate For bugs or requests that have already been made and are currently open.
Projects
None yet
Development

No branches or pull requests

4 participants