Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
dark75rose
Beginner


Joined: 30 Jul 2002
Posts: 25
Location: USA

PostPosted: Wed Mar 31, 2004 11:19 am   

help with trigger that goes off based on ansi
 
I read the past posts on how to make a simple ansi trigger, and that's all I'm trying to do. I have Zmud version 7.04 and Windows XP. I copied using Ctrl C from the mud output window, opened a new trigger, clicked ansi trigger check in options, in pattern pasted the pattern. It does show some symbols in there for color, I added a value, but it doesn't seem to do anything. If I make it a regular trigger without color it works. I checked my special characters and the % is marked as a paramater char and is marked. The other colors used in the code: %e[1;36m were not selected under special characters at all.

The goal is to get this practice trigger working so I can apply the technique to future triggers. Also, does it pay attention to the color AND the words, or just the color? Because I'd like it to know the difference between Darkrose falls over in bold cyan, versus Darkrose takes a sip of soda which might also be in cyan in another trigger. Thanks in advance for the help.

Current Pattern: %e[1;36mDarkrose falls over
Current Value: say testing ansi trigger
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Mar 31, 2004 7:33 pm   
 
Your pattern works for me. However, it does only work for bold,cyan.

You may be getting hi,cyan which looks like the same color with default prefs.
Pattern: %e[56mDarkrose falls over
Value: say This is hi,cyan not bold,cyan.
Reply with quote
dark75rose
Beginner


Joined: 30 Jul 2002
Posts: 25
Location: USA

PostPosted: Thu Apr 01, 2004 6:49 am   
 
Hmm. I do not have default color prefs, I changed probably all of the colors in there a little bit. But if I changed what bright/bold cyan looks like in my prefs, then when the mud sends me something in that color, wouldn't it have that new color code when i copy? Or are you saying I have to use default colors for this to work? Thanks,

Darkrose

quote:
Originally posted by LightBulb

Your pattern works for me. However, it does only work for bold,cyan.

You may be getting hi,cyan which looks like the same color with default prefs.
Pattern: %e[56mDarkrose falls over
Value: say This is hi,cyan not bold,cyan.

Reply with quote
dark75rose
Beginner


Joined: 30 Jul 2002
Posts: 25
Location: USA

PostPosted: Thu Apr 01, 2004 8:02 am   
 
Also, one update.
I tried another testing trigger using regular cyan, and it works if the newline trigger box is checked and if i remove the %e[
so it looks like this:
Pattern: 36mYou mindspeak, "test"
Value: say testing

The problem is that the triggers I want to eventually do are in the brighter colors, not just cyan. I'm not sure how to tell if I'm using or being sent bold or hi colors, and how to make it work with one or the other. Thanks,
Darkrose
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Apr 01, 2004 4:56 pm   
 
The specific preference I was referring to is Bold Mapping. By default, it's mapped to Highlight Color. I don't know what effect, if any, changing the color mapping would have. It would probably be worthwhile to return your colors to the defaults to see if that makes a difference.

Your triggers must have either Newline or Prompt selected in order to work, since these two options control when the trigger is tested. If neither is selected, the trigger is never tested and therefore never works.

Pasting should automatically provide whatever codes are needed. I just took a guess at one possible problem you might be having. It doesn't mean you ARE having it.
Reply with quote
dark75rose
Beginner


Joined: 30 Jul 2002
Posts: 25
Location: USA

PostPosted: Thu Apr 01, 2004 9:19 pm   
 
I restored my default.col file after saving my current settings.
The trigger again works with regular colors but not the brighter.
(Whether that's bold or hi i do not know.) It seems to me the only difference between them is a 1; before the color code when it's brighter, so I don't understand why it doesn't work. Any further suggestions? Thanks,
Darkrose
Reply with quote
Amylon
Novice


Joined: 31 Jan 2003
Posts: 49
Location: Australia

PostPosted: Thu Apr 29, 2004 5:35 am   
 
Ok still on this ansi thing how about this?
I get a line from the mud that reads like this:
The mighty green test man[lightblue] Harry[/lightblue] Woodberry, Worlock

Now can a trigger be built that will capture the name harry into the variable called target if the Name Harry is a member of a variable called allies?

e.g.
#var allies contains Harry|Jane|Mark|Woody
My trigger is this but it doesnt seem to work
#tr {%e[30m(%w)} {#IF %1=%ismember(@allies)} {target=%1;#ECHO New target is @target} {}

Any ideas?
p.s. %e[30m is the code for lightblue according to the ALT-V paste in.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Apr 29, 2004 2:24 pm   
 
Syntax: #TR [id] pattern command [classname] [options]

#tr {%e[30m(%w)} {#IF %1=%ismember(@allies)} {target=%1;#ECHO New target is @target} {}

As you can see, based on the grouping you assigned with {}, the blue section is your trigger pattern, the green section is the commands, the red section is the trigger's class, and the brown is the trigger options. This is clearly not what you intended, nonetheless it's what you did. You cannot ignore proper syntax and expect to achieve the intended results.

You've also gotten the syntax for %ismember and #IF wrong.
#IF uses a condition enclosed in parentheses (), followed by commands for condition is true enclosed in brackets {}, and optionally another set of commands for condition is false enclosed in another set of brackets. Your condition is not enclosed in anything. It has a space on the left and a bracket on the right.

%ismember requires two parameters, first the item to be checked and then the list to look for it in, separated by a comma. You only have the list and have moved the item outside the function. That won't work.

Please don't take offense at this. I realize you aren't deliberately ignoring the proper syntax but just don't know what it is. I'm trying to emphasize how important it is. If you aren't familiar with a command or function, look it up and get the correct syntax.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Apr 29, 2004 2:52 pm   
 
A version which might work (at least it follows the correct syntax):
#TR {%e[30m(%w)} {#IF (%ismember( %1, @allies)) {target = %1;#ECHO New target is @target}} {} {color}

EDIT: Changed option from "ansi" to "color"

P.S. Mathian:
It's just as easy to paste scripts which don't use [code] and
[/code], and they are much easier to read since there is no
need to scroll the screen sideways. You've made this topic
approximately four screens wide on my monitor, which means many won't
bother reading simply because it's not convenient to scroll back and
forth on every line. I'd appreciate it if you removed the line
causing this effect.
Reply with quote
Mathian
Newbie


Joined: 30 Apr 2004
Posts: 9
Location: Australia

PostPosted: Fri Apr 30, 2004 4:41 am   
 
I have been trying to do what you are doing Amylon. I have had marginal success using the trigger below. I am guessing that like me you are using it for achaea?

#TR {%e[1;37m(*)%e[0;30m(%w)%e[1;37m(*)} {#IF (@FFTS=0) {#IF %proper( %ismember( %2, @ffalist)) {#VAR ffatarg %2;#ECHO New target is @ffatarg;FFTS=1} {#echo Failed}}} "Color_triggers" {color}

Edited: Sorry Amylon but the above Trigger seems to only work occasionally anyway so I would suggest you look for a different way to do what you want. Ansi triggers seem to only work sometimes at best. The one thing I have found is that if the whole line conforms to the ansi code then it almost always fires but this is really of very little use in the situation I am using which is that I have enemies tagged a color. e.g.

Downy Druid Delphinus Windancer, the Tsol'aatavian

I am guessing you use the same thing after looking over your post. So what your really trying to do is read a line and if it contains a name from your hitlist string you want it to target that player?
Achaea as always is infuriating to make triggers for. If you come up with a way to do it Amylon post it here because I will be super interested. I am sure it can be done with Ansi but I just haven't hit the magic formula to make them work always. (OH also the FTTS in the above is just so that if 2 enemies walk in one behind the other it will capture the first enemy to @ffatarget and leave the other out)

Perhaps the trigger I wrote above will work if you can see where the bugs are in it.

Good luck to you!
Reply with quote
Amylon
Novice


Joined: 31 Jan 2003
Posts: 49
Location: Australia

PostPosted: Sat May 01, 2004 4:14 am   
 
Dont quote me on this but I am almost 100% sure I just found the problem!
The problem is that zmud reads the line prior to applying the #cw trigger that colors the word.
I tested this like this: I made a ansi trigger to catch on blue.

#TRIGGER {%e[34m(%w)} {#var target %2;#ECHO @target} "" {color}

This worked fine. Now the line was Dirty mucky pathway.
Doing this it captures Dirty into the variable target.
Now in Config color in Achaea I have room titles set to 4 which is blue.
Now I created this trigger which changes the word Dirty to red.

#cw {Dirty} {red}

Say and here is the kicker, the line now looks like this:
Dirty mucky pathway
and guess what? The trigger still fires!

So if this is true then ansi triggering off a word with color changed using #cw will never work unless you can get it to read it after the color is applied.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat May 01, 2004 4:38 am   
 
Ansi Triggers rely on the ansi codes sent from the mud. Using #CW/#CO/#HI does not change those codes at all.

I believe Mud recieves:
blue Line with ansi codes in it
THEN zmud parses that line with triggers #CW blue red
Blueline with ansi codes in it
So the Line is STILL Blue just the trigger changed the color of the word but not the original.
Reply with quote
Amylon
Novice


Joined: 31 Jan 2003
Posts: 49
Location: Australia

PostPosted: Sat May 01, 2004 5:23 am   
 
Ok then if thats how it works any ideas how to capture a name out of a line of text?
Lets say the name of a person is Jack but he is prefixed with "The Almighty hollow one" and is suffixed with "the walrus chaser".
So you get this from the mud:
The almighty hollow one Jack the walrus chaser.

Now Jack is a member of the stringlist called @ffalist, what we want zmud to do is read each line that is white and see if it contains any name in this list and if so we want it to set that name to @ffatarget.

We also know that the line that will contain names from the stringlist will be white.

Any ideas?
Reply with quote
Mathian
Newbie


Joined: 30 Apr 2004
Posts: 9
Location: Australia

PostPosted: Sat May 01, 2004 4:06 pm   
 
Ok if Ansi wont work how about #MXP triggers? I am not on my zmud client at the moment but
say I create this:

#VAR hitlist Zugg

#TRIGGER { Zugg} {#SUB {~<color red>Zugg~</color red>}}

#TRIGGER {~<color red>{%w}~</color red>} {#IF (%ismember( %1, @hitlist)) {ffatarget=%1;#echo set} {#echo not working}} "" {mxp}

If I receive the line:
The almighty hollow one Jack the walrus chaser.
It seems to make sense that the first trigger would change Jack to red and the second one would then notice this and capture the value in red to the @FFATARGET variable?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat May 01, 2004 5:55 pm   
 
Just put the stringlist in your pattern like everyone else does.
#TR {%q({@hitlist})%q} {ffatarget = %1;#ECHO set}
Reply with quote
Mathian
Newbie


Joined: 30 Apr 2004
Posts: 9
Location: Australia

PostPosted: Sat May 01, 2004 6:25 pm   
 
That doesn't work. But it gave me an idea and so i did this and it works fine. Thanks Lightbulb I cant believe how easy it was once you pointed me in the right direction. All that complex rubbish and it can be solved so easily.

#tr {(*)({@hitlist})(*)} {#var ffatarget %1;#echo set}

Then I made it so it would fire everytime by making it like below:

#tr {(*)({@hitlist})(*)} {#IF (@FFTS=0) {#var ffatarget %1;#echo set;FFTS=1}}

Now I set up another trigger:

#TR {(*) has been slain in the arena} {#deli hitlist %1;@FFTS=0}

THANKS
Reply with quote
Amylon
Novice


Joined: 31 Jan 2003
Posts: 49
Location: Australia

PostPosted: Wed Jun 23, 2004 11:45 am   
 
After chucking it at the wall for a month I have come back to trying this again.
That doesn't work as far as I can see Mathian, I think you just got lucky and it fired once or twice?
It cant be that hard but I am stuffed if I can get it to work. Its such a simple capture, just parse a line that is color "X" and if that line contains a member of @hitlist make variable @target that member. It cant be that hard but not a single method on this page works successfully.

[blue]Anyone want to have a go at it?
Ok here is what we have:
1.) The line containing the target is always colored %e[1;37

2.) The name that needs to be captured can be anywhere within the line. (see examples at bottom)

3.) The trigger is kept targetted by use of a on/off variable that is activated by the @target variable being filled. (see FFTS in above posts)

4.) I have thought about it and think that perhaps a #T- activated on target being filled may be more effecient than FFTS system.

I hate to just dump it here without being able to give you all a place to start but this has just got me bent over a barrel.

Examples:
#VAR HITLIST {Ansuzi|Schisstae|Hideyoshi|Sylence|Wallace|etc}
K'Wee-Myrmidon Zonko Longshanks, Demon Novice Aide
Caretaker Jellie Lionblaze, Initiate of Honour
Neonate of Chivalry, Eiku Ninquelote-Xanatov
Maldaathi Luggs Drakor, Squire of Xenomorph
Valiant Umgarla
Kodrom Wallace, Faithful of Light
Takezo Sylence Ikari
Sentaari East Wind Hideyoshi, Smiling Sound of Silence
Lady Schisstae Lighthawk, Nymph of Bitterflow
Acolyte Ansuz

Thank you in Advance to anyone that helps me with this :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jun 23, 2004 4:18 pm   
 
The color must come from the MUD, not from other triggers. It must be the color of the first character in the line, not the first character in the pattern.

#TR {({@hitlist})} {#IF (@ffts = 0) {#VAR ffatarget {%1};#VAR ffts 1}} {} {line=15}

This trigger could probably be improved by using %q to mark word boundaries. However, I already suggested such a trigger and got the response, "That doesn't work", so I won't bother repeating it.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net