Home - xxWhispers/OpenXcom GitHub Wiki
Welcome to the OpenXcom Lua fork wiki!
Getting Started
Before we begin, I will assume that you have at least some familiarity with Lua and that you are also familiar with the rules system already in place for OpenXcom. Since this is a new fork of OXCE+, it should also be noted that everything is subject to change and that nothing is set in stone. Okay, with that out of the way, let's get started.
The first thing you are going to want to do is tell the engine where your script is located. To do this, create a new "game.rul" file and put in the following
game: script: scripts/game.lua
Note: It's not necessary to put it in a file called "game.rul". Technically, anything with a "rul" extension will get loaded, but this is the standard we are using for this tutorial.
This simply tells the engine that you have a script file located at (mod root)/scripts/game.lua. When a new game is created or when a save game is loaded, this script is then run.
It's worth pointing out that the script is only run once. The Lua context is maintained, so anything you put in the global section of the Lua script will be retained, but unless you override one of the available hooks, the script will never be run again.
Let's go ahead and override one of the hooks. For this example, we want to display a message to the user every day in game time. In the spirit of keeping things simple, we'll just display the age old "hello world" along with displaying how many times it has run
TODO