-
Notifications
You must be signed in to change notification settings - Fork 2
Tutorial Variables
Variables Tutorial
You can modify/add databases in the config.sk file.
This is what the default databases section will look like in the config.
databases:
# dummy: (This is the name of your database)
# type: json-database
# This is the type of database, currently only 'json-database' is supported
#
# enabled: true
# Whether or not the database is enabled
#
# file-type: json
# The file type of the database, currently only 'json' and 'bson' are supported
# 'json' = Will save as a JSON file in text format (Easy to read/change if you need to).
# 'bson' = Will save as a BSON file in binary format (This is what Hytale uses, much smaller file).
#
# file: variables.json
# The file to save variables to.
#
# pattern: (?!-).*
# The regex pattern to match variables to.
# '.*' = Will save all variables.
# '(?!-).*' = Will only save variables that don't start with '-' (ex: '{-some_var}' will not be saved).
default:
type: json-database
enabled: true
file-type: json
file: variables.json
pattern: .*
The name of your database is used internally, and doesn't really matter.
Choose whatever you'd like.
This represents the type of database you can use.
Addons can create their own databases as well.
Currently json-database is the only database type we offer.
Set whether this database is enabled.
When disabled, variables will not be loaded from this database nor will they be saved to this database.
This is used in the json-database to determine which type of saving will occur.
-
json= Will save in Json format in string form in a file (easy to read and modify). -
bson= Will save in Json format but in a binary file (saves space).- This is the format Hytale uses for saving data.
This is where your variables will save.
In the json-database format, you should use:
-
json= "file-name.json" -
bson= "file-name.bin" You can choose whatever name you want, but should stick with the appropriate file extensions.
This decides which variables can be saved to this file.
The default pattern is (?!-).*, which will save all variables EXCEPT variables that start with a hyphen.
Examples: {-someVariable} will not be saved to file.
We often refer to this as Ram/Memory variables.
You could also use the .* which is from the original version of Skript, which will save ALL variables (except local variables) to file.