> LeekScript Tutorial
This guide presents the different points to check if you want to migrate your AI LeekScript 1 to 2. See the page on the LeekScript 2 for more information on the version itself.
To activate LeekScript 1 on an old AI, just click on "LeekScript 1" on the left of the status bar located at the bottom of the editor. A menu will open and you can click on "LeekScript 2" to activate it. The AI will be parsed with the new rules directly.
In LeekScript 2, unlike LeekScript 1, all values are passed by reference, except for primitive values (numbers, booleans, strings).
So you can remove all the @ from your code. (note to date the compilation with the @ does not work).
If you have coded recursive algorithms with arrays for example, be careful to manually copy the arrays passed as parameters with the clone() function at each call.
In LeekScript 1, it is impossible to make references to a number, a boolean or a character string. It will be necessary to encapsulate these values in an array or an object to reproduce this behavior.
The keywords new, class, extends, static, public, protected, private, implements, interface, constructor, this, super and instanceof are reserved for OOP and are therefore no longer available for variable or function names, so some of them will have to be changed if necessary.
Due to the new rules, especially pass-by-reference, LeekScript 2 can consume far fewer operations. If you used conditions on the current number of operations, like if (getOperations() < 15000000) for example, the AI may behave differently.
The arrayFilter function has benefited from a correction: the resulting array is reindexed and is therefore no longer associative with certain null values. Be careful to update your algorithms if you find yourself in this case.
The ^= operator changes meaning: it expressed the power + assignment operator in LeekScript 1 and now expresses the binary OR operator in LeekScript 2.
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.