Hey,
Okay, Im switching now, too much mess in zMUD, want lua scripting :-)
However, since I'm going to convert my current settings, I'd like to hear from experienced MC rats how to structure these best..
My Situation: 1 mud, multiple chars, I usually structure my settings based on the chars class, so that two chars of equal class will have the same settings. But I'd like to have the possibility to have common triggers / aliases for all chars.
So... What do I do?
- one world, enabling / disabling classes of settings (like I did in zmud - and what I'm slightly annoyed with :-))
- multiple worlds ?...
Thanks,
- Rasmus.
I would investigate plugins - they let you put common stuff into a plugin file, and then that same file can be loaded into multiple worlds. Each plugin can have its own "state" file, which is a disk file where relevant information (basically, variables) can be saved and automatically reloaded.
An alternative is to use group names for things, and enable/disable groups, but I think using plugins make things a lot more modular.
Common shared routines can be loaded using "require" in Lua, so that if you had some standard things that each plugin might want to do, then you can include that in each one. Some examples of that are shipped with MUSHclient, such as using a proxy table to access MUSHclient variables as a dummy Lua table.
Thanks Nick, I'll look into plugins.
On another note,
I'm trying to figure out how to best do my triggers, I'm a bit torn between using the "Send To: Script" option, rather than using the Script box for executing a specific lua function. I feel that using "Send To: Script" gives me more versatility, since I can add arguments etc, while using the other option makes me either make a whole bunch of functions, embedding the arguments for each trigger or switching / using the trigger name a lot, which I don't like that much.
My gut feeling is that I want to move as much as possible into the script file, since the Trigger Dialog can sometimes be a bit cumbersome to work with, for many triggers (my experience anyways). Is there any way to do syntax highlighting in lua, without omitting the line and reposting it to output? I was looking to see if the 4th argument might be a metatable, where you could actually alter the styles, but I don't think so?
Post might sound a bit negative, but I'm already so much happier for Mush than zMUD :-P Thanks for a good program.
Thanks,
- Rasmus.
Quote:
Is there any way to do syntax highlighting in lua, without omitting the line and reposting it to output?
No, the output is really what is received from the MUD. If you want to change it you really have to omit it and repost it, and that has to be done in a script, and not "send to script", otherwise the resposted line is also omitted.
Nick that is slightly incorrect, if u look at this posting of mine...
http://www.gammon.com.au/forum/?id=7517
It uses the standard workaround for the omitting, but it calls a function instead of doing the work itself in the doafterspecial.
I know the code could be condensed in MANY ways, but I code, and if it is functional, and easy to follow, then it need not be altered in my opinion.
Hope that posting will help you in your questioning.
Laterzzz,
Onoitsu2
Some would argue that unnecessarily verbose code is hard to follow. :) It tends to be easy for the person who wrote it, but hard for others... or, hard for the person who wrote it, a few time periods later. It is also usually harder to maintain.
Quote:
It uses the standard workaround for the omitting, ...
What you have done is a DoAfterSpecial to defer the writing of the new line by 0.1 seconds. This conceivably would echo lines in a different order to what they were received in.
This issue of trying to do a note in "send to script" seems to be an ongoing problem, so I have made a new feature in version 3.83, see:
http://www.gammon.com.au/forum/?id=7527