Getting Started with Scripting

:!: Originally written by Showin, and translated here by hogsy. :!:

This is a basic guide to help you get started with scripting in Jade.

First open the editor. Once open, in the browser (typically shown to the left of the window), navigate to 'Technical Bank' and then under there, 'AI Models'.

This is where all the game related scripts are located.

You can look through the folders to find code for various entities. The “rayman” folder, for example, contains all the code related to Rayman himself.

You can select specific things like “raym_ETAT_main” which contains his main code. Much of the code is set up in such a way that there are “multiple states”. That's basically what an “ETAT” is. This is Rayman's main state, and the code here determines whether to switch to another.

It may switch from main to “raym_ETAT_paf” for example, which handles Rayman's damage state. There are other sections of code that are run consistently to check for things like this as well. So “main” isn't necessarily what causes the switch for everything to happen.

This is a pretty basic explanation of how a lot of objects are set up.

Compiling

FIXME “SHOWN_BootCamp” is only available as part of the RRR Reburrowed project. This should ideally indicate a world available in the original BF instead.

When compiling code here's what you need to do. First, you must load a map. You can load our prefab/test map for example which is in “SHOWIN_BootCamp”.

From there, at the bottom of the browser menu, go ahead and select the “DRL_BootCamp” WOL.

Then you navigate to “Model” in the coding tab and select “Compile All Models”. This can take around 10–20 seconds to complete. You might notice “Compile/Save” and those other options, but in my experience it tends to not work (it might in some cases, but at that point you might as well compile all models instead).

To test any changes, you can use "Run Engine".

If an entity doesn't exist to run the code, then you will have to add it by applying an AI to the object (dragging it onto an imported object and setting it to support AI).

One thing to note about compiling is Jade tends to have a memory leak error that will eventually pop up after doing it enough times. If this happens, just restart jade and repeat the compile process (if it didn't finish, then u should probably do it again just to make sure). You won't lose the code you've made, so it's more of an annoyance if anything.

The newest version of Jaded appears to have heavily reduced this issue (or perhaps even fixed it entirely).