Script Editor
The script editor is a way to trigger changes in mods directly from actions in other mods. It is one of the ways Monomodular seeks to become a truly modular solution. It is currently available in Plinko and Monotes, but will slowly be incorporated into more mods as it develops and gains further functionality. Currently the syntax is very specific, and use of these commands requires some experimentation and some knowledge of the internal structure of the mods.js. However, by following the examples below you can probably get a better idea of how to structure the syntax. In actuality, there are some very low-level mod functions available through scripting, but correct syntax is paramount to success with these techniques.
For more detailed information of how scripting works, see the entry for mod_help regarding the new hotline capabilities, as the scripting function is just an extension of those same capabilities. The scripting engine offers some shortcuts and additional features so that the scripting could be pattr-ized and useful for triggering from existing mods.
The client Syntax and usage is completely dependent upon the mod being transmitted to, but roughly the following rules apply for scripting:
"multi" allows sending more than one scripting function at the same time. scripts are seperated by the "|" character.
example: multi press grid 0 0 | key 2 1 | literal pipe value swing 85 This would send the following commands in sequence: grid 0 0 1 grid 0 0 0 key 2 1 pipe value swing 85
"press" sends the scripting command suffixed with one, then again suffixed with 0. This simulates a press and release function.
example: press key 6 This would send the following commands in sequence: key 6 1 key 6 0
"random" sends a message wherein certain numerical elements are generated randomly to fall withing parameters defined in the scripting message. The format of the random call is: *r range start. "*r" represents the position of the random number in the message, and the two numbers after will determine the range for the number. "Range" represents the maximum value before the "Start" value is added. Thus, the message *r 50 5 will yield a random number in the range of 5 and 55. (r = Math.random() * 50)+5.
example: random grid r* 7 0 r* 7 0 r* 1 0 This would send a grid action with random x between 0 and 7, random y between 0 and 7, and random value between 0 and 1.
"press_random" sends a press (momentary on/off), but certain elements in the message are randomized based on parameters defined in the scripting message.
example: press_random grid 0 r* 7 0 This would send a grid press with x = 0, y = random(0 - 7), 1 and then x = 0, y = (whatever the first random number was), 0
"literal" sends exactly what is included in the script window. Literal commands ignore the client number setting for the assignment, however it needs to be included in the literal in order to function correctly.
example: literal all exclusive testmod blah 128 This would send a command to all connected mods. If any of those mods were of the type testmod, and a receive object named "---blah" is present in the mod's patcher, then a message will be received at its outlet of int(128). This is really only useful if you know what you are doing (obviously), but is pretty powerful if you DO know what you are doing.