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
Nyojin
Beginner


Joined: 05 Nov 2005
Posts: 18

PostPosted: Sat Dec 10, 2005 6:52 pm   

Simple highlight script gone wrong
 
Could anyone point out to me where the flaw(s) is in this?

Code:

#CLASS {Highlights}
#ALIAS adb {#add %1 @buddies}
#VAR buddies {}
#TRIGGER {@buddies} {#cw pink}
#CLASS 0


Thanks!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Dec 10, 2005 8:58 pm   
 
#CLASS {Highlights}
#ALIAS adb {#ADDITEM buddies "%1"}
#VAR buddies {}
#TRIGGER {{@buddies}} {#cw pink}
#CLASS 0
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Nyojin
Beginner


Joined: 05 Nov 2005
Posts: 18

PostPosted: Sun Dec 11, 2005 11:26 am   
 
Thanks! I forgot it was additem and not add.
Reply with quote
Theragil
Apprentice


Joined: 13 Feb 2004
Posts: 157
Location: USA

PostPosted: Sun Dec 11, 2005 1:40 pm   
 
Might also want to make the trigger on {%q{@buddies}%q} to reduce false hits.
Reply with quote
int21h
Newbie


Joined: 12 Dec 2005
Posts: 2

PostPosted: Mon Dec 12, 2005 4:25 pm   
 
I have a quick question related to this... what if instead of changing the color of the pattern or highlighting it I wanted to append text to the line that the text had happened on.

For instance if the pattern was

John the Male Dwarf

and I wanted to make it so that I saw:

John the Male Dwarf [Friend]

Somehow I need to capture the entire line and append text to the end. I was trying to do something like:

#TRIGGER {%q{@friends}%q(%*)} {#sub {%1 %2 ~[Friend~]}}

but that doesn't really work. I've had other derivatives of the solution working but then weird things would happen, for instance if I had a name in the list called Tow, and I saw a tower in a room description, it would fire the trigger. Its my understanding that the %q might help?
Reply with quote
Theragil
Apprentice


Joined: 13 Feb 2004
Posts: 157
Location: USA

PostPosted: Mon Dec 12, 2005 4:47 pm   
 
The %q will make it so it only matches that as a word; %q matches a space, punctuation, or beginning or end of line. Making it case-sensitive can also help.
Reply with quote
int21h
Newbie


Joined: 12 Dec 2005
Posts: 2

PostPosted: Mon Dec 12, 2005 6:43 pm   
 
Well I'm trying to match 4 main cases...

Lord George
Lord George, The King of All
George
George, Lord of All

and not match the cases of

George's
George.

I tried with something like this:
#trigger {(%*)({@buddies}){@specialChars}(%*)} {#sub {%1 %2 %3 ~[Friend~]}}

where buddies is {George|John} and specialChars is {,| } but this doesn't match all of the cases, most notably a case where you have just the buddy's name without anything trailing.

Any hints?

Eventually I'd like to do something similar with spell effects too, like:

George is blinded! [F2 to cure]

that case is a little easier to tackle than this highlighting case though.
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Tue Dec 13, 2005 6:05 am   
 
untested - can't remember if the #SUB parameters need quotes, like "%1", etc.

#TR {(*)({@buddies}){| |,}(*)} {#SUB {%1 %2 %3 [Friend]}}
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
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