Ai Modules ====== Javascript ====== ^ section | Scripting | ^ short description | Allows you to make use of the comprehensive Javascript programming languge inside Ai | ^ licence level | Miami | ^ ports | Script Code [multipurpose/text] | ^ ::: | Input #0...#n [multipurpose/text] or [control/numeric] | ^ ::: | Output #0...#n [multipurpose/text] or [control/numeric] | ^ parameter | Compile [pushbutton] - compile the formula | ^ ::: | Compiler Results [textarea/readonly] - shows the results of the compile (''OK'' or errors) | ^ ::: | Add Input [pushbutton] - adds an input port | ^ ::: | Delete Input [pushbutton] - deletes an input port (the highest) | ^ ::: | Add Output [pushbutton] - adds an output port | ^ ::: | Delete Output [pushbutton] - deletes an output port (the highest) | ^ ::: | Num Inputs [knob/rotary fader] - dial-in the number of inputs | ^ ::: | Num Outputs [knob/rotary fader] - dial-in the number of outputs | ^ skins | ./. | ==== used in example ==== {{backlinks>.#ai:examples}} ===== Manual ===== > Allows for the use of Javascript within Salvation. > {{:ai:modules:scripting:javascript.png|}} ===== Application hints ===== * have a look at the examples linked above! * write your code in a text/notepad module, and patch this into the ''Script Code'' input port * before compiling the Javascript code all inputs and outputs used in the code must be patched - else you get a compile error * the main function in your Javascript code must be named ''Execute()'' * inputs and outputs are referred to as ''inputs[0]'' or ''outputs[1]'' * inputs and outputs can conduct text/strings or numbers * the javascript language is well documented in thousands of websites and books. A good starting point is https://www.w3schools.com/js/