Mushclient Questions

by Esano

Back to Mechanic's Corner.

Unknown2009-04-12 21:36:02
QUOTE (Isuka @ Apr 12 2009, 12:56 PM) <{POST_SNAPBACK}>
Anyone know if there's a way to grab the wrap-width value (MUSH's, not Lusternia's) within mushclient? I use algoritms to determine center of screen, and it'd be handy not to have to hard-code that.


CODE
GetOption("wrap_column")
Isuka2009-04-12 23:59:17
Thanks Zarquan.
Unknown2009-04-18 03:56:37
Hi I was just wondering if anyone would be able to tell me what's wrong with this trigger:

CODE
^(\\d+)h\\, (\\d+)\\m\\, (\\d+)e\\, (\\d+)p\\, (\\d+)en\\, (\\d+)w(?:\\, \\d+mo)? (.*?\\-)$

CODE
If @spit == 1 and @spitbalance == 1 and not affs:has("paralysis") and not affs:has("stunned") then
SetVariable("spitbalance", 0.5)
Send("spit @target")
Send("spit")
End


And this is the error I get:
QUOTE
Compile error
World: Treant
Immediate execution
:1: '=' expected near '0'

Unknown2009-04-18 04:03:06
I assume that you have expand variables set? By the way, it's better to hit the Copy button when the trigger is selected and the paste the XML in your post, so we can see the options you have set and even copy/paste the trigger to test out for ourselves.
Unknown2009-04-18 04:05:40

enabled="y"
expand_variables="y"
group="SPIT"
match="^(\\d+)h\\, (\\d+)\\m\\, (\\d+)e\\, (\\d+)p\\, (\\d+)en\\, (\\d+)w(?:\\, \\d+mo)? (.*?\\-)$"
name="SPIT"
regexp="y"
send_to="12"
sequence="9000"
>
If @spit == 1 and @spitbalance == 1 and not affs:has("paralysis") and not affs:has("stunned") then
SetVariable("spitbalance", "0.5")
Send("spit @target")
Send("spit")
End





Sorry, I hope that's clearer
Unknown2009-04-18 10:50:43
I should've seen this before, but it was made a lot easier with being able to test your trigger... Don't capitalize language keywords like "if" and "end." smile.gif
Unknown2009-04-18 12:01:18
QUOTE (Zarquan @ Apr 18 2009, 08:50 PM) <{POST_SNAPBACK}>
I should've seen this before, but it was made a lot easier with being able to test your trigger... Don't capitalize language keywords like "if" and "end." smile.gif


That fixed it!

Thank you so much!
Kante2009-04-18 13:50:51
QUOTE (Evaine @ Apr 18 2009, 12:05 AM) <{POST_SNAPBACK}>

enabled="y"
expand_variables="y"
group="SPIT"
match="^(\\d+)h\\, (\\d+)\\m\\, (\\d+)e\\, (\\d+)p\\, (\\d+)en\\, (\\d+)w(?:\\, \\d+mo)? (.*?\\-)$"
name="SPIT"
regexp="y"
send_to="12"
sequence="9000"
>
If @spit == 1 and @spitbalance == 1 and not affs:has("paralysis") and not affs:has("stunned") then
SetVariable("spitbalance", "0.5")
Send("spit @target")
Send("spit")
End





Sorry, I hope that's clearer

I recently started doing all my aliases and triggers in notepad using the same format you would get if you copied an alias from MUSH and pasted it into the wordpad.

Now, sorry if this is a stupid question, but is this any specific language, or is it essentially MUSHclient's own in-client language?
Unknown2009-04-18 14:21:10
QUOTE (Kante @ Apr 18 2009, 11:50 PM) <{POST_SNAPBACK}>
I recently started doing all my aliases and triggers in notepad using the same format you would get if you copied an alias from MUSH and pasted it into the wordpad.

Now, sorry if this is a stupid question, but is this any specific language, or is it essentially MUSHclient's own in-client language?


It's LUA. I think...
Kante2009-04-18 14:24:16
QUOTE (Evaine @ Apr 18 2009, 10:21 AM) <{POST_SNAPBACK}>
It's LUA. I think...

Then I feel accomplished with myself. I don't know a lot, but I'm learning ever so slowly! biggrin.gif
Razenth2009-04-18 19:07:30
Not Lua, XML.
Isuka2009-04-18 20:43:25
The trigger format is XML,
the scripting language is Lua.

Also, it's "Lua", not "LUA", because Lua is not an acronym, it's a word.
Kharne2009-04-19 01:21:35
How would i set up my demsne effects so i would cast one every ten seconds?
Alef2009-04-21 13:54:48
I used "DoAfter" for that.

CODE
    Send ("forestcast murder demesne")
    DoAfter (10, "forestcast spores demesne")
    DoAfter (20, "forestcast pollen demesne")
    DoAfter (30, "forestcast treelife demesne")
    DoAfter (40, "forestcast thorns demesne")
    DoAfter (50, "forestcast spiders demesne")
    DoAfter (60, "forestcast swarm demesne")
    DoAfter (70, "forestcast storm demesne")


That was the actual alias I used when I was in the Blacktalon.
Kante2009-04-21 16:16:37
If I were you, I'd talk to Nyir. She gave me her demesne triggers and timers, and it worked damn well, at that.
Unknown2009-04-23 12:25:40
I wanna ask, is Python and Lua the same? O.o or are they different? I'm learning python at school now. biggrin.gif
Vhaas2009-04-23 13:39:43
Alright...

I was doing some questing this morning, and after a couple long hours of searching for an item that probably doesn't exist I made it to the part where Catarin's system breaks.

Tired of CMUD and its general dysfunction, I was considering switching over to Treant or Ethelon's system for MUSH. Aside from finding that client more than a little cluttered and inconvenient for my non-combat activities, I have little to know knowledge of LUA, but what I learned from Zarquan's tutorial when I began playing.

What I at least need to be able to do before I consider using MUSH seriously is:


- Group aliases, triggers, etc.
- Highlight text and echo
- Understand the LUA equivalent of #IF statements
- Understand to nest variables
- Undertsand the LUA equivalent of WA (wait) function equivalent

I may be naive in thinking that LUA would work along such similar lines. I will be thankful for any help.

Thank you.
Unknown2009-04-23 14:30:28
I can tell you how to do anything you want to do, but it really helps to have concrete examples from which to start. If you say, "I want to highlight the name 'Trader Bob,'" then I can show you a trigger to do just that. If you say, "I want to put up my defenses efficiently," I can tell you to avoid the wait functions. smile.gif

What I recommend you do, however, for general learning is to look at available code, such as in Treant (or Nezha's system, if it's still available and you want a different take on things), and that you also read the documentation on the Lua site. Lua is a powerful, but simple, language. It's very well documented outside of MUSHclient, and that's where you can learn about the general syntax of the language before you apply it to MUSHclient functionality. The forums on Nick's MUSHclient web site are also immensely helpful. Nick posts a TON of examples on how to do a wide variety of things and his explanations are great for beginners and experts alike.
Vhaas2009-05-01 06:56:36
QUOTE (Zarquan @ Apr 23 2009, 06:30 AM) <{POST_SNAPBACK}>
I can tell you how to do anything you want to do, but it really helps to have concrete examples from which to start. If you say, "I want to highlight the name 'Trader Bob,'" then I can show you a trigger to do just that. If you say, "I want to put up my defenses efficiently," I can tell you to avoid the wait functions. smile.gif

What I recommend you do, however, for general learning is to look at available code, such as in Treant (or Nezha's system, if it's still available and you want a different take on things), and that you also read the documentation on the Lua site. Lua is a powerful, but simple, language. It's very well documented outside of MUSHclient, and that's where you can learn about the general syntax of the language before you apply it to MUSHclient functionality. The forums on Nick's MUSHclient web site are also immensely helpful. Nick posts a TON of examples on how to do a wide variety of things and his explanations are great for beginners and experts alike.



- What I must learn to do first is nest variables using triggers and aliases.

I.e.:
alias 'job' = #IF (@task=1) {doit, @task=2}, #IF @task=2) {dothat. @task=3}

and #IF (@task=1) {doit, ADD 1}

The MUSH equivalent of processes for this are fundamental for my scripting anything, from auto-scripts to an offense system. If I cannot learn to do this on my own, MUSH is not viable for me.

- Folders. Does MUSH have a folder or group & search option? I began playing with treant and hated that my emote aliases were right beside my battle aliases, and smack in the middle of everything else.

- If there is a #WA-esque command, that would make my life easier- not for defenses, but little things here and there. I use them like concrete putty and sewing patches, to hold small things together.
Isuka2009-05-01 07:24:55
if you use lua as your scripting language, conditionally programming becomes very easy. It takes the form of this:
CODE
if somecondition then
  some code
elseif some other condition then some other code
else failsafe code. Both elseif and else are optional
end

You can use lua variables, which exist solely for lua to see and use, simply by setting them
CODE
variable = value

and referencing them by name without need for a qualifier ("@" in xmud)
Or, you can use MUSH's variables through call functions
CODE
GetVariable("variablename")
SetVariable("variablename",value)
DeleteVariable("variablename")

you should note that GetVariable -always- returns a string, even if the value looks numeric. You can use tonumber(string) to convert it to a number for evaluation.

Also, assuming that WA is a wait function as I remember it to be, you can use DoAfter or DoAfterSpecial, which are both MUSH specific functions.

Edit: I didn't realize that code tags negate forumcode, but I'm going to leave the tags in there to emphasize what's important anyways.