Mushclient Questions

by Esano

Back to Mechanic's Corner.

Oli2009-02-15 05:10:33
Just wondering. Is there any way to set a timestamp to your h,m,e,p bar? Currently I time my demesne with the little timer at the bottom but sometimes I forget to check the time on the first effect and it screws me up.
Isuka2009-02-15 05:28:12
QUOTE (Oli @ Feb 14 2009, 09:10 PM) <{POST_SNAPBACK}>
Just wondering. Is there any way to set a timestamp to your h,m,e,p bar? Currently I time my demesne with the little timer at the bottom but sometimes I forget to check the time on the first effect and it screws me up.


Catch the prompt with a trigger, and use a script to send a ColourTell. It won't start a newline, and will display directly after the prompt.
Razenth2009-02-16 08:45:39
Let's say I have two lua files, my main script, and other script that has all these pretty functions in it. There is a trigger that captures some value and assigns it to a variable in the second lua file. Now, if I wanted to access this variable, would I need to write an accessor method into the second file to help me get this value, or is there some magical way I can do it without that?
Isuka2009-02-16 08:57:56
QUOTE (Razenth @ Feb 16 2009, 12:45 AM) <{POST_SNAPBACK}>
Let's say I have two lua files, my main script, and other script that has all these pretty functions in it. There is a trigger that captures some value and assigns it to a variable in the second lua file. Now, if I wanted to access this variable, would I need to write an accessor method into the second file to help me get this value, or is there some magical way I can do it without that?



Ok, assuming this: You've declared a Lua variable, and want to access it... not a MUSH variable.

As long as you don't declare the variable as local, you can access it within a script without any problems, even if that script is used in the trigger's send field. Lua is all handled in a global sandbox, and so all lua scripts have access to all other lua scripts, as following the rules of the language.

I'm partial to trying to treat Lua as more of an OOP language. I encapsulate everything as local values and use accessor functions to get or modify the values. This is a matter of preference, though, and you have to take extra steps to make Lua function in this way.
Razenth2009-02-16 09:30:42
Another dumb question. I have an alias defined in Mush. I have a trigger defined in Mush. How do I get Mush to send the alias when the trigger is matched?

EDIT: never mind, found out how, stupid me.
Isuka2009-02-17 00:15:13
Ok, so I'm working on making my prompt more informational. I have a bunch of information that I want to start displaying to myself, such as if I'm set to swing or jab, have omen or deathmark and so forth.

How do I rewrite a prompt and keep the original colors? I know I'll need to rewrite the entire line if I want to keep my extra stuff on one line, but I like that my prompt shows yellow and red for low/critical vitals.
Unknown2009-02-17 00:29:44
1. Make a trigger to capture your prompt.
2. Omit from output, of course.
3. Set that trigger up with the name of a function in the Script box (not the big Value box).
4. That function receives a list of all the styles, so you can manipulate them or re-echo them.
5. Make a script function that looks kinda like this and add your own bits:
CODE
function decorate_prompt(name, line, wildcards, styles)
  for _, v in ipairs(styles) do
    ColourTell(RGBColourToName(v.textcolour), RGBColourToName (v.backcolour), v.text)
  end

  Note("")
end
Isuka2009-02-17 00:34:26
QUOTE (Zarquan @ Feb 16 2009, 04:29 PM) <{POST_SNAPBACK}>
1. Make a trigger to capture your prompt.
2. Omit from output, of course.
3. Set that trigger up with the name of a function in the Script box (not the big Value box).
4. That function receives a list of all the styles, so you can manipulate them or re-echo them.
5. Make a script function that looks kinda like this and add your own bits:
CODE
function decorate_prompt(name, line, wildcards, styles)
  for _, v in ipairs(styles) do
    ColourTell(RGBColourToName(v.textcolour), RGBColourToName (v.backcolour), v.text)
  end

  Note("")
end

You're awesome. Thank you.
Isuka2009-02-17 08:45:15
So the answer to my last post got me curious about script events. Is there a help file on them on the mushclient website? I can't seem to find one.

I want to know how parameters are sent to the function call, and how I can control it. I'd like to just have a function to AttackHead(target) and be able to drop that into the script event field rather than make a formal call from the Value field but can't figure out how to send the target to it.

Maybe it cant' be done. I don't know.

Edit: Found it. Nevermind.
Isuka2009-02-17 19:11:08
How would one go about setting a timer to execute a script function or alias using AddTimer in lua?

I'm setting my system up with failsafe timers for balances, and can't quite figure out how to get the timer to regain the balance.
Unknown2009-02-17 21:11:45
You can use DoAfterSpecial to execute scripts, but you don't have as much control over that. I use ImportXML to make timers that don't exist yet and thereafter use EnableTimer, ResetTimer, and SetTimerOption to control them.
Tyamit2009-02-19 17:01:16
If I wanted to make an alias for say.. targetting jabbing but I want the alias to check to see if the variable for my target's rebounding being up is set to 1 and if it is to cleave or raze instead? How would a code look for this? Samples please and thanks!

Unknown2009-02-19 17:11:46
QUOTE (Tyamit @ Feb 19 2009, 12:01 PM) <{POST_SNAPBACK}>
If I wanted to make an alias for say.. targetting jabbing but I want the alias to check to see if the variable for my target's rebounding being up is set to 1 and if it is to cleave or raze instead? How would a code look for this? Samples please and thanks!


Using Lua?

I have an alias that I pass the appropriate attacks through to check for rebounding/shield. It uses my enemy tracking script for the rebounding/aura variables, so you'll need to change that bit.

CODE

     name="autoraze_target__"
   match="^\\s*art\\s+(.+?)\\s*$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  local targ = string.lower(GetVariable("target") or "")
if treant:auto("raze") and (enemy.shield or (enemy.aura and not string.find("%1", "crush"))) then
  Execute("raze " .. targ)
else
  Execute("%1")
end

  
Kio2009-02-19 18:08:44
I am convinced now. Regardless, MUSH questions (after I've scoured the MUSH website for about two hours and not being able to find the answers myself, granted I may just be an idiot):

I want to replace with EQ line, and change the color. How would I go about this?
How would I add text to the end of my prompt?

Examples with an explanation would be immensely appreciated!
Gregori2009-02-19 18:23:13
QUOTE (Kio @ Feb 19 2009, 12:08 PM) <{POST_SNAPBACK}>
I am convinced now. Regardless, MUSH questions (after I've scoured the MUSH website for about two hours and not being able to find the answers myself, granted I may just be an idiot):

I want to replace with EQ line, and change the color. How would I go about this?
How would I add text to the end of my prompt?

Examples with an explanation would be immensely appreciated!



CODE
   enabled="y"
   keep_evaluating="y"
   match="^You have recovered balance on all limbs\\.$"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   send_to="14"
   sequence="1"
  >
  ColourNote ("~G           <<<~Y  BALANCE~G  >>>")
  


If you know how to install plugins install the one called ColourNote in the plugins folder that comes with MushClient. It has instructions on how to use it so should be pretty self explanatory.




Kio2009-02-19 18:50:15
Awesome! Thanks a ton!
Unknown2009-02-19 18:53:38
That's an odd syntax there, Gregori. Why not just use the standard built-in format? (It may not look as simple, but it doesn't require a plugin, and it's pretty simple to dynamically script colors, if you want to change them for various situations.)
CODE
ColourNote("green", "", "<<< ", "yellow", "", "BALANCE", "green", "", " >>>")
Kio2009-02-19 19:13:54
QUOTE (Zarquan @ Feb 19 2009, 01:53 PM) <{POST_SNAPBACK}>
That's an odd syntax there, Gregori. Why not just use the standard built-in format? (It may not look as simple, but it doesn't require a plugin, and it's pretty simple to dynamically script colors, if you want to change them for various situations.)
CODE
ColourNote("green", "", "<<< ", "yellow", "", "BALANCE", "green", "", " >>>")


Exactly what I was looking for, guys! Thanks a ton!
Noola2009-02-21 05:04:19
Sometimes, when two things go to the output at the same time or close to, one of them will not show.

For instance:

I entered qw and got this:

A sparkling wind blows in from the south.
2906h, 4560m, 4134e, 10p, elrxkb<>-{d}|Safe|{3:33:38.12}
(*) Currently, there are 3 Lusternians on this Plane and 104 on other Planes.

As you can see, the prompt ate the actual names of those three lusternians. I think it was because just when I entered qw a sparkling wind passed by.

Now, my question is, what setting makes this happen in Mushclient and how can I get rid of it? It's so annoying when it happens when I'm trying to send a tell or say something because when my tell or say is eaten like this I get paranoid I didn't send it at all and then I wind up sending it twice. laugh.gif
Esano2009-02-21 05:34:35
QUOTE (Noola @ Feb 21 2009, 04:04 PM) <{POST_SNAPBACK}>
Sometimes, when two things go to the output at the same time or close to, one of them will not show.

For instance:

I entered qw and got this:

A sparkling wind blows in from the south.
2906h, 4560m, 4134e, 10p, elrxkb<>-{d}|Safe|{3:33:38.12}
(*) Currently, there are 3 Lusternians on this Plane and 104 on other Planes.

As you can see, the prompt ate the actual names of those three lusternians. I think it was because just when I entered qw a sparkling wind passed by.

Now, my question is, what setting makes this happen in Mushclient and how can I get rid of it? It's so annoying when it happens when I'm trying to send a tell or say something because when my tell or say is eaten like this I get paranoid I didn't send it at all and then I wind up sending it twice. laugh.gif

It happens when the text that you requested ended up on the same line as a prompt. The prompt gets gagged and replaced by your script, but it looks like nothing else on that line does.

Config prompt add linebreak might fix it, or there's an option regarding linebreaks in Mush itself somewhere which might do the trick.