1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Addon skript-db 0.2.0

Sensible SQL support for Skript

  1. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    You would have to grab the value, perform the operations you want to it, and then update the value in the database.
     
  2. I

    IvanFakov Member

    Joined:
    Apr 13, 2018
    Messages:
    3
    Likes Received:
    0
    Doesn't work for me + 3

    Code (Skript):
    1.             execute "SELECT * FROM stats WHERE user = %player's name%" in {sql} and store output in {_statGGG::*}
    2.             wait 2 ticks
    3.  
    4.             set {_statGGG} to {_statGGG::stol::*} + 3
    5.            
    6.             message "  %{_statGGG}%" to player
     
  3. s

    sklake Member

    Joined:
    Mar 30, 2018
    Messages:
    7
    Likes Received:
    0
    will use Mysql lag the server?
     
  4. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,233
    Likes Received:
    170
    Medals:
    It won't lag the server using this addon since it's done asynchronously to avoid that.
     
  5. s

    sklake Member

    Joined:
    Mar 30, 2018
    Messages:
    7
    Likes Received:
    0
    if the MYSQL is at external place, if that server is disconnected, will it lag the server and if make a shop with skript-db MYSQL , will be player keep to get items from shop but the data will not be deducted because MYSQL is disconnect due to some issue ?
     
  6. R

    Royallistiq Member

    Joined:
    Jul 26, 2017
    Messages:
    2
    Likes Received:
    0
    Code (Skript):
    1.  
    2. on script load:
    3.   set {sql} to the database "mysql://185.227.81.30:3306/dylannl_status?user=dylannl_status&password=blegh&useSSL=false"
    4.   execute "CREATE TABLE IF NOT EXISTS `test` (`name` varchar(255), `displayname` varchar(255))" in {sql}
    Not working at all
     
  7. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    154
    Database calls are made on a separate thread, so they will not hang your server.

    As for your second issue, that depends on how your script is set up. As long as you give the player items after the database transaction is complete, you'll be fine.
     
  8. s

    sklake Member

    Joined:
    Mar 30, 2018
    Messages:
    7
    Likes Received:
    0
    thanks
     
  9. ayoungcoder

    ayoungcoder Member

    Joined:
    Aug 23, 2017
    Messages:
    17
    Likes Received:
    0
    Could you make a addon for redis just like this one that allowed you to execute redis command from skript?

    eg:
    execute "set i 1" in {redis}
     
  10. B

    Black_Eyes Member

    Joined:
    Mar 4, 2017
    Messages:
    20
    Likes Received:
    3
    Lol's id is 7, I added the player "lol" using
    Code (Skript):
    1. "INSERT INTO users (id, player_uuid, username) values (7, 'a438454d-3859-3ed6-b009-7306ccb429b2', 'lol')"
    and it worked, but when I try to get values from the ddb, it always return the column names istead of the result :/
    My code:
    Code (Skript):
    1. command /hello:
    2.    trigger:
    3.        set {sql} to the database "jdbc:sqlite:/C:/Users/Valentin/Desktop/Jeux/Minecraft/Serveurs/SkriptCraft/plugins/Jobs/jobs.sqlite.db"
    4.        execute "SELECT * FROM users WHERE username = 'lol'" in {sql} and store the result in {_output::*}
    5.        loop {_output::*}:
    6.            message "%loop-value%"
    7.        message "%last database error%"
    8.        message "%{_output::id}%"
    output: upload_2018-5-16_15-3-11.png
     
  11. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    154
    You have to loop through {_output::<column>::*}, like {_output::id::*}
     
  12. ayoungcoder

    ayoungcoder Member

    Joined:
    Aug 23, 2017
    Messages:
    17
    Likes Received:
    0
    set {sql} to the database "mysql://127.0.0.1:3306/ferox?user=root&password=[password that works with mysql from the commandline]&useSSL=false" Any idea why this doesn't work with my mariadb instance?

    it worked on my old server which used default mysql but this doesnt while mariadb is supposed to be a drop-in replacement.


    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    --- Double Post Merged, May 24, 2018, Original Post Date: May 23, 2018 ---
    edit: fixed! localhost doesn't work within docker containers and i had mariadb bound to localhost.
     
  13. K

    KuzuKeri Member

    Joined:
    Feb 7, 2017
    Messages:
    3
    Likes Received:
    0
    Code (Skript):
    1. command /dbtest:
    2.     trigger:
    3.         execute "SELECT count(*)+1 FROM istatistik WHERE deger > (SELECT deger FROM istatistik WHERE isim = '%player%' and stat='sw.puan')" in {sql} and store the result in {siralamadeneme}
    4.         wait 1 tick
    5.         broadcast "%{siralamadeneme}%"
    NOT WORK :C PLZ HELP
     
  14. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    154
    Use %player's name% or %player's uuid% instead of '%player%'
     
  15. ayoungcoder

    ayoungcoder Member

    Joined:
    Aug 23, 2017
    Messages:
    17
    Likes Received:
    0
    im getting
    > [19:12:41 WARN]: [com.zaxxer.hikari.pool.PoolBase] HikariPool-1 - Failed to validate connection [email protected] (No operations allowed after connection closed.)

    spammed in my console around every 5 minutes. Seems to be harmless but it does spam my logs (using mariadb, didn't have this on my old mysql instance and node)
     
  16. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    289
    Likes Received:
    8
    any way to store lists? such as
    Code (Skript):
    1. {player.arrow-trails::*}
     
    #76 Uzumaki, Jun 1, 2018
    Last edited: Jun 2, 2018
  17. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    154
    What are you trying to do?
     
  18. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    289
    Likes Received:
    8
    sync a list of materials that player has, {player.arrow-trails::*} = diamond_block,noteblock...
     
  19. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    154
    You'll have to convert your list into a single object when storing it in the database and convert it back when you retrieve it.
     
    • Informative Informative x 1
  20. EnderWingZ

    EnderWingZ Member

    Joined:
    Jun 4, 2017
    Messages:
    8
    Likes Received:
    0
    Code (Skript):
    1.  
    2. on skript load:
    3.     set {sql} to the database "mysql://139.99.8.33:3306/mc44732?user=mc44732&password=***&useSSL=false"
    4.     wait 1 tick
    5.     execute "UPDATE Ekonomi SET `Bronze`=`Bronze`+1 WHERE Player=""CyanideToDeath""" in {sql}
    6.  
    No changes at all :/
    Edited: Problem Fixed ... Sorry xD
     
    #80 EnderWingZ, Jun 3, 2018
    Last edited: Jun 4, 2018
Loading...