Mushclient Questions

by Esano

Back to Mechanic's Corner.

Isuka2009-03-08 06:23:39
QUOTE (Kyriel @ Mar 7 2009, 10:21 PM) <{POST_SNAPBACK}>
Try changing the send to:

CODE
f %1 == "u" then
Execute ("kata perform @target 1jak%2 2jak%2 2jakraze%2 3jak%2 4jak%2 4jak%2 4jak%2")
elseif %1 == "i" then
Execute ("kata perform @target 2jakraze%2 3jak%2 4jak%2 4jak%2 4jak%2 4jak%2 4jak%2")
elseif %1 == "o" then
Execute ("kata perform @target 3jak%2 4jak%2 4jak%2 4jak%2 4jak%2 4jak%2 4jak%2")
end


This won't work. You have to put the backreferences into quotation marks, because MUSH doesn't treat them as a variable reference, it treats them as a string substitution.
Kio2009-03-08 07:24:29
Bah. Again. Stoopad. Thanks as usual!
Unknown2009-03-08 07:32:54
What is wrong with this?
CODE
^The max\\/current ego strength of %person\\: (\\d+)\\/(\\d+)$

I think it's this part that is messed up but I have it sending this:

CODE
if %2 <= %1 / 2 then ColourNote("red", "", "<<< ", "yellow", "", "AT HALF EGO", "red", "", " >>>") end


Sorry this is really sloppy...
Isuka2009-03-08 08:09:13
QUOTE (Vecanamu @ Mar 7 2009, 11:32 PM) <{POST_SNAPBACK}>
What is wrong with this?
CODE
^The max\\/current ego strength of %person\\: (\\d+)\\/(\\d+)$

I think it's this part that is messed up but I have it sending this:

CODE
if %2 <= %1 / 2 then ColourNote("red", "", "<<< ", "yellow", "", "AT HALF EGO", "red", "", " >>>") end


Sorry this is really sloppy...

needs to look like this:
CODE
Trigger:
^The max\\/current ego strength of +\\: (\\d+)\\/(\\d+)$

Send:
if tonumber("%1") <= (tonumber("%2") / 2) then
  ColourNote("red", "", "<<< ", "yellow", "", "AT HALF EGO", "red", "", " >>>")
end

The changes I made:
trigger regex needed to be changed to properly recognize a players name. That code represents -any- playername. If you're looking for a specific player name you'll need to change it to @ and select "expand variables", then either make sure your variable supports the correct capitalization, or make the search case insensitive.
Changed your body code to properly reflect min and max values. You had "%2" referencing the first digit seen (which, unless I'm wrong, is the current ego not the max)
Changed the body code to add quotation marks around back-references ("%1", "%2")
Changed the code to reflect numbers, not strings, for comparisons.

The spacing that I changed for the body is not required, I just think it's easier to read.

Isuka2009-03-08 08:14:02
QUOTE (Vecanamu @ Mar 7 2009, 11:32 PM) <{POST_SNAPBACK}>
CODE
if %2 <= %1 / 2 then ColourNote("red", "", "<<< ", "yellow", "", "AT HALF EGO", "red", "", " >>>") end

Sorry this is really sloppy...


Also, if you want to, you can make the ColourNote a bit easier to read by seperating it to ColourTells and ending with a Note.
CODE
ColourTell("red", "", "<<< ")
ColourTell("yellow", "", "AT HALF EGO")
ColourTell("red", "", " >>>")
Note("")


That is completely up to you. I think it's a bit easier to debug when I'm doing complex outputs, and I like to standardize my coding practices. What this actually does is store three messages in a buffer, each with it's own color styles, without adding a newline (the difference between Tell and Note). The Note("") at the end prints a newline, and the tells are all output at the first new line seen. Basically the Note("") flushes the output to the screen.
Unknown2009-03-08 08:15:45
I believe the first number is the max. Either way that's easy to change if needed. Thank you.

I also tried to use CInt(%1), is this the same as tonumber()?
Unknown2009-03-08 08:18:23
I just got that from other posts, so I really don't know.

That is good to know though.

Thank you very much!
Isuka2009-03-08 08:19:59
QUOTE (Vecanamu @ Mar 8 2009, 12:15 AM) <{POST_SNAPBACK}>
I believe the first number is the max. Either way that's easy to change if needed. Thank you.

I also tried to use CInt(%1), is this the same as tonumber()?


If i'm not mistaken, CInt is the VB syntax for "Cast to integer", but I could be wrong as I havn't worked with VB in a very long time. I do not believe that Lua supports the Cint function.

tonumber returns a numeric value that the string sent to it represents. This is very useful with MUSHclient, because mushclient treats basically everything as a string, so any time you want to compare numbers you need to use tonumber.

Edit: also, if i'm wrong about the min/max order, just change the values back to what they should be. It's not a skill I actually have, so I just based it off of common sense from the skills I do have.
Unknown2009-03-08 17:43:22


EDIT: never Mind I fiexed it!

auto stance not high enough in rank

Some days i'm just lazy
Isuka2009-03-08 19:18:14
QUOTE (Shadow Aes @ Mar 8 2009, 10:43 AM) <{POST_SNAPBACK}>
EDIT: never Mind I fiexed it!

auto stance not high enough in rank

You don't really need a full traceback for that, either. The first line told you exactly where to look for the problem:
C:\\Program Files\\MUSHclient\\lua\\stance.lua:95 (that's line 95)
You tried to join strings that couldn't, for one reason or another.

Unknown2009-03-08 21:41:55
CODE
^\\| Health \\: (\\d+)\\/(\\d+)(\\s)Endurance \\: (\\d+)\\/(\\d+)(\\s)Power(\\s)\\: (\\d+)p(\\s)\\|(\\n)\\| Mana(\\s)\\: (\\d+)\\/(\\d+)(\\s)Willpower \\: (\\d+)\\/(\\d+)(\\s)Reserves \\: (\\d+)\\%(\\s)\\|(\\n)\\| Ego(\\s)\\: (\\d+)\\/(\\d+)(\\s)Mindset(\\s)\\: (\\w+)(\\s)Esteem(\\s)\\: (\\d+)\\%(\\s)\\|$


I may just be failing to understand what (\\s) does or something, I have no idea, but I am completely at a loss as to why this won't fire. Help?
Isuka2009-03-08 22:24:12
QUOTE (Kyriel @ Mar 8 2009, 02:41 PM) <{POST_SNAPBACK}>
CODE
^\\| Health \\: (\\d+)\\/(\\d+)(\\s)Endurance \\: (\\d+)\\/(\\d+)(\\s)Power(\\s)\\: (\\d+)p(\\s)\\|(\\n)\\| Mana(\\s)\\: (\\d+)\\/(\\d+)(\\s)Willpower \\: (\\d+)\\/(\\d+)(\\s)Reserves \\: (\\d+)\\%(\\s)\\|(\\n)\\| Ego(\\s)\\: (\\d+)\\/(\\d+)(\\s)Mindset(\\s)\\: (\\w+)(\\s)Esteem(\\s)\\: (\\d+)\\%(\\s)\\|$


I may just be failing to understand what (\\s) does or something, I have no idea, but I am completely at a loss as to why this won't fire. Help?


the number of spaces between words and numbers changes depending on how many digits are in the number.
Example:
Health: 5000/5000
Health: 55/5000

To compensate for this, you need to tell the regex function that it should look for any number of spaces, rather than a specific number. "\\s" means "a space". "+" means "one or more of the preceeding character". Thus: "\\s+" means "at least one space, but possibly many."

So, to make sure that
Health: 9999/9999
matches properly, you need to use
Health:\\s+\\d+/\\d+
and of course, you want to capture the values, so it really becomes
Health:\\s+(\\d+)/(\\d+)

You need to apply that lesson across the entire trigger.
Razenth2009-03-09 03:11:42
After logging a file on Mushclient, it disappears from my computer. Mush still recognizes it's there for some reason, but I can't open it or anything. Any ideas?
Unknown2009-03-09 11:02:09
QUOTE (Razenth @ Mar 8 2009, 11:11 PM) <{POST_SNAPBACK}>
After logging a file on Mushclient, it disappears from my computer. Mush still recognizes it's there for some reason, but I can't open it or anything. Any ideas?


What path do you have setup for storing your log files? (I assume you mean logging your session and not some other colloquial definition of "logging a file.") If MUSHclient saves something, and you know where you saved it, there's no reason for you to not be able to open it. Maybe you're opening it in some strange way and your file filter precludes the extension used?
Kante2009-03-09 17:46:35
QUOTE (Oli @ Mar 3 2009, 02:22 PM) <{POST_SNAPBACK}>
My mom was downloading a grand total of about 10gig worth of media. Also, I checked the link in your sig and couldn't find any specifics on how to upgrade. Did I miss anything? Or is it just an automatic update after I DL it?

I would also like the information for this. I extracted the new version to my Treant folder (C:Treant), and I did /treant:Install() but it still loads up as version 1.15.

Any suggestions?
Unknown2009-03-09 21:31:39
QUOTE (Kante @ Mar 9 2009, 01:46 PM) <{POST_SNAPBACK}>
I would also like the information for this. I extracted the new version to my Treant folder (C:Treant), and I did /treant:Install() but it still loads up as version 1.15.

Any suggestions?


I could've sworn I put something in the install text about upgrades, so either you've skipped the documentation or I'm misremembering now (and too lazy to check).

1. Close your world.
2. Put new files in Treant directory.
3. Open your world.
4. /treant:Install()
5. Connect and play.
Ayisdra2009-03-09 23:00:14
Is there a way I could set a macro (or aliase) to set off a set of timers (Demesne effects)
Unknown2009-03-10 01:05:12
I must just fail at regexp or something.

CODE
^\\| Health \\: (\\d+)\\/(\\d+)\\s+Endurance \\: (\\d+)\\/(\\d+)\\s+Power    \\: (\\d+)p\\s+\\|\\n\\| Mana   \\: (\\d+)\\/(\\d+)\\s+Willpower \\: (\\d+)\\/(\\d+)\\s+Reserves \\: (\\d+)\\%\\s\\|\\n\\| Ego    \\: (\\d+)\\/(\\d+)\\s+Mindset   \\: (\\w+)\\s+Esteem   \\: (\\d+)\\%\\s+\\|$


Would someone like to correct this astoundingly evil regex?
Unknown2009-03-10 02:29:59
Ignore this.
Simimi2009-03-10 03:49:02
I can't think of a single use for SQLite in Mush except for as a database for forging numbers, maybe to later display as a miniwindow histogram of statistical output, per item forged. That makes me sad. Anyone want to pitch some ideas, for fun?

Also, considering some theoretical OOP style curing system (I can't seem to envision how that would look yet) would a change to Ruby for scripting be worth it (assuming the code quality is the same Lua to Ruby) for the OOP aspects of Ruby? Would there be a significant (comparatively) speed hit?

Lastly, I may get flames for this but, is there any chance of getting C# into Mush as a scripting language? (Or anyone know of a C# compatible client?) We use it a lot for all of my programming classes and I find it useful, since I have learned a lot with it already anyway.