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.

temp variables without saving in file

Discussion in 'Skript' started by kenkencw, Jun 20, 2017.

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

    kenkencw Active Member

    Joined:
    Jan 31, 2017
    Messages:
    68
    Likes Received:
    0
    how to make a variables (not "{_a}") not saving in variables database, i needed to use i anytime with multiple events, after server restart will disapear

    will it possible?
     
    #1 kenkencw, Jun 20, 2017
    Last edited: Jun 20, 2017
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Code (Skript):
    1. set {variable} to whatever
    Then
    Code (Skript):
    1. on script load: #(I think that's the event)
    2.     delete {variable}
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    not saving in variables file, something like saving in RAM, after server restart will disapear
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Well you don't want to save it in the variables file. You don't want to use a database. You don't want to use a local variable. I don't think there's any other options.
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    RandomSk's metadata feature which was picked up by Skellett is pretty much what you're looking for
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    Variables are saved in RAM when the server is loaded then exported to the CSV file so it'll be kind of the same thing.
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    There is no way to avoid variables being written to the database. You can however specify if certain variables should be deleted when you restart the server. You should have a look at the config.sk file in your Skript folder. You can find the following text on line ~180:
    Code (Text):
    1.  
    2. # 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)
    3. # 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_'.
    4. # Be very cautious when doing this however as unsaved variables cannot be recovered after the server has been stopped.
    5. # 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 '(?!-).*'.
    6.  
    So if you change your database pattern of your default database to (?!-).* you will be able to create variables like: {-variable} which will not be saved if the server restarts. This is how my config for the default database looks like:

    Code (Text):
    1.  
    2.     default:
    3.         # 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.
    4.         # This is the last database in this list to catch all variables that have not been saved anywhere else.
    5.         # You can modify this database freely, but make sure to know what you're doing if you don't want to loose any variables.
    6.  
    7.         type: CSV
    8.  
    9.         pattern: (?!-).*
    10.  
    11.         file: ./plugins/Skript/variables.csv
    12.  
    13.         backup interval: 2 hours
    14.  
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    hows the pattern looks like if saving different variables file name?
    not really know how to use pattern correctly, i very afraid d since the pattern messed up before
     
Thread Status:
Not open for further replies.

Share This Page

Loading...