While Chataigne tries to enable many things as possible without coding, some mechanism and behaviors are just too complex to benefit from a visual-only system. When the case occurs, scripts are there to fill this hole. They have been integrated in Chataigne in such a way that their footprint is very small and it feels seamless.
Example of a loaded script
https://bkuperberg.gitbook.io/~gitbook/image?url=https%3A%2F%2F654853773-files.gitbook.io%2F~%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-M0J6klA7kDd2pwFQXYj%252F-M0J77Q7DvhqgPT4biK8%252F-M0J7HJ9O96CRlonDa7_%252Fmodule_scripts.png%3Fgeneration%3D1581959445990412%26alt%3Dmedia&width=768&dpr=4&quality=100&sign=619c59ef7bf97f7680d86a7864cd91ece983db133c45ac3702e2b32a751fbbec
Scripts can be found and created in different places of Chataigne. Depending on where they are executed, different methods and callbacks are available. Here are the different script types :
When creating a script, the script container will be empty. You can then choose to either load an already existing file by clicking "Browse...", or create a new file by clicking on the blue icon with a pencil inside (I know it's very small and not recognizable). This will create the file and open it in your default editor.
<aside> 💡 Most systems don't have a default editor for Javascript file. I strongly recommend using Sublime Text or VS Code ****as your default Javascript editor !
</aside>
When creating a new script, the newly created file will already be filled with content that aims to guide new users. This content is dynamically generated depending on the object you created your script from. For instance, if you create it in an OSC module, you will have generic content, but also module-specific content as well as OSC-specific content.
Scripts are compiled and interpreted in real-time, meaning that every time you save your script file, it will be automatically reloaded in Chataigne. At any time, you can check the Logger panel to see the compilation result :