Log on:
Powered by Elgg

Darwin :: Blog :: The joys of Lua

December 19, 2007

When it comes to coding in new features to our mud, I've pretty much stopped doing that. Instead, I've been working with Lua and scripting a lot of things or extending the mud's functions and variables into the Lua environment so they can be accessed via scripts.

 The way Lua works in the C code seemed a bit weird to me at first, but I think I've gotten my mind wrapped around it well enough now.

Using a modified version of the call_va function from the Programming in Lua book, I've been able to strip out some hard-coded things from our random equipment code and placed it into Lua scripts. This has made it much eaiser to add in new varieties of names and affects for random equipment.

I've also extended the functionality of several of the item and mob invoking functions that were provided with Nick Gammon's Lua code for SmaugFUSS. (I had to do some slight modifications to this before I started since my code was based in Smaug 1.4a.) The extended versions allow scripts to generate new items instead of copies of indexed items and new mobs in the same manner. The scripts allow for adding of flags and various other settings assciated with item or npc. I plan to use these to create more robust tasks (again, using Nick Gammon's Lua task system, which is a questing system.)

Also added was the ability to award skills to, or remove from,  a character. Compensation is given to the character in the form of practices if the skill is removed. The number of practices depends on how well that skill was learned by that character.

I've been planning to replace the whole newbie training area with a set of tutorial-like tasks to teach new players the ropes. The goal is to make a new character's experience fun as well as teach them necessary things and reward them with items, equipment or skills designed for their class (or class combinations), race and/or gender.

My next projects with Lua is to create a generic skill handler similar to the smaug_spell function, saving and loading of items and mobs, and to create virtual rooms with linked exits.

Well, I think I better get back to it. 

Keywords: Lua, Smaug

Posted by Darwin


Comments

  1. Sounds pretty neat, and a bit ambitious too. Have you talked to David Haley and Nick Gammon about this? They seem to be the Lua leaders among us currently.

    Conner DestronConner Destron on Wednesday, 19 December 2007, 21:45 MST # |

  2. Sounds like some pretty interesting stuff. Hope it goes well!

    AvaerynAvaeryn on Thursday, 20 December 2007, 14:24 MST # |

You must be logged in to post a comment.