btk5h / skript-db

MIT License
5 stars 6 forks source link

Problem using it in function #11

Open DevilishDante opened 5 years ago

DevilishDante commented 5 years ago

hello, i cannot use skript-db in function in deed when i try this

    if {_player}'s inventory contains 100 emerald:
        execute unsafe "UPDATE `Cle_1` SET `Cle_1`.`Quantité` = `Quantité`+1 WHERE `Cle_1`.`UUID` = %{_uuid}%" in {SqlFarm}
        send "{@PCShopSurvie2}Vous venez &ad'acheter&f une &8✥ &7Clé Commune &8✥ {@PCShopSurvie2}" to {_player}
        remove 100 emerald from {_player}'s inventory
    else:
        send "{@PCShopSurvie}Vous n'avez &cpas assez d'émeraude&r pour acheter ceci ! {@PCShopSurvie}" to {_player}

Without sql line work perfectly but with it skript do nothing , literaly nothing, i don't have any error in console or when i reload thanks for reading me

btk5h commented 5 years ago

Does the line work outside of a function?

DevilishDante commented 5 years ago

Does the line work outside of a function?

hello, yes work perfectly

PS: sorry if my english isn't perfect i'm french and i don't speak english every day u.u

btk5h commented 5 years ago

Try using skript-mirror instead of using functions. Skript functions don't really play nicely with asynchronous effects.

DevilishDante commented 5 years ago

skript-mirror??

btk5h commented 5 years ago

Yes, the documentation for custom effects is here. Try using that instead of using a function.

DevilishDante commented 5 years ago

hmm ok it seems a litle bit hard to learn this but i try :s

TestingUser661 commented 5 years ago

Hey. Is there an update on this? Maybe make a config "sql in functions", because some people have hundreds of functions that have to be changed.

btk5h commented 5 years ago

Hey. Is there an update on this? Maybe make a config "sql in functions", because some people have hundreds of functions that have to be changed.

This is simply not possible since Skript does not support this. Your only option is to use something that does support async effects, like custom effects.

TestingUser661 commented 5 years ago

Skript does not support what? If you could make it an config option, some people could have lots of time saved. Not everyone can change hundreds of functions to custom effects

btk5h commented 5 years ago

Skript does not support what? If you could make it an config option, some people could have lots of time saved. Not everyone can change hundreds of functions to custom effects

Functions are not allowed to contain waits. SQL effects behave as waits so that they do not freeze your server while the request is being executed.

If this is a feature that you need, a fix has to be made on Skript's side, not skript-db's.