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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Solved Saving data to mysql for certain variables

Discussion in 'Skript' started by MrGametop1, Feb 13, 2020.

Thread Status:
Not open for further replies.
  1. MrGametop1

    MrGametop1 Member

    Joined:
    Mar 10, 2017
    Messages:
    12
    Likes Received:
    0
    Hello, i know you know alot about skripting, so here is my question.
    Note : Thanks for all the help already

    In the config it says this:
    # #
    MySQL example:
    # A MySQL database example, with options unrelated to MySQL removed.

    type: disabled# change to line below to enable this database
    # type: MySQL

    pattern: synced_.*# this pattern will save all variables that start with 'synced_' in this MySQL database.

    host: localhost
    port: 3306
    user: root
    password: pass
    database: skript
    table: variables21

    monitor changes: true
    monitor interval: 20 seconds
    # #

    So if i enable MySQL
    Every variable named
    {synced_*}
    Will be saved to the MySQL database, and everything else will not be saved to the mysql put save to the CSV
    --- Double Post Merged, Mar 6, 2020, Original Post Date: Feb 13, 2020 ---
    Can somebody help me out with this?

     
  2. Best Answer:
    Post #5 by Lego_freak1999, Mar 6, 2020
  3. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,483
    Likes Received:
    93
    Medals:
    Every variable that starts with synced_, so {synced_test}, {synced_var::%player%} etc will be saved in the MySQL database, the other variables will saved to the csv
     
  4. MrGametop1

    MrGametop1 Member

    Joined:
    Mar 10, 2017
    Messages:
    12
    Likes Received:
    0
    Thanks for the help :emoji_slight_smile:)

    Can there be more servers linked to the same database? With the same variables?
     
  5. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,483
    Likes Received:
    93
    Medals:
    Not really, Skript doesn't update the database for every variable changed, it does so with a constant interval, and Skript also saved all variables in memory, it doesn't read from the database every 20 seconds, it only saved them (I think). The variables are read from the database when the server starts.
     
  6. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    657
    Likes Received:
    42
    This is not entirely true.

    Code (Text):
    1. # Databases to store variables in. These can either be used as a simple one-server-storage
    2.     # where variables are written constantly but only read at server start,
    3.     # or as a connection between multiple servers by monitoring the database(s) for changes.
    So it does work like u say except if u enable monitor chances on both servers put the both servers on the same interval and put the pattern the same then it does check for chances and if so update them.
     
    • Like Like x 2
  7. MrGametop1

    MrGametop1 Member

    Joined:
    Mar 10, 2017
    Messages:
    12
    Likes Received:
    0
    So the monitor interval should be as low as possible so people cant abuse things?

    For example a global money system
     
Thread Status:
Not open for further replies.
Loading...