Mushclient Questions

by Esano

Back to Mechanic's Corner.

Isuka2009-02-04 21:59:36
Yeah, that makes things pretty easy. Thanks again, Zarquan!
Ayisdra2009-02-06 03:46:52
A few questions:
(Using Treant system, so I believe any help(code and such) would need to be in Lua.)

1. How do I create a mini-window that captures something? (like how Treant places the MAP in a mini-window as you move)
2. How do I assign a name(varable) to a number. (so say I have a turret12345 and Kundu is in it. What exactly would I need to do so when I type something along the lines of 'Heal Kundu' when I'm locked in the grid it heals kundu (so sending GRID REPAIR MODULE 12345))
Unknown2009-02-06 03:52:02
Wait, Treant places MAP in a mini-window? How do you do that?
Ayisdra2009-02-06 03:58:38
QUOTE (Caerulo @ Feb 5 2009, 10:52 PM) <{POST_SNAPBACK}>
Wait, Treant places MAP in a mini-window? How do you do that?


From the looks of the plugin_map file, yes. It creates the window (WindowCreate) and places it in there....somehow...
Unknown2009-02-06 03:59:55
QUOTE (Ayisdra @ Feb 6 2009, 11:58 AM) <{POST_SNAPBACK}>
From the looks of the plugin_map file, yes. It creates the window (WindowCreate) and places it in there....somehow...

Ah, ok, time to meddle with that.

EDIT: Nice. I made it work!
Isuka2009-02-06 05:46:14
QUOTE (Caerulo @ Feb 5 2009, 07:59 PM) <{POST_SNAPBACK}>
Ah, ok, time to meddle with that.

EDIT: Nice. I made it work!



There's good documentation on how mini-windows work, which is what the map window is. It's very flexible, and works a lot like a standard windows api call. You create the window, and cause it to redraw every time you wish it to change its display. Parsing into the window is just a matter of creating functions to draw text to the window, and parsing information from the mud into those functions, probably with an omit to keep it from displaying on the world window.
Unknown2009-02-06 06:13:13
QUOTE (Isuka @ Feb 6 2009, 01:46 PM) <{POST_SNAPBACK}>
There's good documentation on how mini-windows work, which is what the map window is. It's very flexible, and works a lot like a standard windows api call. You create the window, and cause it to redraw every time you wish it to change its display. Parsing into the window is just a matter of creating functions to draw text to the window, and parsing information from the mud into those functions, probably with an omit to keep it from displaying on the world window.

Yeah, I'm trying to do that for capturing channels. The Mushclient documentation webpage is really helpful.


Although, when I said 'meddle' and 'made it work', all I did was look at the code, wonder how to 'activate' it, and found the Plugins option in Mushclient. Heh.
Unknown2009-02-06 12:21:09
QUOTE (Ayisdra @ Feb 5 2009, 10:46 PM) <{POST_SNAPBACK}>
1. How do I create a mini-window that captures something? (like how Treant places the MAP in a mini-window as you move)

That is more involved than you might think, but the MUSHclient documentation and forums can give you all the details.

QUOTE (Ayisdra @ Feb 5 2009, 10:46 PM) <{POST_SNAPBACK}>
2. How do I assign a name(varable) to a number. (so say I have a turret12345 and Kundu is in it. What exactly would I need to do so when I type something along the lines of 'Heal Kundu' when I'm locked in the grid it heals kundu (so sending GRID REPAIR MODULE 12345))


Make an alias that sets things in a table. The Lua code might look something like this:
CODE
     modules = modules or {}                    -- Make sure the table is initialized
     modules = "%2"  -- Assumes that your alias accepts the name first and the module number second


Setup your "heal" alias to accept the name and look up the module number:
CODE
     modules = modules or {}                    -- Again, make sure the table exists
     local module = modules
     if not module then
       Note("Who are you trying to heal?")
       return
     end
     Send("grid repair module " .. module)
Razenth2009-02-10 10:10:17
I want to add something so that when I find a room with a secret exit, I can type a command, like SECRETEXIT , and have the client
automatically make a trigger so that whenever I walk into the room I get an output echo of something like, Secret Exit: . My question is how can I capture the room title in such a way a that it can send the whole string to the AddTrigger function that Mush has. I know with that room titles by default are brown on black (at least mine are) and that they end with a period and have start line and end line tokens. Can I capture the room name as a subpattern and call is using a wild card? How would I capture it in the first place? In fact, how do you even use wildcards with regex when * has a special meaning of 0 or more?
Unknown2009-02-10 11:52:55
1. You could use ATCP to capture the room title, which is more reliable than capturing brown text, since you'll run into shield shrines and midnight date changes.
2. I highly recommend you get yourself a good regular expression reference/tutorial to learn about wildcards.
Unknown2009-02-11 03:19:38
How would I do something like this except for a maro?

QUOTE

match="^This\\_is\\_my\\_killy\\_Alias$"
enabled="y"
expand_variables="y"
regexp="y"
sequence="100"
>
beat up @target

Rika2009-02-11 04:44:07
How do I make an alias call another alias? For example, I have an alias called "test1" and I want to use it to send something to the world, while calling another alias, called "test2".
Esano2009-02-11 04:58:16
Using send to script, use Execute("aliasname").

EDIT: And of course, to send to world, Send("blah")

Execute basically means check for aliases then send - so if you attempt to execute something that isn't an alias, it sends it to the mud.
Rika2009-02-11 04:59:47
Meh, should have remembered that! Thanks.
Esano2009-02-11 05:00:35
QUOTE (Vecanamu @ Feb 11 2009, 02:19 PM) <{POST_SNAPBACK}>
How would I do something like this except for a maro?

For the non-standard macros, have a look at Accelerator.

Script:
Accelerator("do whatever you want it to")

It executes whatever's in the quotes, so it looks for aliases before sending to world.
Shiri2009-02-11 08:00:14
Anyone know the exact colours Nexus uses in terms of MUSHClient colours so I can make the latter look more like the former?
Rika2009-02-11 08:28:33
Alright, I want to make a macro to basically envenom @weapon1 with mantakaya but I notice that it doesn't see @weapon1 as a variable and it also doesn't send to script. Is there an easier way to do this other than to make something like (this is probably wrong anyway) this below along with an alias:
AcceleratorTo ("Ctrl+F1", "Execute ("alias")", 12)
Unknown2009-02-11 11:58:48
QUOTE (rika @ Feb 11 2009, 03:28 AM) <{POST_SNAPBACK}>
Alright, I want to make a macro to basically envenom @weapon1 with mantakaya but I notice that it doesn't see @weapon1 as a variable and it also doesn't send to script. Is there an easier way to do this other than to make something like (this is probably wrong anyway) this below along with an alias:
AcceleratorTo ("Ctrl+F1", "Execute ("alias")", 12)


You need to check 'Expand Variables' for @weapon1 to be converted.

Your accelerator will call the alias without the special parameters, if you just use Accelerator("Ctrl+F1", "alias") or you need to fix your quotes by using single instead of double on one pair or escaping the inside quotes with backslashes.

I made myself a handy little alias to envenom my flails with as many different poisons as I want. It alternates between one weapon and then the other to keep them balanced, so I can do "ev mantakaya calcise dulak" and it'll envenom weapon 1, then weapon 2, then weapon 1 again. If I enter the same command a second time, it does weapon 2, then 1, then 2. (Note: requires the php:split function included with Treant.)

CODE

     name="envenom_flails__"
   match="^\\s*ev\\s+(.+)$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  local weapons = { 1538, 15653 }
local venoms = php:split("%1", " ")
local start = tonumber(GetVariable("last_envenom") or "1")
local i = start
for k,v in pairs(venoms) do
  i = (start + k + 1) % 2 + 1
  local weapon = weapons
  Send("envenom " .. weapon .. " with " .. v)
end
SetVariable("last_envenom", i)

  
Chade2009-02-11 15:54:25
Don't know if this is of any use to anyone...

I wipe and envenom before every attack but sometimes I get a bit carried away and like to spam my macros over and over again which used to lead to me using thousands of poisons so I developed a really basic system of venom tracking on my weapons it assumes that poison is delivered on every strike and resets the venom variables to none. Only works if your weapons don't look the same and for bonecrusher attacks but I'm sure someone could easily modify it.

CODE
     enabled="y"
   group="Chade_Envenom"
   match="^Being careful not to poison yourself\\, you wipe off all the poisons from a colossal brutish hammer\\.$"
   name="Envenom10_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer2_", "none")
  
     enabled="y"
   group="Chade_Envenom"
   match="^Being careful not to poison yourself\\, you wipe off all the poisons from a hammer of blackened iron\\.$"
   name="Envenom11_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^Letting a (.*?)$"
   name="envenom1_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
SetVariable("hammer2_", "none")

  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^You swing a (.*?)$"
   name="envenom2_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
SetVariable("hammer2_", "none")

  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^Focusing on (.*?)$"
   name="envenom3_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
SetVariable("hammer2_", "none")

  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^Swinging a (.*?)$"
   name="envenom4_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
SetVariable("hammer2_", "none")

  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^With a heavy overhand stroke\\, you slam (.*?)$"
   name="envenom5_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
SetVariable("hammer2_", "none")

  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^There are no poisons on that item at present\\.$"
   name="envenom6_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
SetVariable("hammer2_", "none")

  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^You rub some (.*?) on a colossal brutish hammer\\.$"
   name="envenom7_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer2_", "%1")
  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^You rub some (.*?) on a hammer of blackened iron\\.$"
   name="envenom8_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "%1")
  
     enabled="y"
   group="Chade_Envenom"
   keep_evaluating="y"
   match="^Flourishing a (.*?)$"
   name="envenom9_"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  SetVariable("hammer1_", "none")
SetVariable("hammer2_", "none")

  


These go with my combat aliases (which are used in macros or accelerators), I use Larkin's Treant with his autoraze system and a custom made alias he helped me create which means I don't perform any action which follows the alias unless I'm free of entanglement, paralysis, stun and I have balance on both limbs and equilibrium. If you want those you'll have to speak to Larkin about paying for them. The envenom system should still work without the autorazer and balance/aff checker though. Just remove any reference to ART or ACT and adapt the trigger lines above, weapon numbers below and maneuver names to suit.

CODE
     name="altf3_"
   match="^\\s*altf3\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer1_" == "senso" and
"@hammer2_" == "chansu" then
Execute("art maneuver perform concussion " .. GetVariable("target") .. " head")
Execute("art maneuver perform concussion " .. GetVariable("target") .. " head")
else
Execute("wipe hammer11898;wipe hammer168415;envenom hammer11898 with chansu;envenom hammer168415 with senso")
Execute("art maneuver perform concussion " .. GetVariable("target") .. " head")
Execute("art maneuver perform concussion " .. GetVariable("target") .. " head")
end

  
     name="altf6_"
   match="^\\s*altf6\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer1_" == "mantakaya" then
Execute("art maneuver perform knockdowncrush " .. GetVariable("target") .. " rleg")
else
Execute("wipe hammer168415;envenom hammer168415 with mantakaya")
Execute("art maneuver perform knockdowncrush " .. GetVariable("target") .. " rleg")
end

  
     name="altf7_"
   match="^\\s*altf7\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer1_" == "calcise" then
Execute("art maneuver perform knockdowncrush " .. GetVariable("target") .. " lleg")
else
Execute("wipe hammer168415;envenom hammer168415 with calcise")
Execute("art maneuver perform knockdowncrush " .. GetVariable("target") .. " lleg")
end

  
     name="clf7_"
   match="^\\s*clf7\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer1_" == "calcise" and
"@hammer2_" == "calcise" then
Execute("art maneuver perform crushleg left " .. GetVariable("target"))
Execute("art maneuver perform crushleg left " .. GetVariable("target"))
else
Execute("wipe hammer168415;wipe hammer11898;envenom hammer168415 with calcise;envenom hammer11898 with calcise")
Execute("art maneuver perform crushleg left " .. GetVariable("target"))
Execute("art maneuver perform crushleg left " .. GetVariable("target"))
end

  
     name="ctrlf1_"
   match="^\\s*ctrlf1\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer1_" == "mantakaya" and
"@hammer2_" == "charybdon" then
Execute("art maneuver perform breaknose down " .. GetVariable("target"))
Execute("art maneuver perform bashbrain2 down " .. GetVariable("target"))
else
Execute("wipe hammer11898;wipe hammer168415;envenom hammer11898 with charybdon;envenom hammer168415 with mantakaya")
Execute("art maneuver perform breaknose down " .. GetVariable("target"))
Execute("art maneuver perform bashbrain2 down " .. GetVariable("target"))
end

  
     name="ctrlf2_"
   match="^\\s*ctrlf2\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer2_" == "calcise" then
Execute("art strike " .. GetVariable("target") ..  " head")
else
Execute("wipe hammer11898;envenom hammer11898 with calcise")
Execute("art strike " .. GetVariable("target") ..  " head")
end

  
     name="ctrlf3_"
   match="^\\s*ctrlf3\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer1_" == "mantakaya" and
"@hammer2_" == "charybdon" then
Execute("art maneuver perform wind " .. GetVariable("target") ..  " gut")
Execute("art maneuver perform wind " .. GetVariable("target") ..  " gut")
else
Execute("wipe hammer11898;wipe hammer168415;envenom hammer11898 with charybdon;envenom hammer168415 with mantakaya")
Execute("art maneuver perform wind " .. GetVariable("target") ..  " gut")
Execute("art maneuver perform wind " .. GetVariable("target") ..  " gut")
end

  
     name="ctrlf4_"
   match="^\\s*ctrlf4\\s*$"
   enabled="y"
   expand_variables="y"
   group="Chade_Combat"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  if "@hammer2_" == "mantakaya" then
Execute("art maneuver perform wind " .. GetVariable("target") ..  " gut")
else
Execute("wipe hammer11898;envenom hammer11898 with calcise")
Execute("art maneuver perform wind " .. GetVariable("target") ..  " gut")
end

  
Isuka2009-02-11 17:17:07
Does anyone know if it is possible to use the 10-key keys as macros? CMUD recognized them as KEY0...KEY9, and was very handy for me as a knight because I would assign macros based on how a body looks (KEY8 = head, KEY5 = chest and so forth).

It'd be really nice not to have to figure out new ways of associating attacks to keys in my brain.