Mushclient Questions

by Esano

Back to Mechanic's Corner.

Faymar2010-08-08 12:57:41
QUOTE (Esano @ Aug 8 2010, 02:54 PM) <{POST_SNAPBACK}>
You should also be able to use \\n (or possibly \\\\n?) to insert a newline in the AddTrigger.

\\n for a multiline trigger.
Esano2010-08-08 12:59:26
Yes, but you don't want the \\n to be parsed as an immediate newline (thus splitting the AddTrigger call over two lines). You want to escape the \\ instead, so the trigger contains \\n.
Faymar2010-08-08 13:03:01
QUOTE (Esano @ Aug 8 2010, 02:59 PM) <{POST_SNAPBACK}>
Yes, but you don't want the \\n to be parsed as an immediate newline (thus splitting the AddTrigger call over two lines). You want to escape the \\ instead, so the trigger contains \\n.

Sorry, I only read your post, not the reason why he needs the newline symbol. Yes, you are right. That's the way to do it.
Unknown2010-08-09 00:24:22
Thank you all so much for your help with my last question! It seems to be working fine now.

Now I have an even bigger question, one that has me way over my head and sinking fast.

I'm working on a function that, when I both have it enabled and use 'II' will go down, probing each object, and then linking up the information of what is in each (or how much, in the case of pipes) with the id num.

Essentially it'll enable a trigger that matches to ^ \\"\\w\\d\\" and then puts them into the appropriate argument areas of the following function

function inv_log_item (short, num)
inv_log = {}
table.insert {inv_log, short, num)
end

This should give me a table with the stuff from my inventory on it.

How do I go down the table, probing one at a time, and triggering the lines for the types of potions, salves, and in the case of pipes, herbs and puffs, so that I have the following information:

item id
contents
(optional #of puffs)

I tried figuring out how lua does coroutines, but it made little sense, just enough to get the impression that it wasn't what I needed.

Is there a much simpler way I could do this?
Unknown2010-08-09 02:00:30
Your function is invalid in more ways than one. You're clearing out your table every time, so you would only ever have the last thing you tried to store. You're mixing the syntaxes for setting values, too. You should be doing something more like "inv_log = short" to store the short name using the ID as the key. When you use table.insert, it requires you to use numeric values for your keys, usually where the keys are simply the sequence (i.e., used more for iteration than lookup).

The sequence is basically this: your alias initializes your table and enables the II capturing trigger(s) before sending the command to the game, the trigger(s) capture(s) the values into the table, and when you're finished (hit a prompt, maybe), you evaluate your results.
Unknown2010-08-09 02:24:43
*groans and facepalms* Yeah, I suck at this stuff. Thanks for replying. I'll try to work it out how you described and let you know how it works.
Unknown2010-08-09 03:37:55
Edit: Nevermind. I'm going to set this function up to use pipelist/potionlist/etc, rather than trying to use it as a workaround. The process becomes way simpler with those. Thank you all for trying to help.
Dysolis2010-08-12 23:17:28
Hey

What's the syntax to create a direction that would hit a player either adjacent in a room or in the room? For example something like this.
CAST GUST
Unknown2010-08-13 01:17:00
Is there a coding question in there somewhere?
Shaddus2010-08-13 01:19:53
QUOTE (Dysolis @ Aug 12 2010, 06:17 PM) <{POST_SNAPBACK}>
Hey

What's the syntax to create a direction that would hit a player either adjacent in a room or in the room? For example something like this.
CAST GUST

If you're trying to make an alias for it, try this.

Make the alias
QUOTE
GUST *


and make this do
QUOTE
CAST GUST @target %1


Sub in your own target alias, and make sure you click "ignore case". Also make sure you click "expand variables"
Dysolis2010-08-13 01:48:48
I thought it was %1 let me try to do it again. Thanks!
Dysolis2010-08-13 01:52:47
cast gust @script_target %1 this isn't working. cast gust xiphoid
This location has been declared free of violence by some spell of peace.

gst out
Come now, you don't really mean that.
5518h, 4305m, 4765e, 10p esSilrxkb (xhspfwb)
gstout
That went right over my head.
Yiila2010-08-13 02:09:28
In the game I have the alias "setalias bn play blanknote &t" and t expands to whatever st t is.

So I wanted to put the bn on the keypad key ctrl+7. So I went to the keypad configure, and I put in "play blanknote &t" but it does not expand &t.

I did a search for pre-existing target variables in Treant to modify, but I did not find any, so I was wondering, How can I make &t expand when coming from the numpad like it does from coming into the game? Or... is there a superior way to set it up all inside the client?
Shaddus2010-08-13 02:18:03
QUOTE (Dysolis @ Aug 12 2010, 08:52 PM) <{POST_SNAPBACK}>
cast gust @script_target %1 this isn't working. cast gust xiphoid
This location has been declared free of violence by some spell of peace.

gst out
Come now, you don't really mean that.
5518h, 4305m, 4765e, 10p esSilrxkb (xhspfwb)
gstout
That went right over my head.

Can't gust out of the aetherplex. Do you have variables expanded like I said?
Dysolis2010-08-13 03:14:41
It all works now. I needed the astrisk. thanks!
Shaddus2010-08-13 03:20:42
QUOTE (Dysolis @ Aug 12 2010, 10:14 PM) <{POST_SNAPBACK}>
It all works now. I needed the astrisk. thanks!

I'm not a coder, so this may or not make sense.

The asterisk is your wildcard, which matches to %1. You can use multiple like so. For instance,

QUOTE
GUST * *



sends

QUOTE
CAST GUST %1 %2


so

QUOTE
GUST DYSOLIS N


would send

QUOTE
CAST GUST DYSOLIS N


%1 matches the first asterisk, %2 matches the second. Somewhat easy idea to figure out. I realize this isn't reducing your typing that much, but you can always try using smaller aliases, like GG * *
Dysolis2010-08-13 04:20:12
Ahhh interesting.
Unknown2010-08-13 12:04:15
Yiila, you should have a look at my MUSHclient basic tutorial page.
Yiila2010-08-14 03:49:31
Thank you good sir I will do just that.
Anisu2010-08-30 10:29:24
Question, is there a way for me to record what my current numpad bindings are in to variables.

To explain I am trying to make my script remap the numpad for certain situations, but for compatibility with other people who will use it I would like on disengaging change them back to the original instead of my standard keymap