Mushclient Questions

by Esano

Back to Mechanic's Corner.

Xavius2009-10-25 04:01:16
QUOTE (Ried @ Oct 18 2009, 11:52 PM) <{POST_SNAPBACK}>
How easy would it be to make a little script that tallies up the listed items when you do II and spits the total back to you? And how would I go about doing that?

It's a doable array function. Not basic, but not impossible, assuming that MUSH doesn't limit the capabilities of its borrowed scripting languages.

I suppose the real question is why you would, seeing as how INV does that for you and II will get you a single item count.
Aerotan2009-10-25 04:14:30
II SQUID
You are wielding:
staff25843 : a coral staff in your left hand
You are holding:
squid1102 an emerald firefly squid
squid1188 an emerald firefly squid
squid1185 a sapphire firefly squid
squid1189 a purple firefly squid
You are wearing:
Ilyarin2009-10-25 10:53:53
If you know how to import XML directly, put this in Aliases and Triggers respectively. It uses Lua, though, so be sure your MUSH is set up for that.

CODE

     name="ii_script__"
   match="^\\s*ii\\s+(+)\\s*$"
   enabled="y"
   group="InfoInv"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  Send("Ii %1")
ii_script_track = string.lower("%1")
ii_script_count = 0
EnableTrigger("ii_script_on__",true)
EnableTrigger("ii_script_off__",true)

  


CODE

     group="InfoInv"
   ignore_case="y"
   match="^\\"(+)\\d+\\"\\s+.+$"
   name="ii_script_mid__"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  if ii_script_track == string.lower("%1") then
  ii_script_count = ii_script_count + 1
end

  
     group="InfoInv"
   match="^You are wearing\\:$"
   name="ii_script_off__"
   omit_from_output="y"
   regexp="y"
   send_to="14"
   sequence="100"
  >
  if ii_script_count and ii_script_count > 0 and ii_script_track then
  ColourNote("white","","You are holding " .. ii_script_count ..  " " .. ii_script_track .. "(s).")
  ColourNote("silver","","%0")
else
  ColourNote("silver","","%0")
end
ii_script_count = null
ii_script_track = null
EnableTrigger("ii_script_on__",false)
EnableTrigger("ii_script_mid__",false)
EnableTrigger("ii_script_off__",false)

  
     group="InfoInv"
   keep_evaluating="y"
   match="^You are holding\\:$"
   name="ii_script_on__"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  EnableTrigger("ii_script_mid__",true)
  
Unknown2009-10-25 14:00:14
QUOTE (Xavius @ Oct 25 2009, 12:01 AM) <{POST_SNAPBACK}>
It's a doable array function. Not basic, but not impossible, assuming that MUSH doesn't limit the capabilities of its borrowed scripting languages.

I suppose the real question is why you would, seeing as how INV does that for you and II will get you a single item count.

Because sometimes I have x kephera warriors and y kephera nurses and z kephera monks and I just can't do mental math. sad.gif

Also, Ilyarin, I think I love you.
Ilyarin2009-10-25 14:46:12
BTW that still probably won't work for what you want, because it only counts things that have the main noun of "ii ". tongue.gif If you'd rather it counted all the lines that show up, then the easiest way will be to replace the first piece of code (in trigger "ii_script_mid__") with the second.

CODE
if ii_script_track == string.lower("%1") then


CODE
if string.find("%0",ii_script_track) then
Fern2009-11-05 20:19:03
OK!

I'm trying to make an alias to use stag headbutt.

I'm trying to have the command be something like: hb n
and it would execute something like: headbutt @target north
but be able to do that with any direction, and n ot have to make 8 aliases for the 8 directions

I already have a targetting system set up, so I know how to do the first part of the execution, (headbutt @target) but not how to capture the variable which would be the direction, and execute it all in the same alias.

first off, is this even possible? and secondly, could somebody coach me through setting it up?
Dorcha2009-11-05 20:30:02
QUOTE (Fern @ Nov 5 2009, 08:19 PM) <{POST_SNAPBACK}>
OK!

I'm trying to make an alias to use stag headbutt.

I'm trying to have the command be something like: hb n
and it would execute something like: headbutt @target north
but be able to do that with any direction, and n ot have to make 8 aliases for the 8 directions

I already have a targetting system set up, so I know how to do the first part of the execution, (headbutt @target) but not how to capture the variable which would be the direction, and execute it all in the same alias.

first off, is this even possible? and secondly, could somebody coach me through setting it up?


New to Mush myself but would it not just be "hb *" sends headbutt @target "%1"
Diamondais2009-11-05 21:11:42
What are the different wildcards and how can I use multiple ones? confused.gif
Aerotan2009-11-05 21:12:46
Or, using regex,
QUOTE
^hb (\\w+)$
sends
QUOTE
headbutt @target %1
to world
Then, for targeting on the fly,
QUOTE
^hb (\\w+) (\\w+)$
sends
QUOTE
SetVariable('target', '%1')
Execute('hb %2')
to Script (after omissions)

Make sure both are set to expand variables.
Unknown2009-11-05 21:16:49
The simple MUSHclient syntax uses * for any wildcard you want to pass in. The main problem with that, however, is that you're limited to a single word for each wildcard and it'll match numbers, letters, whatever. I myself prefer regular expressions, though they're not required for the simple things.

Pattern: ^hb (\\w+)$
Send: headbutt @target %1

OR

Pattern: hb *
Send: headbutt @target %1

To do multiple, you just expand on that idea.

Pattern: ^hb (\\w+) (\\w+)$
Send: headbutt %1 %2

OR

Pattern: hb * *
Send: headbutt %1 %2


With regex, you can limit it to just numbers (\\d+) or a number followed by three letters (\\d\\w{3}) or whatever you want, including multiple words in a single wildcard (\\w+ \\w+ \\d+).

Hope that helps more than confuses.
Diamondais2009-11-05 21:19:56
QUOTE (Zarquan @ Nov 5 2009, 04:16 PM) <{POST_SNAPBACK}>
The simple MUSHclient syntax uses * for any wildcard you want to pass in. The main problem with that, however, is that you're limited to a single word for each wildcard and it'll match numbers, letters, whatever. I myself prefer regular expressions, though they're not required for the simple things.

Pattern: ^hb (\\w+)$
Send: headbutt @target %1

OR

Pattern: hb *
Send: headbutt @target %1

To do multiple, you just expand on that idea.

Pattern: ^hb (\\w+) (\\w+)$
Send: headbutt %1 %2

OR

Pattern: hb * *
Send: headbutt %1 %2


With regex, you can limit it to just numbers (\\d+) or a number followed by three letters (\\d\\w{3}) or whatever you want, including multiple words in a single wildcard (\\w+ \\w+ \\d+).

Hope that helps more than confuses.

Oh okay, that helps somewhat. I wasn't sure if %2, etc would work.
Unknown2009-11-05 21:21:51
You can use %0 to refer to everything just matched (i.e. "hb person direction"), %1 to %9 for the first nine wildcards, and beyond that you have to use %<10> through %<20> with the angle brackets to keep MUSHclient from treating it as %1 followed by a 0 and so on.
Aerotan2009-11-05 21:31:06
EDIT: Ninja'd. Deletepls
Fern2009-11-06 01:04:04
thanks!
Dynami2009-11-26 00:59:29
Whenever I enable Simimi's prompt tracker, I always get two prompts showing up.
QUOTE
4356h, 4482m, 3990e, 10p, 19260en, 20490w exk-
4356h, 4482m, 3990e, 10p, 19260en, 20490w exk-<19:59:54.043>

I know Aiyana had the same problem, but she isn't around and no one answered her question here. Any ideas?
Unknown2009-11-26 02:53:21
Randomly, I press something I don't realise and everything I enter has say in front of it. What am I pressing, and how do disable it if I accidentally press it. Right now I've just been disconnecting and connecting, and it fixes it. But it gets annoying.
Xenthos2009-11-26 03:02:02
QUOTE (Solanis @ Nov 25 2009, 09:53 PM) <{POST_SNAPBACK}>
Randomly, I press something I don't realise and everything I enter has say in front of it. What am I pressing, and how do disable it if I accidentally press it. Right now I've just been disconnecting and connecting, and it fixes it. But it gets annoying.

Are you somehow getting a ' prefixed onto every command?
Unknown2009-11-26 03:03:37
QUOTE (Xenthos @ Nov 26 2009, 02:02 PM) <{POST_SNAPBACK}>
Are you somehow getting a ' prefixed onto every command?


No, no. Eg if I enter "QL"

"say QL" is sent in. It's not the ' .
Unknown2009-11-26 03:09:54
QUOTE (Solanis @ Nov 25 2009, 09:53 PM) <{POST_SNAPBACK}>
Randomly, I press something I don't realise and everything I enter has say in front of it. What am I pressing, and how do disable it if I accidentally press it. Right now I've just been disconnecting and connecting, and it fixes it. But it gets annoying.

It's MUSHclient's auto say. It happens to me too. If you have the world toolbar up, there should be a pressed button with a person talking. You can disable it in the world config window.
Ayisdra2009-11-26 03:17:08
QUOTE (Dynami @ Nov 25 2009, 07:59 PM) <{POST_SNAPBACK}>
Whenever I enable Simimi's prompt tracker, I always get two prompts showing up.

I know Aiyana had the same problem, but she isn't around and no one answered her question here. Any ideas?


go into the triggers...there is a tigger that you will need to disable to just get the one with the time stamp

edit: you will want the one with the Labal: prompt_dec__