MUSH problems

by Unknown

Back to Mechanic's Corner.

Unknown2009-04-27 01:47:14
There are a few ways to set a world variable in MUSHclient, such as using scripting and the SetVariable function or just setting a trigger with the option Send to Variable and putting the name in the little variable box. To read the value in a variable, you just check the Expand Variables option and use @varname syntax.
Unknown2009-04-28 06:09:47
Okay, I have variables set up and targetting reflexes that I know work, since it echoes when the target is changed and the variable does indeed reflect that.

However, (the variable is 'ptar') KATA PERFORM @PTAR BLAH BLAH BLAH doesn't work. It just doesn't target the person.

I was sparring Siam just a moment ago, and the variable was set to his name, tried the aliases to perform forms, and... nothing.
Unknown2009-04-28 10:48:30
Select the alias, hit the Copy button, then paste it here inside a code block.
Unknown2009-04-28 10:59:17
You may also make sure the 'Expand Variables' checkbox is checked on the alias.
Unknown2009-04-28 15:26:00
Ahah! Yup, that was the problem. See, I fail. Oh well, thanks for the help. I think, dare I say it, that I might be all set. We'll see.
Unknown2009-04-30 15:26:49
Gah, I hate to ask another question, but how does one use variables in common commands? For example, in Nexus, I could say P $WATERWALK if I had a waterwalk variable set up, and $WATERWALK would become 12345. How does that work in MUSH? Or does it?
Unknown2009-04-30 15:52:35
If you're using it in an alias or trigger, use @waterwalk and make sure to check the Expand Variables option. You cannot use these variables directly from the command line (as far as I'm aware) without running it through the script engine in some form.
Unknown2009-04-30 16:08:07
Darn, that's unfortunate. So, any tips on how to make an alias to probe any various item that I would have set on a variable? Or to refill, for example?
Vhaas2009-05-02 07:23:51
1.) Is possible to change the font in MUSH? If so, how, and will this have a negative impact on Treant (if you happen to know?

2.) More importantly, how do you activate MUSH's spellcheck?
Unknown2009-05-02 11:38:11
QUOTE (Vhaas @ May 2 2009, 03:23 AM) <{POST_SNAPBACK}>
1.) Is possible to change the font in MUSH? If so, how, and will this have a negative impact on Treant (if you happen to know?


World properties (Ctrl+G) -> Appearance -> Output -> Font... button. No negative effect on any scripts whatsoever.

QUOTE (Vhaas @ May 2 2009, 03:23 AM) <{POST_SNAPBACK}>
2.) More importantly, how do you activate MUSH's spellcheck?


I see a "Spellcheck on Send" option under the Input -> Commands properties, but mine's disabled (cannot be selected at all). confused.gif
Unknown2009-05-05 22:15:21
Okay, the alias is-


match="p *"
enabled="y"
expand_variables="y"
sequence="100"
>
probe "%1"




And yes, it is set to expand the variable. Anybody know what's wrong?
Unknown2009-05-06 00:54:49
QUOTE (Ilaveuse @ May 5 2009, 06:15 PM) <{POST_SNAPBACK}>
And yes, it is set to expand the variable. Anybody know what's wrong?


There are no variables in that alias. You just aliased P to send PROBE , which is entirely unnecessary, since the command already does that in the game without the alias. The quotes around the %1 are not needed either.

What exactly are you trying to do?
Unknown2009-05-06 05:12:23
I'm trying to set it up so that I can probe various things to check them based on a variable as opposed to having to root through and find the exact item and its ID number.
Chade2009-05-07 14:18:53
Here's a quick question for you MUSH people.

If I want to capture "pony36065" or "rat123" I can obviously do ^/"(.*?)/" and have it go something along the lines of SetVariable("blah", "%1")

What I want to know how to do is just capture the pony or rat part of "pony36065" or "rat123"

EDIT

Figured it out:

^\\"(.+?)\\d+\\" is the pattern I needed

Second Question:

Does MUSH have an #additem equivalent for adding words to variables?
Unknown2009-05-07 16:09:52
To answer your second question, there is no simple equivalent for #ADDITEM in MUSHclient. I had to implement my own system to make my name highlighting script. So, if you have that, you can use it for reference. Basically, I have a simple table with a list of the strings (numeric keys only) and then I do a table.concat to make my list.
Chade2009-05-07 17:09:06
Heh,

I just went through your code in names.lua and I can honestly say, I haven't got the foggiest idea how to go about replicating that for my own needs.
Unknown2009-05-07 17:20:22
A more general example then! Let's say I want to highlight apples, oranges, and bananas. I need to make a list separated by | (as in a zMUD string list). I start by making a simple "array" table.

CODE
fruits = { "apples", "oranges", "bananas" }


I then concatenate the strings in this table with the | separator to make my string list.

CODE
string_list = table.concat(fruits, "|")


Simple!

What if I later want to add something else?

CODE
table.insert(fruits, "strawberries")
(and then the table.concat again, of course)

Deleting things is a little trickier because there is no pre-defined inverse for table.concat (as far as I've seen), and so I borrowed a PHP explode function from the Lua Recipes page to do that part for me. It just converts the string list back into a table, making the manipulations easier.
Jonas2009-05-15 14:56:07
This is what happened, in a very smooth animated format.

I'm hoping it's as simple and straightforward to fix as it was to make this animation.
Unknown2009-05-15 17:06:48
I've never used the Quick Connect option myself, but it's odd that it closes the connection before you get to do anything. I recommend making a world file and just setting it up from there.