You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core-concepts/variables/memory-variables-metadata-and-alternatives.md
+15-3Lines changed: 15 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,21 @@ default:
30
30
# 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 '(?!-).*'.
31
31
```
32
32
33
-
The last four lines of comments describe how to enable memory variables. In simple terms, you just replace the `pattern:` line with a new regex pattern, one that excludes variables that start with `-`. As you can see in the comments, this pattern is `(?!-).*`. 
33
+
The last four lines of comments describe how to enable memory variables. In simple terms, you just replace the `pattern:` line with a new regex pattern, one that excludes variables that start with `-`. As you can see in the comments, this pattern is `(?!-).*`.
34
34
35
-
However, know that you can set this pattern to whatever you want, which also means your memory variables can follow whatever format you want, as long as you set the pattern up properly. I advise sticking with convention and using `-`.
35
+
Your edited config should look like this:
36
+
37
+
```yaml
38
+
type: CSV
39
+
40
+
pattern: (?!-}.*
41
+
42
+
file: ./plugins/Skript/variables.csv
43
+
44
+
backup interval: 2 hours
45
+
```
46
+
47
+
However, know that you can set this pattern to whatever you want, which also means your memory variables can follow whatever format you want as long as you set the pattern up properly. I advise sticking with convention and using `-`.
36
48
37
49
## Metadata
38
50
@@ -73,6 +85,6 @@ There are many other ways to deal with information and data in Skript. Addons al
73
85
That said, here are some general rules:
74
86
75
87
* Try to store the least amount of data possible for the long term. No matter your storage solution, it'll always be faster and easier if you store less information.
76
-
* In this vein, try to make use of temporary structures like local variables, metadata, or memory variables. 
88
+
* In this vein, try to make use of temporary structures like local variables, metadata, or memory variables.
77
89
* When you're using a relatively slow method of storing data (databases, reading/writing files, etc), try to load all the relevant information **only when you need it**. When a player joins, for example, try to copy all their information from your long-term solution into a temporary, fast format like memory variables. Then, when they leave, write the updated information back to the slower, long-term storage.
78
90
* Prioritize usability and readability over performance. If a high-performance solution makes your code a nightmare to read and maintain, consider not making that sacrifice. Losing a few milliseconds per tick is not worth it if it saves you hours of extra work in the future when you need to modify your code.
0 commit comments