Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of ScriptableController


Ignore:
Timestamp:
Dec 14, 2017, 4:51:51 PM (7 years ago)
Author:
kohlia
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ScriptableController

    v1 v1  
     1= ScriptableController =
     2
     3With the ScriptableController you can easily make scripts to control various things in orxonox and react to certain events. To do that, add a script to your level:
     4
     5{{{ <Level script="scripts/myLevelScript.lua ...> ... </Level> }}}
     6
     7The script has to be written in lua and will be executed as soon as the player spawns. The path to the script is relative to {{{data/levels}}} and you preferably put your scripts in the {{{scripts}}} folder with the same name as your level. You can find a list of all functions that are available in lua in the documentation of {{{ScriptableControllerAPI}}} in {{{src/orxonox/scriptablecontroller/scriptable_controller_api.h}}}. If you call a function, make sure it has the correct number of arguments, there are no optional arguments at the moment! Also keep the type of the arguments in mind, if the function expects a string, pass it a string and not a number.
     8
     9Things that could be implemented next in the ScriptableController:
     10 - Fix the spawning of new objects
     11 - Notify the scripts when the player respawns
     12 - Waypoints
     13 - Firing weapons
     14 - Setting the orientation with {{{lookAt}}}
     15 - Cutscene tools
     16   - Hide/unhide the HUD
     17   - Enable/disable user controls
     18   - Move the camera around
     19 - Register to pickup events
     20 - Integration of the quest system
     21
     22Things that need basic knowledge of the lua stack and advanced knowledge of C++ templates:
     23 - Make it possible to return values from C++ functions to lua or the other way around
     24 - Make optional arguments possible
     25 - Add a 'state' argument that can be passed to {{{register*}}} functions and that will be passed back again to lua when the callback gets called (like a 'this', makes it a bit more object oriented and reduces the number of global variables in lua)
     26