|
Twit Newbie
Joined: 21 Jul 2002 Posts: 6 Location: USA
|
Posted: Sun Jul 21, 2002 4:56 pm
Using Variables in General |
This may seem to be on the surface a stupid question, but I have been puzzling over how to handle scripting in this newest version of ZMUD. I'm afraid I can no longer figure out how to perform any sort of advanced script, due to not understanding how to store variables anymore. I'm searching for some way to trigger to complex strings, however Zmud seems unwilling to do it. Sample outputs that I would like to perform actions from are as follows:
[Dirk] (OOC), "test text"
Attempting something like #trigger {[*] (OOC), "*"&}{#CAP CHANNELS} which is does not work. I am having trouble discovering why.
I'm attempting to make a script to send channels to a separate window so I don't lose communication in backscroll. However, any attempts to use anything more complicated than a trigger based on the text (OOC) fail. There is almost no documentation (that I can find) with Zmud to actually explain how to use wildcards to conform to the mud output.
My next problem comes about from attempting to capture the mud prompt which states various character attributes. I would like to store them in memory to perform various actions based on how they relate. However, I have yet to figure out how to actually capture the information.
[0/0G|10/10P|10/10]
Have attempted two forms of capturing for this string.
#TRIGGER {[%1|%2|%3]}{@ammo=%1;@phys=%2;@ment=%3}
#TRIGGER {[&ammo|&phys|&ment]}
I would appreciate any suggestions |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Sun Jul 21, 2002 5:14 pm |
You need to use quote character ~ in front of [] and () when are pattern
matching. If you do not [] is interpreted as a pattern matching range and
the items in the () are savedc as a parameter
1)
[Dirk] (OOC), "test text"
#TRIGGER {^~[*~] ~(OOC~)} {#CAP CHANNELS}
So I have put a quote character ~ in front of all the [] and ()
which are part of the mudoutput. I used ^ here to match
from the start of the line and dropped the rest as you are #CAP the entire
thing so it doesn't matter what follows (OOC)
2)
[0/0G|10/10P|10/10]
Same concept but you have to match the pattern exactly.
#TRIGGER {^~[(%d)~/(%d)G~|(%d)~/(%d)P~|(%d)~/(%d)]}
{ammo=%1;phys=%3;ment=%5}
Syntax for variables are: ammo=%1 or #VAR ammo %1
Ton Diening |
|
|
|
Twit Newbie
Joined: 21 Jul 2002 Posts: 6 Location: USA
|
Posted: Sun Jul 21, 2002 6:14 pm |
Thanks, I hadn't realized the purpose of the quote character until now- Though this brings me into one other problem... the #COLOR command- I'm attempting to highlight the line as follows. The %ismember command seems to work, (as I can specify separate actions for the member names) though the coloring does not.
#TRIGGER {^~[(%w)~] ~(OOC~), "(%*)"}
#IF %ismember( %1, @imms) {
#COLOR red
#CAP CHANNELS
#GAG
} {
#CAP CHANNELS
#GAG
}
Thanks again for your help in my earlier problem. It'd been bothering me for quite awhile that I couldn't figure out how to get them to work... |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Jul 22, 2002 12:54 am |
quote:
Thanks, I hadn't realized the purpose of the quote character until now- Though this brings me into one other problem... the #COLOR command- I'm attempting to highlight the line as follows. The %ismember command seems to work, (as I can specify separate actions for the member names) though the coloring does not.
#TRIGGER {^~[(%w)~] ~(OOC~), "(%*)"}
#IF %ismember( %1, @imms) {
#COLOR red
#CAP CHANNELS
#GAG
} {
#CAP CHANNELS
#GAG
}
Thanks again for your help in my earlier problem. It'd been bothering me for quite awhile that I couldn't figure out how to get them to work...
You probably need to surround the #IF condition with parentheses. ZMud is rather picky like that.
li'l shmoe of Dragon's Gate MUD |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Jul 22, 2002 4:20 am |
Triggers (and other settings) usually apply to the window where they are created. In this case, your #COLOR command is in the main window where the line is gagged. It does color the line red, but since the line is gagged you can't see it anyway, so it doesn't really matter what color it is.
What you apparently would like to do is to have the line in red in the CHANNELS window. For that, you'll need a trigger in the CHANNELS window. Put this in the command line and it should make the appropriate trigger. You might need to make @imms a GVARIABLE:
:CHANNELS:#TR {^~[(%w)~] ~(OOC~)} {#IF %ismember( %1, @imms) {#COLOR red}
LightBulb
Senior Member |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Jul 22, 2002 10:23 pm |
quote:
Triggers (and other settings) usually apply to the window where they are created. In this case, your #COLOR command is in the main window where the line is gagged. It does color the line red, but since the line is gagged you can't see it anyway, so it doesn't really matter what color it is.
What you apparently would like to do is to have the line in red in the CHANNELS window. For that, you'll need a trigger in the CHANNELS window. Put this in the command line and it should make the appropriate trigger. You might need to make @imms a GVARIABLE:
:CHANNELS:#TR {^~[(%w)~] ~(OOC~)} {#IF %ismember( %1, @imms) {#COLOR red}
LightBulb
Senior Member
One can accomplish the same thing with ":windowname:text" or "#WINDOW windowname text" without having to create more triggers. Each case will parse the %ansi() function correctly, but only #WINDOW will parse any MXP tags sent.
li'l shmoe of Dragon's Gate MUD |
|
|
|
|
|