Closed Spartan9802 closed 6 years ago
Skript-db is asynchronously already, the thing is that it is a delayed effect and thus, it doesn't work on functions.
There are a lot of alternatives to functions though, such as custom syntaxes from skript-mirror.
I tested with skript-mirror expressions but it doesn't work ^^
on script load:
set {sql} to the database "mysql://localhost:3306/test?user=root&password=&useSSL=false"
expression getValue:
get:
execute "select * from data" in {sql} and store the result in {_output::*}
return {_output::*}
command /dbtest:
trigger:
set {_output::*} to getValue
send "%{_output::*}%"
This return null
you can't have delayed expressions the same way you can't have delayed functions with return. Use an effect.
Also, why would you use a function in that case? You could directly use the effect in the command and it'd be the same.
It's just for example ^^ Otherwise I use the functions for my inventorysaver on every death, world change, etc. the inventory is saved in database and it is possible to regive it via an interface
But it's not possible to get back on an effect?
So have you thought about my request?
skript-db already executes queries asynchronously. The issue is that expressions cannot be asynchronous or contain any delays.
The solution is to create a delayed custom effect to send your requests, store the results in a variable, and create a custom expression to return the results.
Hey, Could you add support to use skript-db asynchronously, it's not possible at the moment to use it in a function I find it really too bad it's what still pushes me to use Skquery that spam my data bade x)