Enforce variable best practices #4658
Replies: 3 comments 2 replies
-
The new examples PR removed all of the dots, except for the ones in the config. I don’t think people will appreciate a warning since they already complained about some of the others (like the XYZ will not be saved when the server restarts) |
Beta Was this translation helpful? Give feedback.
-
Many users have already been annoyed by the warnings and think they are errors, IMO the lack of official tutorials and Do's and Dont's have lead many new users to this, because they are learning from other users or their scripts which is probably why we see a lot of code mistakes. I would say adding something like As for "use UUIDs in player variable names" being true by default it's a must BUT it will break so many scripts for so many people and many will stay struggle fixing that therefore adding a built-in converter in that major update would probably be the solution. |
Beta Was this translation helpful? Give feedback.
-
In cracked (online-mode = false) servers, UUIDs (player datas) are stored in main world's folder and sometimes servers got reset, including all the player data. After that kinda reset, UUIDs will be different. Imagine a situation, a server uses Skript to track many player statistics. They have no idea that Skript stores UUID instead of names. They reset their player data in main world folder and now UUIDs are gone and players lost their statistics in Skript too. Maybe the server admin wanted to keep those statistics? UUIDs are not the best solution for every case, so making them true by default would be harmful in some cases. |
Beta Was this translation helpful? Give feedback.
-
Scripters often mistakenly create future issues for themselves by using variables incorrectly. The two biggest mistakes are:
.
instead of::
as a variable separatorIf you run scripts with these mistakes for a long time, it can be hard to recover from the mistakes and switch to best practices. For that reason, I would like to suggest that we implement a couple changes to avoid more scripters ending up in this situation:
Change the default value of the "use UUIDs in player variable names" config option to
true
. While this would be a breaking change, you've been able to change your Minecraft username for over 7 years now so this seems like a reasonable default to have.Add a warning when a variable like
{var.%expr%}
is used which recommends list variables instead. There's no reason to use this format, and those who are using it just don't know better.Any existing examples using
.
as a variable separator should be converted to use::
. Even the aforementioned config.sk has a couple examples that use.
:(Beta Was this translation helpful? Give feedback.
All reactions