Lua

by Unknown

Back to Mechanic's Corner.

Unknown2008-06-13 22:50:28
Well I'm slowing confusing myself over Lua.

Would anyone that has their system in Lua just provide me with a snippet posted here so I can see a small example of a trigger for Lusternia using Lua? Doesn't have to be anything major. Thanks. content.gif
Unknown2008-06-13 23:04:44
There are a dozen different ways to do something in Lua. It would help if you gave us more information, such as which client you're using (MUSHclient, is my guess) and what exactly you're trying to achieve with your script.

I've got a bunch of Lua code, but none of it is mine, since I seem to have lost my old MUSHclient files somehow.
Shaddus2008-06-13 23:53:07
dunno if this is what you are looking for, or even if this is Lua, but...



(^The potion heals and soothes you\\.$|^Your mind feels stronger and more alert\\.$|^Ah\\, the soothing bromides help strengthen your ego\\.$)\\n^(\\d+)h\\, (\\d+)m\\, (\\d+)e\\, (\\d+)p.*? (.*?)\\-

sends

If ("%1"="The potion heals and soothes you.") AND (@script_last_health=@script_max_health)Then
world.execute "qscore"
elseif ("%1"="Your mind feels stronger and more alert.") AND (@script_last_mana=@script_max_mana)Then
world.execute "qscore"
elseif ("%1"="Ah, the soothing bromides help strengthen your ego.") AND (@script_last_ego=@script_max_ego)Then
world.execute "qscore"
end if

In ethelon's system.
Unknown2008-06-14 00:12:57
Cmud probley Zarquan, but I'm still open on the matter. Mainly I am just interested in general information about Lua at this moment and just wanted to see an example of what it looks like at work, much like Shaddus provided. Thanks! happy.gif
Unknown2008-06-14 02:35:50
QUOTE(SheiaSilverwing @ Jun 13 2008, 05:12 PM) 521165
Cmud probley Zarquan, but I'm still open on the matter. Mainly I am just interested in general information about Lua at this moment and just wanted to see an example of what it looks like at work, much like Shaddus provided. Thanks! happy.gif


Cmud has in its documentation a small lua tutorial. I personally find just using zscript is sufficient so I have never bothered to switch over to lua.
Unknown2008-06-14 02:45:35
Hmm yes I may do just that and stick with zscript, though to be honest I'm not all that better at it then I'm now at Lua. But we'll see. I'm not entirely interested in an involved system to make myself a combatent anymore. Simply allowing myself to survive alittle longer. Thanks for the replys.
Nezha2008-06-14 03:57:25
my system is in lua(can be downloaded somewhere here in forum). might want to look it up..
Unknown2008-06-14 04:59:31
Oh! Wonderful, thanks. cloud9.gif
Unknown2008-06-14 11:12:57
You may also have missed my older thread in the Project L forums about Lua scripting under LMTS. The advantage to LMTS is that it's client independent (acts as a proxy), so you can write code that works no matter what client you use to connect. It even compiles and runs on Linux (and maybe MacOS X). smile.gif

http://forums.lusternia.com/index.php?showtopic=12973
Unknown2008-06-14 19:00:26
Aha! Well I'll look at that thanks Zarquan. scribe.gif
Gartinua2008-06-15 22:51:36
LMTS doesn't have a simple trigger system by default though does it? Just a function that is called for each paragraph which you then write your own trigger system.
The IMTS website has some information about it at http://imts.sourceforge.net/doku.php?id=ilua

I've basically taken a few ideas here and use an array or list or whatever lua calls that to do triggers in LMTS. It is good though because as Zarquan said you can use it with any client (or with a scp or two, any computer).