Jump to content
Skip to content

Lua APIGuide 1 of 3

Introduction

Updated 319 views

Introduction to Lua Scripting

What it is

Lua scripting lets you change how your server behaves without a DLL developer and without rebuilding anything. Game events call into your scripts, your scripts call back into the game, and a reload is enough to see the result. What used to be a feature request becomes a file you edit yourself.

Two plugins, one system

LuaAPI Core is the foundation. It opens the server to Lua: players, items, monsters, currencies, timers and the database. This is where behaviour lives.

LuaUI Extension adds the part the player sees: custom windows, HUD panels and popups written in Lua on both the client and the server.

The Extension builds on Core rather than replacing it. Core works on its own, the Extension does not work without Core. In practice: a daily reward announced in chat needs Core only, while the same reward presented in its own window with a claim button and a history list needs both.

What you need

  • The Core plugin for any Lua scripting at all.
  • The Extension plugin additionally, if you want your own interfaces.
  • Server side: enable it in Data\Plugins\PluginSettings.ini, section [Lua]. For interfaces set LuaUIEnable=1 and a 32 character LuaUIScriptKey, which is the key your encrypted window scripts are packed with.
  • Client side: nothing to patch by hand. Development mode is pushed by the server through ClientDevMode and DevModeAccounts, so you name the accounts allowed to load plain scripts, use the F9 reload and open the debug console.
  • Tools: BitmapSlicer, IGC File Encrypt

Where to buy

Where to download tools

Where to start

Everything ships with the package. Server scripts live in Data\Plugins\LuaAPI, with the event handlers in Callbacks.lua and the type definitions under Defines. Client window scripts live in Data\Custom\Scripts\UI, next to a working Coin Exchange example you can read and copy from.

Switch the plugin on, open Callbacks.lua, and put a single line into one of the events to watch it fire. From there the pattern repeats: a handler, a condition, an action. Move on to the Extension when a feature deserves a window of its own instead of a chat message.

Full documentation: https://github.com/srv-config/Configs-Preview/wik

Was this guide helpful?
×
×
  • Create New...

Important Information


We use technologies, such as cookies, to customize content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy.