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
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Sun May 04, 2003 4:02 am   

isolating highlight string varaibles
 


i use


#ALIAS roomobject {#VAR roomobject {%additem( %0, @roomobject)}}
#TRIGGER {{@roomobject}} {#CW 13}
#VAR roomobject {door|stair|step|steps|stairs|gate|arch|shimmering portal|tunnel|path|wall|trail|footpath|bridge|bench|barrel|stairway}

type triggers to highlight things for me , is there a way to isolate the string so that "door" is only highlighted when it is not in another such as the charater "doorjammer" for instance.
I mean whole words and not partials

i have tried
#tr {{~^| }{@roomobject}{.|,| }} {#cw 10} and variations there of but always get syntax error

only one without syntax error
#tr {{~| }{@roomobject}} {#cw 10}
but this doesnt solve the problem

can someone please point me in the right direction


thanks
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun May 04, 2003 9:17 pm   
 
I am guessing these would be found in descriptions. That means they may be anywhere in a line, and you want to make sure they are not part of another word. That can't be done directly by a single trigger pattern, but can be done by script.

#TR {({@roomobject})} {#IF ((%word(%x1,1)=0)|(%copy(%line,%word(%x1,1),1)=" ")) {#IF (%ismember(%copy(%line,%word(%x1,2),1),"|.|,| ")) {#CW 10}}}

Also %0 is not truly valid in your alias, even though is has worked so far you should use %-1.
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Mon May 05, 2003 9:02 am   
 
quote:

I am guessing these would be found in descriptions. That means they may be anywhere in a line, and you want to make sure they are not part of another word. That can't be done directly by a single trigger pattern, but can be done by script.

#TR {({@roomobject})} {#IF ((%word(%x1,1)=0)|(%copy(%line,%word(%x1,1),1)=" ")) {#IF (%ismember(%copy(%line,%word(%x1,2),1),"|.|,| ")) {#CW 10}}}

Also %0 is not truly valid in your alias, even though is has worked so far you should use %-1.






that works sorta but when there are say to cases of a varaibel in the same line such as

You notice a white-robed acolyte, a red-haired elven bard, the Silvercreek disk, a wooden barrel and a darkly stained wooden bench with some stuff on it.

here barrel and bench it shows neither of the highlighted

also if i use this script on other triggers such my my gem highlighter when there is a stone wall , stone being in my gem list and wall being room object niether is higlighted

also can you explain

"Also %0 is not truly valid in your alias, even though is has worked so far you should use %-1."

thanks for your help

nazradin
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 05, 2003 7:00 pm   
 
#CW triggers are different from most triggers. Most triggers are checked for ONE match per line, and if one is found the trigger is processed on that FIRST match. #CW triggers are checked for multiple matches, and EVERY match is processed. That means that it's quite easy to use #CW to color bench and barrel in the same line, but when you want to also PREVENT the coloring of benchseat and waterbarrel it becomes extremely difficult. Just learn to tolerate the doorjammers.

Otherwise, you'll have to kludge something up that involves parsing the entire line which caused the trigger, using a loop to look at every word.

Oh yeah, %0. To paraphrase: %0 is UNDOCUMENTED and UNSUPPORTED. DON'T USE IT! %-1 is both documented and supported. Use it instead.

LightBulb
Advanced Member
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Tue May 06, 2003 9:49 am   
 

thanks as usual for your definative post lightbulb



cheers Nazradin
Reply with quote
Lain
Novice


Joined: 26 Oct 2001
Posts: 38

PostPosted: Tue May 06, 2003 10:37 am   
 
If you don't mind it triggering from a space, comma or fullstop - you could always add them to the words in your roomobject variable. It might solve some occurences but you'd have to put up with: door.

#VAR roomobject {door |door,|door.|step |step,|step.|steps |steps,|steps.|stairs |stairs, |stairs.|gate |gate,|gate.|arch |arch,|arch.|shimmering portal|tunnel |tunnel,|tunnel.|path |path,|path.|wall |wall,|wall.|trail |trail,|trail.|footpath|bridge |bridge,|bridge.|bench |bench, |bench.|barrel |barrel, |barrel.|stairway}

I do not know if there is a way to match the pattern "door." but only colour the "door" part, leaving the full stop out. That would be useful.

Lain
Reply with quote
Lain
Novice


Joined: 26 Oct 2001
Posts: 38

PostPosted: Tue May 06, 2003 11:00 am   
 
Found one possible way:

#TRIGGER {{@roomobject}} {}
#COND {{@roomobjectcol}} {#CW 10} {reparse}

#VAR roomobject {door |door,|door.|step |step,|step.|steps |steps,|steps.|stairs |stairs, |stairs.|gate |gate,|gate.|arch |arch,|arch.|shimmering portal|tunnel |tunnel,|tunnel.|path |path,|path.|wall |wall,|wall.|trail |trail,|trail.|footpath|bridge |bridge,|bridge.|bench |bench, |bench.|barrel |barrel, |barrel.|stairway}

#VAR roomobjectcol {door|stair|step|steps|stairs|gate|arch|shimmering portal|tunnel|path|wall|trail|footpath|bridge|bench|barrel|stairway}

Hope this helps,
Lain
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