I have now released version 2 of the Lua interface to SMAUG (1.49 Mb):
http://www.gammon.com.au/files/smaug/smaug17fuss_lua_v2.tgz
Md5sum is: 6b237f81c8f3620c6da6b598c5be74f0
This incorporates quite a few improvements to the Lua interface, the updated functions are listed here:
http://www.gammon.com.au/forum/?id=8015
It also incorporates the new resets system described here:
http://www.gammon.com.au/forum/?id=8027
An example of doing the resets for Darkhaven Academy is provided in the download.
The various Lua files (in the lua directory) and their purposes are:
The various additional source files (in the src directory) are:
http://www.gammon.com.au/files/smaug/smaug17fuss_lua_v2.tgz
Md5sum is: 6b237f81c8f3620c6da6b598c5be74f0
This incorporates quite a few improvements to the Lua interface, the updated functions are listed here:
http://www.gammon.com.au/forum/?id=8015
It also incorporates the new resets system described here:
http://www.gammon.com.au/forum/?id=8027
An example of doing the resets for Darkhaven Academy is provided in the download.
The various Lua files (in the lua directory) and their purposes are:
- resets.lua
Code to reset an area. Has an example for Darkhaven Academy.
- serialize.lua
Standard table serialization (same as used in MUSHclient) - converts a Lua table into a string, suitable for saving to disk. Used for saving player states.
- startup.lua
File loaded at player connect time (once per player). This implements the various things needed for players (eg. task system, whereis system, hints).
Most of this is in modules loaded by startup.lua.
- startup_mud.lua
File loaded a MUD startup time. This implements the resets system (by loading a module).
- taskevents.lua
Event handlers for the task system. This responds to things like the player entering a room, killing a mob, receiving an item, and so on.
- taskhints.lua
Functions to give the player hints. These are called from various hook points (eg. entering a room, completing at task), to make suggestions. Once a hint is given a flag is set in the player state file so it isn't given again.
- tasklist.lua
Example tasks for the task system (list of tasks). This is a table, where each task is a sub-table.
- tasks.lua
Task system. This handles the "task" command (which is called from the SMAUG "task" command handler).
Loads tasklist.lua, taskevents.lua, and taskhints.lua as sub-modules.
- tprint.lua
Debugging utility for displaying the contents of a table, recursively.
- utilities.lua
Various utility functions (like rounding numbers, formatting the time).
- whereis_destinations.lua
Table of places you want the player to be able to go to when using the "whereis" command. Just edit this and add new locations. Each zone has its own entry, so you might make an entry per town.
- whereis.lua
Implements the "whereis" command by working out the path from the player's current location to a desired destination.
The various additional source files (in the src directory) are:
- lua_bits.c
Bitwise functions.
- lua_commands.c
My initial attempt to make a Lua function for each SMAUG command. Not being used right now.
- lua_scripting.c
Implements the Lua script interface.
- lua_tables.c
Implements constant tables. At present, maps "at" colours and object types.
eg.
at.red returns AT_RED (9)
itype.bloodstain returns ITEM_BLOODSTAIN
- mt19937ar.c
Code for the Mersenne Twister psuedo-random number generator.