LuaGHost

From GHost++
Jump to: navigation, search

LuaGHost is an edited version of GHost++, for Linux OS's only, that supports Lua Script writing. It is currently being developed by Sokrates from www.codelain.com/forum. LuaGHost is still in testing but is pretty stable.

Lua

Lua is the most-used scripting language that is embedded into C or C++ code. It is stable, reliable, freaking fast, and popular. And it's syntax is incredibly simple making it a great language to use.

Writing Scripts

Writing scripts is somewhat easy if you have some programming experience in any language. This script, for instance, greets a joined player with his or her name:

 -- This code is in the download as root/scripts/greeter.lua
 function init()
   Controller:Register("PlayerJoined", greet_joined_player)
 end
 -- Here the name of the player is used to form a chat message
 function greet_joined_player(event)
   event:GetGame():SendAllChat("Welcome, " .. event:GetPlayer():GetName() .. "!")
 end

It works as follows:

  • 1. Your script registers callbacks with the bot
  • 2. When the callback is triggered, the registered function is called. Simple.
  • 3. PROFIT!

Be sure to look into the root/scripts folder in the download to see more example scripts!

more docs will be added as the project evolves

Compiling

I am using Debian and had to install the liblua5.1-0 and liblua5.1-0-dev packages to get going. Also, you need luabind, which is available from here (you have to make && make install it).

After installing the dependencies, enter the src/ghost directory and do a simple make. When this compiles cleanly, you have an executable called ghost++. Go ahead and move it into the root/ direcory (see below) in order to have the real file structure. Then start LuaGHost with ./ghost++ and enjoy! Compiling on OS X and Windows has not been tested.

Download

This is a preview release (which means it's not even alpha), so use it with caution. Also, the file linked to here is always the most recent version (at least until a real alpha).

You can download it here