Smaug Lua Forums

Posted by Orik on Sun 15 Jul 2007 06:15 PM — 3 posts, 16,074 views.

USA #0
Hey Nick,

Do you think you could add Smaug Lua Forums to the smaug forum list? That we'd hvae smaug running smaug compiling, smaug commands, smaug code, and smaug lua.

That way all the lua posts would be in one spot and You could put the links at the top of the forum so people can see them easy and quick access.

ALso, do you update the lua code files every time you make a new post to show the new things you've done or are you just showing us what you've done yourself and don't have the files available for download yet.

Have you tried this on smaugfuss 1.8 as well?
Australia Forum Administrator #1
I have made a Lua topic in this forum, to separate the Lua-related stuff, as you suggested.

Quote:

... do you update the lua code files every time you make a new post ...


Not quite yet. I was trying to do the preliminary post to get people interested. I am cleaning up the code a bit, making sure the task system still works, and making things slightly more modular. As the project grows in size, I don't want individual files to get too unwieldy.

The new files should be released in an hour or so from the time of this post.

Quote:

Have you tried this on smaugfuss 1.8 as well?


No, I haven't, but it should fit in OK. The reason is that the changes to the stock SMAUG code are pretty minor - a few hooks here and there. Basically if you search for "lua" in the released files here, you would see where the hooks should go.

Basically as I described earlier, it is:

  • Add Lua state to character struct
  • Initialize it to NULL as soon as possible
  • Start the Lua script engine up when the player connects
  • Shut the Lua script engine down when the character struct is about to be destroyed - if necessary
  • "Hook into" the Lua script at various appropriate places (eg. changing rooms).


After that, there are a few more files to be added to the project, that provide the bulk of the Lua support.

In addition, for the resets, there is an additional Lua state for the entire MUD. Since this doesn't belong to any particular player, the state itself is stored in the new Lua source files, so that doesn't require any change to the stock code. However, in a couple of places in comm.c I added a couple of lines to initialise the state, tell it the MUD is starting up, tell it the MUD is shutting down, and call it for things like room resets.
USA #2
Awesome. I can't wait to see the released code. I'll have to definately put it in and start messing around with it.

Awesome stuff. I was kind of "meh, I don't know if I want to get into it yet."

But after seeing all of your posts, I'm downright excited.