Scripting requirements

  • To create a new script, go to the "scripts" folder inside your game folder (if it does not exist, simply create it). Now create a new folder named as your script (for example "MyScript"), and create the following files which are required:

    • A file called "definition.xml" which contains all information about the script (template: definition.xml)
    • The scriptfile itself (must be a .lua file)


    The script must contain the event "onEnable()" (see below, of course the comment is not necessary):


    Lua
    function onEnable()
    -- this event is triggered when the script is loaded
    end


    Finally, one more hint: If using this feature in singleplayer, it's recommended to enable the debug console (open the "config.properties" in your game folder and change the line "game_debug_console" to true). The reason is, that if any error in your script occurs, it will give an output to the console pointing to the erroneous line in your lua script. This is extremely helpful when developing a script.


    Happy scripting! :thumbup:

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!