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!


    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.

variables won't save after restart

Discussion in 'Skript' started by FireRoz, Dec 30, 2020.

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

    FireRoz Active Member

    May 28, 2020
    Likes Received:
    Hey, variables won't save after restart and i'm trying to make an MOTD script.
    Code (Text):
    1. # -------------CONFIG-------------
    2. options:
    3. # -------------MESSAGES-------------
    5.   prefix: &7[&4&l&nX&c&nOTD&7] # The script's prefix
    6.   noperm: &cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that is in error.
    7.   typefirstline: &aAlright, type the first line of your MOTD in the chat, (Color code support). # The message that will show up when someone sets the first line of the MOTD.
    8.   typesecondline: &aVery cool. Now type the second line in the chat :) # The message that will show up when someone sets the second line of the MOTD.
    9.   done1: &aYou've set the first line of the MOTD to %message%&a.
    10.   done2: &aYou've set the second line of the MOTD to %message%&a.
    12. # -------------COMMANDS-------------
    14.   setmotd: setmotd # The main command
    16. # -------------PERMISSIONS-------------
    17.   setmotdperm: xotd.setmotd # The permission to use the MOTD
    19. command /{@setmotd}:
    20.   permission: {@setmotdperm}
    21.   permission message: {@prefix} {@noperm}
    22.   trigger:
    23.     set {motd1} to true
    24.     send "{@prefix} {@typefirstline}"
    26. on chat:
    27.   if {motd1} is true:
    28.     set {motdline1::*} to message
    29.     cancel event
    30.     send coloured "{@prefix} {@done1}" to player
    31.     set {motd1} to false
    32.     set {motd2} to true
    33.     send "{@prefix} {@typesecondline}"
    34.     stop
    36.   if {motd2} is true:
    37.     set {motdline2::*} to message
    38.     send coloured "{@prefix} {@done2}"
    39.     cancel event
    40.     set {motd2} to false
    42. on server ping:
    43.   set motd to coloured "%{motdline1::*}%%newline%%{motdline2::*}%"
    # __________________________________________________________
    # / / / /\ \
    # \_\___________________________________________________\_\/ /
    # / / _____ __ __ / /
    # / / / ____\ / / /_/ /\ / /
    # / / / /__ / /___ ___ __ ______ __/ /_ / /
    # / / \___ \ / __/ / __\ / / / __ //_ __/ / /
    # / / ____/ / / /\ \ / / / / / /_/ / / / / /
    # / / \_____/ /_/ /_/ /_/ /_/ / ____/ /_/ / /__
    # / / ========================== / / ========== / / \ \
    # | | /_/ | | | |
    # \_\_________________________________________________\_\_/_/
    # == Introduction ==
    # This file contains Skript's general options. To write scripts, create a new .sk file in the scripts folder or edit any existing one.
    # Script files prefixed with a hyphen (-) will not be loaded, e.g. renaming 'plant with hoe.sk' to '-plant with hoe.sk' will disable the whole file.
    # This can e.g. be used to temporarily disable scripts and is also used for Skript's example scripts.
    # You can also use the command '/skript enable/disable <script>' to enable/disable a script which will automatically rename it.
    # === !!! PLEASE NOTE !!! ===
    # This file, all scripts and other files ending in .sk are NOT .yml/YAML files, but very similar!
    # Please remember the following when editing files:
    # - To indent sections you can use spaces like in YAML, but tabs are also allowed. Just remember to stick to the one or the other for a section/trigger.
    # - '#' starts a comment like in YAML. If you don't want it to start a comment simply double it: '##' (You also have to double these in "quoted text")
    # - If you use special characters (§, äöü, éèàôç, ñ, etc.) you have to encode the file in UTF-8.

    # ==== General Options ====

    language: english
    # Which language to use. Currently english and german are included in the download, but custom languages can be created as well.
    # Please note that not everything can be translated yet, i.e. parts of Skript will still be english if you use another language.
    # If you want to translate Skript to your language please read the readme.txt located in the /lang/ folder in the jar
    # (open the jar as zip or rename it to Skript.zip to access it)

    check for new version: true
    # Whether Skript should check for whether a new version of Skript is available when the server starts.
    # If this is set to true Skript will announce a new version to all players with the "skript.admin" permission.
    # If set to false you can still check for a new version with '/skript update check'.
    # Please note that Skript will not detect beta releases even if you are running one as they are not necessarily stable.

    update check interval: 12 hours
    # If 'check for new version' is enabled, this sets how often to check for a new update.
    # A first check will always be made when the server starts, after that checks will be made in intervals set by this option.
    # Set this to 0 to disable repeated checks, in which case only one check will be made when the server starts.
    # Please note that this option is currently the only means of making Skript check for an update more than once,
    # as '/skript update check' does only display the results of the last check if a check has been made before.

    automatically download new version: false
    # Whether Skript should automatically download & install the newest version if one is available.
    # I suggest to disable this feature if your server restarts automatically as you likely won't be informed
    # of any incompatibilities of your scripts and the newest version of Skript.
    # If you disable this you can still use '/skript update download' to make Skript download the newest version.
    # If you're concerned about changes use '/skript update changes' for a full list of changes since your current version.

    enable effect commands: false
    effect command token: !
    # If 'enable effect commands' is set to true, chat messages starting with the 'effect command token' will be interpreted as effects and executed.
    # The token can be longer than a single character, but it should not start with '/' as that starts a command.
    # A player needs the permission "skript.effectcommands" to use such commands,
    # which does not default to OPs since these commands can do severe damage to the world or crash the server (see below).
    # Some example commands which can be used if this setting is enabled:
    # !heal player - heals the player (doesn't do anything if used from the console)
    # !repair tool - repairs the currently held item
    # !broadcast "<red>Please read the rules!" - if you want to get rid of the quotes you have to define a custom command
    # !set time to 6:00 - sets the time in the current world
    # The command can also be abused, so only give the permission to trusted players, like owners & co-owners:
    # !spawn 20 ender dragons - will destroy a large part of the world in a short time if no protection is present
    # !create explosion of force 10000 - likely crashes the server or at least hangs it up for a long time
    # !ban all players - as the effect implies

    allow ops to use effect commands: false
    # Whether server operators which do not have the permission "skript.effectcommands" should have access to effect commands.
    # This setting is mainly useful for servers that do not run any permissions plugin.

    date format: default
    # The date format to be used when dates should be displayed.
    # This can be 'default' to use Java's default date format for the system's language.
    # The format is that of Java's SimpleDateFormat as defined here: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
    # some examples:
    # d/M/yyyy h:mm a => 15/7/2012 8:53 PM
    # dd.MM.yyyy, HH:mm => 16.03.2013, 09:33

    verbosity: normal
    # Determines how much info is logged.
    # Allowed values: low, normal, high, very high, debug
    # The highest you should go is very high, which prints quite a lot of useful information,
    # including how much time each trigger takes to execute.
    # Only use debug if you're programming an add-on for Skript, but even then you might usually not need it.

    plugin priority: high
    # Allowed values: lowest, low, normal, high, highest
    # Change this if you encounter problems with other plugins, e.g.:
    # - cancelled events: The event is cancelled by another plugin, but Skript handles the event nonetheless => increase priority
    # (e.g. WorldGuard cancels events if a player doesn't have permission for the given region,
    # and you made some 'place' triggers which should not bypass WorldGuard's protection)
    # - effects '(un)cancel event': Another plugin should/should not process the event, but does/does not => decrease priority
    # - effect 'drop': Another plugin doesn't process added drops => decrease priority
    # - effects 'remove ... from drops'/'clear drops': Drops added by other plugins are not removed => increase priority
    # Skript removes drops it shouldn't => decrease priority or specify which item types to remove

    log player commands: true
    # Whether Skript should log the usage of custom commands.
    # They will be logged as [INFORMATION] in this format: '<player>: /<command> <arguments>'

    number accuracy: 10
    # How many digits should be displayed after the dot at maximum when displaying numbers.
    # Zeroes will never be displayed at all, so this setting only applies to numbers that actually have a decimal part with one or more non-zero digits.

    maximum target block distance: 100
    # How far to search for a player's targeted block in blocks/meters.
    # Lower values improve performance, but might reduce the usability of your scripts.
    # This value is limited by the server (e.g. by 'view-distance' in the server.properties), but is guaranteed to work up to 100 meters.

    case sensitive: false
    # Whether Skript's functions should be case sensitive or not.
    # This e.g. applies to the effect 'replace' and the conditions 'contains' and 'is/is not'.

    disable variable conflict warnings: false
    # Disables warnings of potential variable name conflicts if set to true.
    # I recommend to not touch this option, but if you do so you should at least set it back to false
    # whenever you create new scripts with new variables.

    # ==== Variables ====

    # Databases to store variables in. These can either be used as a simple one-server-storage
    # where variables are written constantly but only read at server start,
    # or as a connection between multiple servers by monitoring the database(s) for changes.
    # You can define as many databases as you want, just make sure to choose a distinct name for each one, and don't forget to set all options correctly.
    # To be able to use a database you'll need to download the plugin 'SQLibrary' from http://dev.bukkit.org/server-mods/sqlibrary/files/
    # and install it in your server's plugin directory like other plugins.
    # Please note that '/skript reload' will not reload this section, i.e. you'll have to restart Skript for changes to take effect.

    # Each database definition must be in a separate section. You can choose any name for the sections, as long as it's not already used.
    database 1:
    # an example database to describe all possible options.

    type: disabled
    # The type of this database. Allowed values are 'CSV', 'SQLite', 'MySQL' and 'disabled'.
    # CSV uses a text file to store the variables, while SQLite and MySQL use databases, and 'disabled' makes Skript ignore the database as if it wasn't defined at all.

    pattern: .*
    # Defines which variables to save in this database.
    # This pattern uses Regex syntax, e.g. use 'db_.*' (without the quotes) to store all variables prefixed with 'db_' in this database,
    # or use '.*' (the default value) to store all variables here (recommended for the last database in this list, as otherwise some variables might not be saved).
    # Please note that variables are only stored in one database, and databases are checked from top to bottom,
    # e.g. if a variable matches the topmost database's pattern it will be saved there and nowhere else.
    # BTW: Patterns are checked in a separate thread, i.e. your server likely won't run slower when using complicated patterns.

    file: ./plugins/Skript/variables.csv

    monitor changes: false
    monitor interval: 20 seconds
    # If 'monitor changes' is set to true, variables will repeatedly be checked for updates in the database (in intervals set in 'monitor interval').
    # ! Please note that you should set 'pattern', 'monitor changes' and 'monitor interval' to the same values on all servers that access the same database!

    # == MySQL configuration ==
    host: localhost# Where the database server is located at, e.g. 'example.com', 'localhost', or ''
    port: 3306# 3306 is MySQL's default port, i.e. you likely won't need to change this value
    user: root
    password: pass
    database: skript# The database to use. Skript will automatically create a table 'variables21' in this database if it doesn't exist
    # (If the table exists but is defined differently that how Skript expects it to be you'll get errors and no variables will be saved and/or loaded)

    # == SQLite/CSV configuration ==
    file: ./plugins/Skript/variables.db
    # Where to save the variables to. For a CSV file, the file extension '.csv' is recommended, but not required, but SQLite database files must end in '.db' (SQLibrary forces this).
    # The file path can either be absolute (e.g. 'C:\whatever\...' [Windows] or '/usr/whatever/...' [Unix]), or relative to the server directory (e.g. './plugins/Skript/...').

    backup interval: 2 hours
    # Creates a backup of the file every so often. This can be useful if you ever want to revert variables to an older state.
    # Variables are saved constantly no matter what is set here, thus a server crash will never make you loose any variables.
    # Set this to 0 to disable this feature.

    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

    monitor changes: true
    monitor interval: 20 seconds

    SQLite example:
    # An SQLite database example.

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

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

    file: ./plugins/Skript/variables.db
    # SQLite databases must end in '.db'

    backup interval: 0# 0 = don't create backups
    monitor changes: false
    monitor interval: 20 seconds

    # The default "database" is a simple text file, with each variable on a separate line and the variable's name, type, and value separated by commas.
    # This is the last database in this list to catch all variables that have not been saved anywhere else.
    # You can modify this database freely, but make sure to know what you're doing if you don't want to loose any variables.

    type: CSV

    pattern: .*

    file: /plugins/Skript/variables.csv

    backup interval: 2 hours

    # PS: If you don't want some variables to be saved in any database (e.g. variables that contain an %entity% which usually despawn when the server is shut down)
    # you can modify the last database's pattern to not match all variables, e.g. use '(?!x_).*' to match all variables that don't start with 'x_'.
    # Be very cautious when doing this however as unsaved variables cannot be recovered after the server has been stopped.
    # I recommend to use a single character to denote unsaved variables (similar to local variables' '_'), e.g. '-', in which case the last database's pattern should be '(?!-).*'.

    # ==== Settings that should not be changed ====

    version: 2.1.2
    # This saves for which version of Skript this configuration was written for.
    # If it does not match the version of the .jar file then the config will be updated automatically.
    --- Double Post Merged, Dec 30, 2020, Original Post Date: Dec 30, 2020 ---
    bump help please, variables is a common thing i use in scripts and now because of this i can barely make scripts.
  2. Fyriiee

    Fyriiee Member

    Sep 30, 2020
    Likes Received:
    Please list all of your active plugins, and give their respective versions.
  3. FireRoz

    FireRoz Active Member

    May 28, 2020
    Likes Received:
  4. Fyriiee

    Fyriiee Member

    Sep 30, 2020
    Likes Received:
    So after some research, I found some other SkUnity posts that relate to variables getting deleted on restart
    Code (Text):
    1. [23:38:25] [Server thread/ERROR]: #!#! ===!!!=== Skript variable load error ===!!!===
    2. [23:38:25] [Server thread/ERROR]: #!#! Unable to load (all) variables:
    3. [23:38:25] [Server thread/ERROR]: #!#! 1 variable could not be loaded!
    4. [23:38:25] [Server thread/ERROR]: #!#! Affected variables: magicalseeds::plots:33.5,65.5,-32.5
    5. [23:38:25] [Server thread/INFO]: [Skript] Created a backup of variables.csv as variables_2018-09-24_23-38-25.csv
    6. [23:38:25] [Server thread/ERROR]: #!#!
    7. [23:38:25] [Server thread/ERROR]: #!#! Skript will work properly, but old variables might not be available at all and new ones may or may not be saved until Skript is able to create a backup of the old file and/or is able to connect to the database (which requires a restart of Skript)!
    8. [23:38:25] [Server thread/ERROR]: #!#!
    If you check your server logs, and find something that is similar to the above logs, then you should delete your variables.csv file. Disclaimer, this will completely delete all your variables.

    A post similar to this one below:
  5. FireRoz

    FireRoz Active Member

    May 28, 2020
    Likes Received:
    Oh, Thank you.
    I'ma try and edit this post if it works lol.
    --- Double Post Merged, Jan 1, 2021, Original Post Date: Jan 1, 2021 ---
    I deleted it and now my variables file doesn't exist and will not re-create itself.
    I'll try to re-create it but all I did is create a new one, and now it's full of weird characters.
    do you have the default generated variables file?
  6. Fyriiee

    Fyriiee Member

    Sep 30, 2020
    Likes Received:
    I'm pretty sure this is a default generated variables file:

    Code (Text):
    1. # === Skript's variable storage ===
    2. # Please do not modify this file manually!
    3. #
    4. # version: 2.5.3
  7. FireRoz

    FireRoz Active Member

    May 28, 2020
    Likes Received:
    I can't manually edit csv files and it's full of weird characters,,,
  8. Fyriiee

    Fyriiee Member

    Sep 30, 2020
    Likes Received:
    Honestly it's weird to begin with that your variables are getting deleted. If the problem persists you should report a bug at https://github.com/SkriptLang/Skript/issues.
Thread Status:
Not open for further replies.

Share This Page