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.

Skript variables [Ram]

Discussion in 'Skript' started by Lego_freak1999, Nov 23, 2017.

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

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Hey! i need some help

    I am currently having some issues due to storage in skript.

    What i am trying to achieve is to have 1 million+ variables loaded in to skript but i realised if i have that many variables the server won't even complete the startup :emoji_frowning:.

    So i am creating a work around. These variables are all temperary variables generated by a formula but need to be able to be called at any given moment without a big delay. So i want to store them in variables. So i have edited the skript config to have an additional CSV file for this and wenn the script gets loaded it will define all the variables in the additional CSV file. so the server can startup. But here is the problem the file where all these variables are in needs to be deleted or else the server won't launch with skript i can only recieve an event wenn all variables are already loaded as you can see here:

    Code (Skript):
    1. > [12:06:44 INFO]: [Skript] Loading variables...
    2. > [12:06:44 INFO]: [Skript] Loaded 1 variables in 0.0 seconds
    3. > [12:06:45 INFO]: NOW!!!
    so does anyone have a idea to be able to delete this file before skript loading.

    i have seen this in the config of skript i don't understand it but maby one of you might.

    Code (Skript):
    1. # 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)
    2.         # 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_'.
    3.         # Be very cautious when doing this however as unsaved variables cannot be recovered after the server has been stopped.
    4.         # 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 '(?!-).*'.
     
  2. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    That is a redonk amount of variables xD
     
    • Agree Agree x 1
  3. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Agree but live calculation has to mutch delay
    --- Double Post Merged, Nov 24, 2017, Original Post Date: Nov 23, 2017 ---
    Bump
     
    • Friendly Friendly x 1
  4. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    What purpose could you possibly need 1 million variables for
     
  5. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    A purpose but do you have any idea?
     
  6. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    No kidding a purpose.Yes i have an idea but if you explain the purpose there may be a better way
     
  7. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    all i can tell is that it are a heckton of pre generated/calculated locations
     
  8. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    No need for a million of them. Use skript-db
     
  9. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Way to slow
    --- Double Post Merged, Nov 24, 2017, Original Post Date: Nov 24, 2017 ---
    i need to be able to call atleast 30 variables per game tick and write like 10000 per game tick
    --- Double Post Merged, Nov 24, 2017 ---
    Let me explain something: what i need to have are offset locations on a sphere. But these locations needs to be pre calculated a sphere can be devided in 2x 360 degrees so if you have 1 axis on 1 degree you have 360 locations and second axis 2 degree 360+360 = 720 so 360x360 = 129600 locations but this is for 1 set radius i need to have it for allot of different radiuses
     
  10. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    159
    In your config.sk, change your database's pattern to look like (?!-).*

    You should end up with something that looks like this:
    Code (Skript):
    1. default:
    2.     type: CSV    
    3.     pattern: (?!-).*
    4.     file: ./plugins/Skript/variables.csv  
    5.     backup interval: 2 hours
    The (?!-) part will not match variables prefixed with the -, so variables like {-test} or {-my variable} will not be persisted across server restarts.
     
  11. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    yeah that is what i thought but wenn i did that it worked differently. What happend if i made a variable {-variable} it was stored in the default CSV and wenn i made a variable {?!-variable} it went to the other file but didn't got deleted at a restart
    --- Double Post Merged, Nov 24, 2017, Original Post Date: Nov 24, 2017 ---
    but i will give it a retry though
     
  12. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    159
    Do not name your variables {?!-variable}. The surrounding parts of (?!-) are part of a regular expression meaning "anything that doesn't start with -". Using that regular expression, you must start your variables with a -, like {-variable}.

    If you would like a deeper explanation of the regular expression, you can check it out here. There is an explanation in the sidebar that walks through each element of the regex syntax.
     
  13. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Okay this is whats happening for me i have now 2 csv file 1 variables.csv and temp.csv this is my config: [​IMG]

    But at my first restart it created the file temp.csv only it was allready filled with variables what i notissed it where all list variables of the orginal variables.csv

    Now i did another restart to see if they were deleted yes that happend BUT it also delete all my variables from the other file
    --- Double Post Merged, Nov 24, 2017 ---
    I did but after ussing {-variable} becouse it was stored in the variables.csv not the new csv Read better
     
  14. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    159
    You need to modify the default configuration, not create a new one. Variables will be saved to whichever database configuration matches the variable name. In order to prevent variables from being saved, you must make sure the variable name matches none of the database patterns.
     
  15. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    but how do i make 2 files then
     
  16. btk5h

    Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    154
    Likes Received:
    159
    You don't need 2 files, do you? It appears you don't want certain variables to be stored so that they don't affect server startups.
     
  17. LimeGlass

    VIP Supporter ++ Regular Diner Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    622
    Likes Received:
    439
    Medals:
    If you're wondering how to delete the variables, just delete the file. Since you're using the default variable saving method it uses flat file.
     
  18. bi0

    bi0 Member

    Joined:
    Mar 26, 2017
    Messages:
    26
    Likes Received:
    10
    Calculating 30 vectors on a sphere per tick is very easy. A sphere is 1x360 degrees and 1x180 degrees and not 2x360. You don't need different radii if you have always 360*180 vectors for the sphere. Just multiply the vector by the radius... You could even use only 1/2 or 1/8 of a sphere if you really want to.

    This is basically useless as it will still write variables to your database, so you will just get the "too many variables to write to database" error (or something similar).
     
    #18 bi0, Nov 25, 2017
    Last edited: Nov 25, 2017
  19. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Yes but if you read the first post i don't know a way To delete them before they all get loaded
    --- Double Post Merged, Nov 25, 2017, Original Post Date: Nov 25, 2017 ---
    This is one example that needs To be calculate there are Many more Things that needs To be calculated And THE Sum of these all = lag but i Will look in to less calculations on THE sphere
     
  20. Duetro

    Duetro Active Member

    Joined:
    Jan 26, 2017
    Messages:
    138
    Likes Received:
    51
    Medals:
    Don't save the Variables like btk5h explained to you
     
Thread Status:
Not open for further replies.

Share This Page

Loading...