btk5h / skript-db

MIT License
5 stars 5 forks source link

Local variables cannot be used #12

Open TrademarkTM opened 5 years ago

TrademarkTM commented 5 years ago

https://github.com/SkriptLang/Skript/commit/048ce296c2c3427bbbb5f9d128d150b802de0df3 https://github.com/SkriptLang/Skript/commit/237b3dd928f3108d154204d3e98af1208e7679f4

This is the same bug report I did in skript-mirror. The variables are now deleted in asynceffects, so you're unable to use them in skript-db.

andrei923 commented 5 years ago

still persists

function test(p: player):
    set {_uuid} to uuid of {_p}
    execute unsafe "select * from test WHERE uuid = '%{_uuid}%'" in {test} and store the result in {_output::*}
    broadcast "%{_uuid}%"

command test:
    trigger:
        test(player)

skript 2.4-alpha4 skript-db-0.2.1

Diamax10 commented 5 years ago

Use custom syntax of skript-mirror instead of Skript function, like:

function sayPlayerExperience(p: player):
  set {_uuid} to UUID of {_p}
  execute "SELECT * FROM players WHERE uuid = %{_uuid}%" in {sql} and store the result in {_databasePlayer::*}
  broadcast "1: %{_databasePlayer::experience::1}%"

effect say %player% experience:
  trigger:
    execute "SELECT * FROM players WHERE uuid = %UUID of expression-1%" in {sql} and store the result in {_databasePlayer::*}
    broadcast "2: %{_databasePlayer::experience::1}%"

command /testEffect:
  trigger:
    sayPlayerExperience(player) #1: <none>
    say player experience #2: 140 <-- example
ghost commented 4 years ago

Skript-mirror syntax doesn't solve the problem. Both of your exemples are working. The problem is not to display the query's result but to use the other local variables after the query.

bloggy commented 4 years ago

I still hope for a fix ... it would help so much

I was using 0.1.1 on 1.15.2 and local variables worked fine. But when updating to 1.16.4 this version won't work anymore. So you have to use the latest 0.2.1 version which will disable the use of local variables

juradev commented 4 years ago

But you can try this fork which seems to work: https://github.com/Govindass/skript-db/releases/tag/1.2.0