Mush

by Alaskar

Back to Mechanic's Corner.

Unknown2006-04-12 05:39:12
Hmm, I think Game > Configure > Commands... > Echo My Input command is starting to mess with my system. The one I bought at least. Hmm, to bad I guess ;-; Was hoping to build on it
Unknown2006-04-12 06:06:59
How odd. I can't imagine why that would happen. Can you post an example?
Unknown2006-04-12 14:20:49
If you thought the post on substitutes was bad (even though it tells you -exactly- what to do), you should see my old curing system for Achaea and Lusternia that I had started for MUSHclient and never quite finished before I went back to zMUD. Lua, regex, XML, undocumented.

http://cvs.sourceforge.net/viewcvs.py/achaeacure/Mush/
Unknown2006-04-12 18:07:45
The post on substitutes is bad. What a silly amount of work just to get rid of a line of text you can easily ignore. Plus having a big table of "if you get this text, you echo this" in your script file would be inelegant. Echoes do the trick just fine.

And yes, your MUSH ACP/LCP is scary; I wouldn't give it as an example to beginners! I'm sure it's a lovely piece of code (alas, I don't speak Lua very well) and is much less cobbled-together than what I use, but I prefer something simpler and dumber that I can debug more easily.
Daganev2006-04-12 18:58:25
Don't know about Mush, but in Flash there are often problems with needing quotes inside quotes and the like, the way you solve that problem in flash is by doing something like

getUrl("loadurl.('myrurl.com')")

basically you use single quotes inside of your double quotes.
Unknown2006-04-16 06:02:27
Okay, MUSH guru! I need a tip, as well, if you'd be so kind! biggrin.gif I just started at Lusternia, I'm trying to get my new Mushclient stuff set up, and... it's ticking me off. In ZMud, I was able to make if-then conditionals without any trouble at all. Not so, here.

As a simple example, I've been trying to get my "nac *" alias to do the following:

CODE
if %1=@target then
  world.send "nature curse @target"
else
  world.setVariable "target", "%1"
  world.send "nature curse %1"
end if


VBScript code, send to script, and clicked expand variables. I recognize that it's something of a bumbling attempt, but I can't seem to find the right syntax to make it work. I've tried lots of variations on this (including elseifs and separate statements altogether), and this is the most watered-down version.

Can you (or anyone reading, really!) enlighten me, 'cause I'm getting really tired of struggling with something that -should- be a lot easier than it's turning out...
Unknown2006-04-16 07:13:14
Here's the problem:

QUOTE
if %1=@target then


You need quotes around %1 to indicate it's a string for the comparison:

QUOTE
if "%1"=@target then


Incidentally, you don't need the if structure, since you always want the same outcome: have "target" set to %1 and nature curse %1. You can do it with just this:

QUOTE
setvariable "target", "%1"
send "nature curse %1"


There's no downside to assigning that variable each time. And quick tip: along with your "nac *" alias, you can also have a "nac" alias (no wildcard) that does "nature curse @target". If you just type in "nac" without following it with a name, the second alias will match.

Cheers!
Unknown2006-04-16 07:50:24
QUOTE(vale_kant @ Apr 16 2006, 02:13 AM) 279673

Cheers!


Beautiful!! You just hit every dilemma I was up against. biggrin.gif I appreciate your help!!
Unknown2006-04-27 08:05:39
Incidentally you could match this in one alias.

^nac( (.+)|)$

if "%2" <> "" then setvariable "target", "%2"
send "nature curse " & getvariable( "target" )


Just saves having two aliases to maintain...
Unknown2006-04-27 13:32:06
I think the pattern could be improved a little, though.

^\\s*nac\\s*(.+?)?\\s*$

This pattern will match if you accidentally (or intentionally) add extra spaces at the beginning, at the end, or in the middle. It also avoids the (blah|) type syntax by using ? to make the parameter optional.
Unknown2006-04-28 03:20:55
QUOTE(Zarquan @ Apr 27 2006, 11:02 PM) 282926

I think the pattern could be improved a little, though.

^\\s*nac\\s*(.+?)?\\s*$

This pattern will match if you accidentally (or intentionally) add extra spaces at the beginning, at the end, or in the middle. It also avoids the (blah|) type syntax by using ? to make the parameter optional.


I deliberately want the pattern to fail if leading space or "nac " with following space and no parameter. Personal preference I guess.

It lets me do things like have "ah" to set autohealing but still use "ah " to get the "ahh" emote.

Thanks for the tip on using ? for optional parameter though... didn't know about that.
Unknown2006-04-28 20:12:37
Heh. I'm just careful to try not to make aliases that override things they shouldn't. If I'm overriding sip or smoke or something because I'm tracking the action, that's another thing. I had an alias for Achaea called "eye" that wielded an eye sigil and threw it at the ground, but the first time that I tried to eye someone suspiciously I nearly exploded a sigil in the room. Lucky for me, I had them in my pack at the time.