23 Oct, 2012, Sorressean wrote in the 1st comment:
Votes: 0
Hello all:
I'd really like to revamp my scripting system before it gets more complicated than it is already. I'm not really sure how to do a couple of things though.
First, triggers are obviously important. Currently I have events in game that just fire when an action is performed, so I can extend these to hit Lua. I'm thinking each object will just do something like:
AddTrigger("give", onGive)
This will just bind the onGive function/callback into an event that will be triggered when this happens. is that a decent idea? Every object that is loaded then, I create a virtual table of sorts and stuff it's code in there to execute.
Second, I'd really like to objify everything. For example in order to send a message to a player currently, I have to do:
player.send(mob, "hello world!")
How hard would it be to attach ehese in classes somehow, so I just call self.send("hello world!" or whatever?
Finally, I'm curious how to go about setting up object properties. a lot of muds that have used lua (I was just looking at the Aard page) sets stuff up like ch for the calling player, self for the current object, then they allow for like ch.gold, ch.int etc. I'm curious how this works.
Thanks in advance, and sorry for all the questions.
25 Oct, 2012, Davion wrote in the 2nd comment:
Votes: 0
Have you checked out Lunacy? I know the implementation isn't all the way, but it might be a good starting point. Its partial plugin of Lua for a Merc based game.
25 Oct, 2012, Natilena wrote in the 3rd comment:
Votes: 0
When I was embedding Lua I spent a long time reading first mostly to get a handle on design a lot like you seem to be doing. Not sure if you've seen it but reading through this thread on the MushClient forums was really helpful. I didn't go with all the ideas but it really helped me get my head around what I wanted to do and how to do it.