Lua Scripting

  • Since you find an application example in the recent changelog, here just some main information about the new Lua scripting functionality:


    This feature allows you to take control of the game flow. You write external scripts in Lua, a powerful and easy to learn script language (more information: http://www.lua.org/), and load them into the game (when starting the server). Your script gets notified of all relevant events, for example when a player dies, or destroys a block, or changes his position. Generally you receive further information with every event, so you know which block the player has destroyed, or which is the new position of the player. You're also able to cancel most events, preventing them from execution, i.e. the block won't get destroyed, or the player stays alive, or the player gets teleported back to his previous position.


    You're also able to call different functions, e.g. change the player health, or spawn an item. One special feature is the ability to create own GUI elements for the player, so you can display some texts on the players screen (useful to provide him some information, or simply to advertise your homepage). You can currently create labels and panels. Of course you can freely determine the position, color and size of those elements, among some more properties (e.g. border etc.).


    Another special case is the chat: When a players writes something into the chat, beginning with a "/", it's recognized as command and won't be shown in the global chat, but send as a "command"-event to your script. So you can - for example - create a command called "/changetime" to change the current time, or "/rules" to display your serverrules.


    It should also be noted that this feature has full sqlite support, allowing you to store some data in a database.


    We will provide something a documentation and an example script as quick as possible. Watch the new section "Lua Scripting": http://forum.concept-game.net/…p/Board/18-Lua-Scripting/


    Finally, a few screenshots. Since it's not easy to show screenshots of this new feature, I guess it's the best to give you some screenshots related to the application example in the changelog thread ;)



    Here you see how an area is created during runtime. The selector has been enabled with a simple command. Now another command saves the selected area in the database with the provided name:




    Now when entering this area, a small text is displayed in the left bottom of your screen, showing the name of the current area (in this case the area is called "Kitchen"):




    This is what it might look like when having several areas, especially in a hotel. It is intended that you can slightly see other areas through walls. Every area you see is saved in a database, and can be displayed with a simple command (please keep in mind that everything is done by a script):


  • Nice feature! :thumbsup: That'll be very helpful for multiplayer server. Is it possbile to create something like factions or jobs?

    "I wish I had a dollar for every time I spent a dollar, because then, I'd have all my money back" :P

  • Exactly, this feature mainly focuses on multiplayer ;)


    Of course factions or jobs are possible, those things can be easily done with scripts. You can define whatever you want, for example set different colors, or define a territory for each faction.

Participate now!

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