MUSHClient

by Ilyarin

Back to Mechanic's Corner.

Ilyarin2008-09-19 12:37:26
Okay. This is going to be fairly vague.

Help! wtf.gif

Basically I'm starting out on MUSHClient because I'm sick and tired of cMUD hanging on me. I've been very much against making this change but it seems to have become necessary. So what I need is... A MUSHClient/Lua guru who's happy to help me work everything out. Chances are that when I'm feeling comfortable I'll be quite generous and throw you some credits, but I'm not going to make a promise or give a number. I have no previous knowledge of Lua, but I know exactly what I want to get from my system, so I am looking for someone who's very comfortable with the language themselves. Of course, when I've finished, people who've helped me out are welcome to a free copy of Cerberus, which I am aiming to make into a very high spec and user-friendly combat system. Preferrably, I would like to communicate with you either on an OOC basis in-game, or through MSN or similar.

scream.gif
Unknown2008-09-19 12:44:18
I can help you out!

Wouldn't you rather help me test my new system, though? It's a Lua system for MUSHclient. I've just started the serious testing of it this week, but it's still missing a few things yet, such as parry/stance and GUI buttons. smile.gif
Ilyarin2008-09-19 12:50:26
I'm more than happy to help test yours. However, I'm very particular, so I just tend not to get on with other people's systems - nothing against you! If you could help me out, that would be fantastic. It's quite likely that the first questions I ask will be so dense and basic that you'll start if I'm a complete idiot. biggrin.gif

Nezha2008-09-19 13:00:00
just toss me any question via tells or leave it via messages and ill get back to you when im able..
Ilyarin2008-09-19 13:01:03
Awesome. If only either of you were logged in right now. sad.gif
Esano2008-09-19 13:01:58
I am, and I'll answer as many questions as I can (which will probably be very few). I'm going to bed soon, though.
Unknown2008-09-19 13:39:23
I know I'm not in the game too often right now, but I'm readily available through e-mail or GoogleTalk. If you give me your e-mail, I'll send you my code to play with for a while. I tried to comment it fairly well, and it's modularized, too. (Quite different from Nezha's, so you can get two very different takes on Lua in MUSHclient now. Heh.)
Unknown2008-09-19 14:59:58
I'm getting geared up to start a Lua system for MUSH too. I don't know Lua yet, but it sounds like an amazing scripting language and I'm pretty excited to start learning it.

Maybe we can help each other out with some things along the way.
Ilyarin2008-09-19 15:08:21
That sounds good. Yay! biggrin.gif

Noola2008-09-19 15:16:00
QUOTE(Ilyarin @ Sep 19 2008, 10:08 AM) 559629
That sounds good. Yay! biggrin.gif



hijack.gif

If you just want a great big grin, smile.gif works nicely.
Unknown2008-09-19 15:17:20
I use mush.. so if any of you need a guinea pig to test on, let me know! ninja.gif
Ilyarin2008-09-19 18:40:28
Well I guess I'll use this to keep me going rather than making lots of new threads.

I'm trying to make an alias called 'ben', which if sent by itself does 'Starchant Benediction me', and if sent with a target (ie, ben Nezha), it does 'Starchant Benediction Nezha' in Lua. What alias would I need to use and what does it need to send? I can't make it work.
Unknown2008-09-19 19:12:42
QUOTE(Ilyarin @ Sep 19 2008, 02:40 PM) 559705
Well I guess I'll use this to keep me going rather than making lots of new threads.

I'm trying to make an alias called 'ben', which if sent by itself does 'Starchant Benediction me', and if sent with a target (ie, ben Nezha), it does 'Starchant Benediction Nezha' in Lua. What alias would I need to use and what does it need to send? I can't make it work.


CODE

     match="^\\s*ben(?:\\s+(\\w+))?\\s*$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  if #"%1" > 0 then
  Send("starchant benediction %1")
else
  Send("starchant benediction me")
end

  
Ilyarin2008-09-19 19:41:17
Thanks! smile.gif Can I just ask what the # does to #"%1"? Does it just convert it to a number, where if it's nil it's 0, and anything else is 1?
Unknown2008-09-19 20:10:42
QUOTE(Ilyarin @ Sep 19 2008, 03:41 PM) 559721
Thanks! smile.gif Can I just ask what the # does to #"%1"? Does it just convert it to a number, where if it's nil it's 0, and anything else is 1?


When used on a string, it returns the length of the string. When used on a table, it returns the number of contiguous, numerically indexed elements. It's just syntactic sugar for string.len or table.getn, respectively.
Ilyarin2008-09-19 20:25:33
Excellent, thanks. The next thing to open to the floor then is this, to recharge all of my enchantments. Ideally I'd like to have a variable in mushclient that I can fill with whatever enchantments I want, then convert it into a list in Lua which can be looped through. At the moment I have this which is obviously not working, though hopefully you can see what I intended it to do. I didn't really expect it to work but I'm not sure how to do this.

CODE
local list = GetVariable("enchantments")

for i,v in ipairs(list) do
  Send ("Recharge " .. v .. " from cube")
end


Value of enchantments: {"mercy","kingdom","beauty","perfection","waterwalk","waterbreathe","deathsight","55372","icewall","levitate"}
Unknown2008-09-19 20:55:00
The problem with this is that you're storing it as a string, so when you retrieve it, you get a string back and not a table. You'll want to look into Nick's serialize.lua code (included with MUSHclient installations) for examples on how to store/load Lua variables using world variables. For a real world example, you can look at my kills.lua module.
Ilyarin2008-09-19 20:57:44
Thanks! happy.gif