Mush

by Alaskar

Back to Mechanic's Corner.

Alaskar2006-04-10 22:38:32
when I regain balance, or anything else, how do I make echos or substitute things? In nexus, when I regained balance, it made big letters say BALANCE, GO GO GO GO GO!~~~~~~~~
Daganev2006-04-10 23:07:23
do'nt know in mush but in Zmud it was Trigger your text and then do #sub new_text (no spaces)
Alaskar2006-04-10 23:19:49
Also, when I sit idle for, say a minute, when I do something, everything that has been said or that has occured within that one minute suddenly pops up. While I'm sitting idle nothing shows up
Daganev2006-04-10 23:20:47
I had that problem with my wireless connection once... then I upgraded the firmware and all was working fine. (had to upgrade the firmware for WoW to work, apparently it was a known problem)
Unknown2006-04-11 00:57:58
Make a trigger for "You have recovered balance." In the trigger editing dialog, there's a "Send to:" drop-down menu. Pick Send to: Script. Let's assume you're using VBscript. To make an echo, type the following in the Send box:

note "BALANCE, GO GO GO GO GO!"

That echo will show up in the standard note colour. (For me, that's blue font on black. There's a setting for it... somewhere.) If you want to use different colours, use a colournote instead:

colournote "red", "yellow", "BALANCE, GO GO GO GO GO!"

(If you're using another scripting language, ask, and I'll post the correct syntax.) If you want to substitute rather than just echo, do the above and check the "Omit from output" box.

Each note/colournote terminates in a newline, so if you want a multiline echo, just use one for each line. note "" does blank lines.

As for your other problem... are you sure you're scrolled to the very bottom of the output screen? If you scrolled up a bit, you'll stay there until you scroll to the end of the output manually. I'd recommend this: Go to Game > Configure > Commands..., click on the Keyboard preferences... button, and check "Ctrl-Z goes to end of output window" (it's under the "Compatibility" heading). Then, you can use Ctrl-Z to get to the newest output quickly.
Unknown2006-04-11 06:12:55
how can I make a three, four line trigger and omit it all?
Unknown2006-04-11 06:50:21
MUSHclient doesn't let you omit multi-line triggers from output. But... why don't you make a separate trigger for each line of your chunk of text, and omit those? If the linebreaks are variable, just use wildcards for the beginning and end of each line and keep only the text you absolutely need in the middle.

Same goes for colouring text.
Alaskar2006-04-11 14:03:22
can I substitute lines in MUSH? And how would I go about making a keybinding? Would I make it like an alias?
Also, in nexus I had a script for harvesting. When I walked into a room, I set my variable "herbs" to the number of plants I would be harvesting (I left at least 5-6) and then I typed HARVE. When I did harve, it would harvest one, INR it. My trigger, when it recognizes me harvesting the plant, reduces the variable by 1. Another trigger, for "You have recovered {*}" ( I turned that one off when not harvesting) it would harvest so long as my variable was greater than 0. If it was equal to or less than 0, it would cease the harvesting.



This brings up another question; How do I turn off a group of triggers? And when making a trigger, do I have to do all of that World. SendPush or can I just put the command I want it to do in the send box?


I'm confused wacko.gif doh.gif I'm sure this could be a great and useful client, especially since I've already gotten a system, but it's confusing me!

Also, do I have to import the system each and every time? Because last night the system was fine, but when I logged on just now, the system was not there and I had to import it again.
Unknown2006-04-11 18:11:51
To answer the substitute question, read this post on Nick's forums. In fact, I highly suggest you just browse the help file index and search through his forums for a few keywords. The forums there answer questions about MUSHclient much more effectively than here, I think.
Unknown2006-04-11 21:17:14
What to put in a trigger: No, you don't have to do the world.send thing. That's only if that particular trigger's calling script commands. So, for example, if you want to echo something (which requires a script command) *and* send text to Lusternia, you'd set the trigger to Send to: Script, then enter this:

colournote "red", "green", "----AEON----AEON----AEON----"
send "sip phlegmatic"

(Note: the above is obviously a Very Bad Example that will Get You Killed. tongue.gif ) With VBscript, you don't have to put "world." before script commands.

If you just wanna send text to Lusternia, set the trigger to Send to: World and enter whatever commands you want to send.

If you want your trigger to carry out one of your aliases, set it to Send to: Execute and enter any aliases and any other text you want sent directly to Lusternia. So, let's say that you have the alias "epe" that does "outr pennyroyal; eat pennyroyal". You might have a trigger that sends this to Execute: "focus mind; epe". Because it's sending to Execute, MUSHclient will first check for aliases, expand "epe" into text that Lusternia will understand, then send that along with the raw "focus mind" text.

Keybindings: make an alias, then go to Game > Configure > Macros..., pick the key you wanna bind (say, F11). In the Edit macro dialog, enter the name of your alias and choose the Send Now option. (Notice that this is like setting a trigger to Send to: Execute. You can enter both aliases and text to send directly to Lusternia.)

Turning triggers on/off: You can turn off individual triggers with enabletrigger "triggername", "0" and turn them back on with enabletrigger "triggername", "1". You can turn off groups of triggers using the enabletriggergroup command in the same way. In the Edit trigger dialog, the name of your trigger goes where it says Label, and the group where it says Group. So, say you have a trigger group called "HarvestTriggers". You can make an alias called harveston, that Sends to: Script, and has this in the Send field: enabletriggergroup "HarvestTriggers", "0".

Using script commands quickly: If you wanna try out script commands from the command line, just preface them with / (and don't leave a space after the backslash). So, just typing in /enabletriggergroup "HarvestTriggers", "0" will work from the command line.

Saving the system: OK, in order to set up triggers, aliases, whatnot, first you have to create a world file. Save the changes before you exit MUSHclient (it should ask you), then when you run MUSHclient again, just open the world file. All your stuff will be in there.

I have a quick-and-dirty harvester somewhere. I'll post it in a second.

MUSHclient is an amazing client: it's super-fast, stable, and the coding's really logical (all in stark contrast to the horrors of zMUD)... but the learning curve's a little steep. Hopefully, this'll get you started, and you can learn the rest by reading very patiently through the help files.
Unknown2006-04-11 21:39:09
Eep, I seem to have deleted said harvester. Here's an even quicker-and-dirtier one, though:

Say you check PLANTS in a room and see 60 galingale. You want to leave 10. Make an alias: "harv * *". When you type in "harv 60 galingale", you want it to harvest 50 galingale. The first wildcard (%1) will match the number, the second (%2) will match the herb. Set it to Send to: Script. In the Send field, enter:

setvariable "herbamount", %1 - 11
setvariable "herbtoharvest", %2
send "harvest %2"

Now make a trigger that matches "You have recovered balance." Set it to Send to: Script. In the Send field, enter:

if getvariable ("herbamount") > 10 then
send "harvest " & getvariable ("herbtoharvest")
send "inr " & getvariable ("herbtoharvest")
setvariable "herbamount", getvariable ("herbamount") - 1
elseif getvariable ("herbamount") = 10 then
send "inr 500 " & getvariable ("herbtoharvest")
end if

I was using something like this and also had two aliases that turned this trigger on and off in case I needed to stop harvesting prematurely. So, if your trigger's named "harvest_trigger", you can make an alias "harvestoff" that Sends to: Script the following:

enabletrigger "harvest_trigger", "0"

And a "harveston" alias that looks the same, but replace the 0 with a 1. Then you can assign keybindings to the aliases, and you should be set.
Unknown2006-04-11 23:44:04
I have a system already, a damned good one too, but I want to make my own. Was going to start building off a base autohealer ( you can find the super autohealer on the mush forums ) Was wondering, how can I set it up to match Lusty's prompt?

Hmm, my current system matches my health/mana/ego thats in my score. Ah, so confusing.

Just asking for a little help on the subject. If its too much, I understand.
Alaskar2006-04-11 23:57:24
blink.gif
QUOTE(Zarquan @ Apr 11 2006, 02:11 PM) 278320

To answer the substitute question, read this post on Nick's forums. In fact, I highly suggest you just browse the help file index and search through his forums for a few keywords. The forums there answer questions about MUSHclient much more effectively than here, I think.


I'm more confused than ever after reading that! wacko.gif
Unknown2006-04-12 00:33:29
QUOTE

I'm more confused than ever after reading that! wacko.gif


Yeah, that link basically tells you something I didn't know: you can't substitute easily. When you check the "Omit from output" option for a trigger, it also keeps notes/colournotes from showing up - so both the trigger line and your echoes are gagged. You can do substitutions with scripting calls, but it looks like too much trouble IMO. Just use echoes.

QUOTE(B_a_L_i @ Apr 12 2006, 12:44 AM) 278400

I have a system already, a damned good one too, but I want to make my own. Was going to start building off a base autohealer ( you can find the super autohealer on the mush forums ) Was wondering, how can I set it up to match Lusty's prompt?

Hmm, my current system matches my health/mana/ego thats in my score. Ah, so confusing.

Just asking for a little help on the subject. If its too much, I understand.


Use a lovely regular expression! My prompt, for instance, looks like this:

2884h, 4708m, 4252e, 10p, 22440w ex-

And I capture it with this pattern (be sure to tick off the "Regular expression" option):

^(\\d+)h\\, (\\d+)m\\, (\\d+)e(.*)\\-

^ matches on the start of a new line. (\\d+) captures a number. \\d specifies that you're looking for digits, + means you're looking for one or more of them, the () assign the matched pattern to a variable so you can use it in your scripting. (.*) captures everything between the e and the -. The dot says that you're looking for any character (digit, letter, space, whatever), and the * means you're looking for zero or more of that character. The other backslashes are there to escape the , and - (to tell MUSHclient not to treat those as special characters). I'm don't think they're necessary, but meh: it's good practice to put a backslash before any character you're matching that isn't a number, letter or whitespace, just in case.

So what's getting captured? Four wildcards (%1-%4) based on the three (\\d+) and the (.*). In the above example, they look like this: 2884, 4708, 4252, ", 10p, 22440w ex". The first three are numbers and the last is a string. Notice that I'm sticking all the bit with the power and willpower in the last wildcard, because I don't really care about capturing those numbers separately. This pattern will match any prompt that begins with HME.

Now you can assign your health, mana and ego values to world variables (which can be accessed by any of your other bits of script):

setvariable "currhealth", %1
setvariable "currmana", %2
setvariable "currego", %3

You can also check for defences that show up on your prompt. Want to know if you've got kafe up? Check to see if there's a "k" in the last wildcard.

if instr("%4", "k") then
setvariable "def_kafe", "1"
else
setvariable "def_kafe", "0"
end if

instr is a VBscript function that checks if something is part of a string. You need "" around %4 to specify that its value is a string.

Another fun thing I check off of my prompt:

if instr("%4", "b") then
setvariable "affliction_blind", "1"
else
setvariable "affliction_blind", "0"
end if
if instr("%4", "d") then
setvariable "affliction_deaf", "1"
else
setvariable "affliction_deaf", "0"
end if
if ((getvariable ("affliction_blind")) XOR (getvariable ("affliction_deaf"))) then
setvariable "def_sixthsense", "0"
end if

Am I blind? Am I deaf? And if I'm either blind or deaf but not both, I clearly don't have sixth sense.

Hope that helps, cheers.

P.S. All these examples are based on VBscript. Personally, of the choices of scripting language, I really recommend Python, but I've been building off of Ethelon's free system, which is in VBscript.
Unknown2006-04-12 01:24:46
Vale, your a godsend. This is like getting support from Nick himself. Thanks! happy.gif
Unknown2006-04-12 01:48:39
Anytime. I love this stuff. wub.gif (And I found it really confusing and counterintuitive while I was picking it up, sooo... I'll gladly spare others the "Why for the love of God is it doing that?" effect. The help files are confusing, too, until you've seen some examples and gotten the basic hang of it.)
Unknown2006-04-12 04:07:42
Was wondering how I could use the SendNoEcho command to mask something that uses quotation marks. For instance, if I want to play I sound to a trigger, I have to quote the file. It seems when I quote over the quote, things start to screw up.

like using

world.sound "darth.wav"

in a trigger. How can I use SendNoEcho to mask that?
Unknown2006-04-12 04:32:28
I'm not sure I understand the problem. If I make a trigger with: sound "darth.wav" in the Send field, and that file's in my Worlds directory, the sound plays back and that's it. SendNoEcho just keeps commands you send to Lusternia from showing up on your screen, if you normally have your input echoed, so I don't see how it relates. (I normally don't have it echoed: Game > Configure > Commands... > Echo My Input is off, and it's wonderful spam reduction). If you have problems with quotes inside quotes, remember that you have to double-quote inside quotes. For instance:

DoAfterSpecial 2, "enabletrigger ""curing_aeon"", ""0""", 12 | sends this to script:

enabletrigger "curing_aeon", "0" | after 2 seconds.
Unknown2006-04-12 04:50:55
QUOTE
(I normally don't have it echoed: Game > Configure > Commands... > Echo My Input is off, and it's wonderful spam reduction).


that saved me so much grief. happy.gif
Unknown2006-04-12 05:31:32
Another spam reduction tip: in Lusternia, CONFIG PROMPT REMOVE LINEBREAK, then in MUSHclient, go to Game > Configure > Output... and check "Convert IAC EOR/GA to new line". Seems to cut down on a lot of blank lines.