Skip to content

Installing a Module

JasXSL edited this page Nov 29, 2017 · 2 revisions

Scripts in XOBJ can be called modules. A module ALWAYS consists of at least one header file which contains preprocessor definitions such as methods and events, and optionally one package file containing the actual code. You can write the code of the package file directly in SL if you don't intend on sharing it.

To add a pre-existing module you'll want to start by including your project core, then define any config definitions, and finally including the package file. Example, install a dialog manager:

  1. Create a new script in your project inside SL. Name it jas Dialog. jas is a prefix that should identify the project or creator. In this case it's a generic module made by Jasdac, so the prefix was named as "jas".
  2. First delete all contents of the scripts. Then add any config definitions you want at the top. Ex #define DialogConf$ownerOnly 0 if you do not want to limit the dialog to the script owner. It's important that all config definitions be defined above any includes. This goes for your _core.lsl file as well. Add #define DialogConf$timeout 10 if you want the dialog to time out after 10 seconds. Config definitions can be found in the header file. In this case located in xobj_core/classes/jas Dialog.lsl
  3. After the config definitions, put: #include "MyFirstProject/_core.lsl" This includes your project config and autoloader.
  4. After that, add: #include "xobj_core/classes/packages/jas Dialog.lsl" to include the actual code for jas Dialog
  5. Compile. You can now utilize the dialog manager.

To see what methods you can run on a module, see the module header file. In this case located in xobj_core/classes/jas Dialog.lsl