Skript variables [Ram]

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Lego_freak1999

Well-Known Member
Jan 26, 2017
658
45
28
25
HTTP-410
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_language.skript:
> [12:06:44 INFO]: [Skript] Loading variables...
> [12:06:44 INFO]: [Skript] Loaded 1 variables in 0.0 seconds
> [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_language.skript:
# 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 '(?!-).*'.
 
That is a redonk amount of variables xD
Agree but live calculation has to mutch delay
[doublepost=1511534495,1511439988][/doublepost]
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_language.skript:
> [12:06:44 INFO]: [Skript] Loading variables...
> [12:06:44 INFO]: [Skript] Loaded 1 variables in 0.0 seconds
> [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_language.skript:
# 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 '(?!-).*'.

Bump
 
No need for a million of them. Use skript-db

Way to slow
[doublepost=1511535652,1511535579][/doublepost]
No need for a million of them. Use skript-db
i need to be able to call atleast 30 variables per game tick and write like 10000 per game tick
[doublepost=1511536586][/doublepost]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
 
In your config.sk, change your database's pattern to look like (?!-).*

You should end up with something that looks like this:
code_language.skript:
default:
    type: CSV     
    pattern: (?!-).*
    file: ./plugins/Skript/variables.csv   
    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.
 
In your config.sk, change your database's pattern to look like (?!-).*

You should end up with something that looks like this:
code_language.skript:
default:
    type: CSV    
    pattern: (?!-).*
    file: ./plugins/Skript/variables.csv  
    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.

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
[doublepost=1511540546,1511540514][/doublepost]
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

but i will give it a retry though
 
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
[doublepost=1511540546,1511540514][/doublepost]

but i will give it a retry though
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.
 
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
[doublepost=1511540546,1511540514][/doublepost]

but i will give it a retry though

Okay this is whats happening for me i have now 2 csv file 1 variables.csv and temp.csv this is my config:
2aa2f7e2353a90d847f3566a31333007.png


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
[doublepost=1511541382][/doublepost]
Do not name your variables {?!-variable}.

I did but after ussing {-variable} becouse it was stored in the variables.csv not the new csv Read better
 
Okay this is whats happening for me i have now 2 csv file 1 variables.csv and temp.csv this is my config:
2aa2f7e2353a90d847f3566a31333007.png


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
[doublepost=1511541382][/doublepost]

I did but after ussing {-variable} becouse it was stored in the variables.csv not the new csv Read better
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.
 
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.

but how do i make 2 files then
 
Way to slow
[doublepost=1511535652,1511535579][/doublepost]
i need to be able to call atleast 30 variables per game tick and write like 10000 per game tick
[doublepost=1511536586][/doublepost]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

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.

In your config.sk, change your database's pattern to look like (?!-).*

You should end up with something that looks like this:
code_language.skript:
default:
    type: CSV 
    pattern: (?!-).*
    file: ./plugins/Skript/variables.csv
    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.

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).
 
Last edited:
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.

Yes but if you read the first post i don't know a way To delete them before they all get loaded
[doublepost=1511612204,1511612043][/doublepost]
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).

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
 
Yes but if you read the first post i don't know a way To delete them before they all get loaded
[doublepost=1511612204,1511612043][/doublepost]

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

Don't save the Variables like btk5h explained to you
 
Status
Not open for further replies.