ManiaScript is a scripting language integrated to ManiaPlanet that allows the players to customize different aspects of the games. A scripting language is build upon a classic programming language and aims to ease the process of creation.
Note: For those who don't know how to code (at all or pretty much), i suggest you to follow the basic course about Java here (only the "Learn the Basics" part): http://www.learnjavaonline.org/ Of course remember that there is some difference between Java and ManiaScript but they are also close enough to learn enough basic knowledge with it.
The rules script is used by the servers. It defines the structure and the rules of the game modes. With this you can choose how the players are spawned on the map, how the points are awarded, who will win at the end of the match, create a specific user interface and much more.
The map type script is used in the map editor. It defines the rules a map must follow to be considered valid. You can by example force the map to have two spawns and three poles, each one using a different tag. Then inside the rules script, you can set a list of map type to define which maps are compatible with your mode.
ManiaLink is a presentation language allowing the players to create user interfaces and small websites inside ManiaPlanet. You can integrate a script inside your ManiaLinks to make them dynamic (much like HTML and JavaScript). It means that you can change text values or move elements of your ManiaLink from a script. With this you can display a top 10 of the best players in your mode by example.
It's possible to extend the possibilities of the map editor with plugins written in ManiaScript. These plugins range from the simple autosave to the full random map generator.
The global plugins are not available to the players at the time being. Once it will be the case, it will be possible to create small tools directly inside ManiaPlanet. You will be able to improve the current buddy system or create a new instant messenger by example.
The easiest way to create and edit scripts is to use the in-game editor. It is accessible through different ways depending of which kind of script you want to create.
While playing you can press ctrl+g to open the log window. This window will be essential when developing a new script, but we will see later how to use it efficiently.
If you press ctrl+g a second time you will open the full debug window (and a third time will close it).
While playing:
While editing a script
It's not recommended to do that when you begin to write scripts, but you can also edit them with any text editor. Be aware that ManiaPlanet cache some resources like the scripts. So if you update a script with an external editor it won't be reloaded in the game at the same time. Most of the time you have to restart the server running the script to get the new version.
You can check the links section of the documentation to get some useful tools to enhance the ManiaScript support in different text editors (syntax highlighting and auto-completion).
You can find the latest Nadeo's scripts on GitHub, but you can also extract them from your installation. To do that you must go inside this folder: C:\ProgramData\ManiaPlanet\PacksCache
.
It's the default path, so maybe you changed it during the installation process. The ProgramData directory is an hidden directory, so you have to edit your Windows settings to display it.
Inside the folder you will find a lot of .zip. They contain the default ManiaPlanet data. The ones we are interested in are:
If you unzip these directories on your desktop you'll find a Scripts
folder inside with all the Nadeo scripts.
ManiaPlanet stocks its data in two directories. The original Nadeo data are saved in the ProgramData\ManiaPlanet
folder. The custom files created by the players are saved in the Documents\ManiaPlanet
folder. But once you launch the game, ManiaPlanet will automatically merge the two folders together to display them as one.
Something to be aware of is, if a file has the same name in the same folder in ProgramData\ManiaPlanet
and Documents\ManiaPlanet
, ManiaPlanet ignores the one in ProgramData\ManiaPlanet
and uses the one in Documents\ManiaPlanet
instead. It's really useful if you want to customize some elements, like the scripts. You don't have to modify the original ones, just copy them at the same location inside your ManiaPlanet directory.
The Scripts
folder uses this structure:
Scripts
|-EditorPlugins
|-Libs
|-Nadeo
|-ShootMania
|-TrackMania
|-MapTypes
|-ShootMania
|-TrackMania
|-Modes
|-ShootMania
|-TrackMania
By default your Scripts
folder will be empty. You'll have to create the sub-folders yourself. You're free to organize them as you wish, but it's highly recommended to stick to the structure presented above. Especially because of the merge of the two ManiaPlanet folders.