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


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Sat Jan 11, 2003 2:19 am   

using %1 %2 %3 and %4
 
I have an alias that I want to capture text. So if I type this
NH looktag lookcolor #666600 You also see
Then it save looktag to %1
lookcolor to %2
#666600 to %3
and You also see to %4

I am using this code

Alias name: NH
Value:
#VAR tagname %1
#VAR colorvar %2
#VAR color %3
#VAR ct %4

The thing is the var CT I want to capture more then just one word. I tried * but it didn't work either. The first %1, %2, %3 worked great but %4 just isn't capturing You also see. How do I fix this
Reply with quote
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Sat Jan 11, 2003 2:30 am   
 
quote:

I have an alias that I want to capture text. So if I type this
NH looktag lookcolor #666600 You also see
Then it save looktag to %1
lookcolor to %2
#666600 to %3
and You also see to %4

I am using this code

Alias name: NH
Value:
#VAR tagname %1
#VAR colorvar %2
#VAR color %3
#VAR ct %4

The thing is the var CT I want to capture more then just one word. I tried * but it didn't work either. The first %1, %2, %3 worked great but %4 just isn't capturing You also see. How do I fix this



NH looktag lookcolor #666600 You also see
%4 should be capturing "You" ....

To capture the whole thing, try:
NH looktag lookcolor #666600 {You also see}
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jan 11, 2003 2:42 am   
 
Or use %-4 instead of %4.

Kjata
Reply with quote
RobMacAF
Apprentice


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Sat Jan 11, 2003 5:41 am   
 
Ok, I am using this code

ALIAS: NH
CODE:
#VAR tagname %1
#VAR colorname %2
#VAR color %3
#VAR @colorname @color
#PROMPT trigname "What do you want to highlight?"

#TRIGGER "@tagname" {@trigname (*)} {#SUBSTITUTE {~<font color=@see~>@trigname %1~</font~>};#IF (!%ends( "%1", ".")) {#STATE @tagname 1}} "" {manual}
#COND "@tagname" {(*)} {#SUBSTITUTE {~<font color=@see~>%1~</font~>};#IF (%ends( "%1", ".")) {#STATE @tagname 0}} {manual}#COND "@tagname" {(*)} {#SUBSTITUTE {~<font color=@see~>%1~</font~>};#IF (%ends( "%1", ".")) {#STATE @tagname 0}} {manual}


But it doesn't seem to work. I get all the info up to the prompt right then something goes terrible wrong.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jan 11, 2003 2:36 pm   
 
Here is your alias:
#ALIAS nh {#VARIABLE tagname %1;#VARIABLE colorname %2;#VARIABLE color %3;#VARIABLE @colorname @color;#PROMPT trigname "What do you want to highlight?";#EXECUTE %concat( "#TRIGGER ", %char( 34), @tagname, %char( 34), " {", @trigname, " (*)} {#SUBSTITUTE {~<font color=@", @colorname, "~>", @trigname, " %%1~</font~>};#IF (!%ends( ", %char( 34), "%%1", %char( 34), ", ", %char( 34), ".", %char( 34), ")) {#STATE ", @tagname, " 1}} ", %char( 34), %char( 34), " {manual}");#EXECUTE %concat( "#CONDITION ", %char( 34), @tagname, %char( 34), " {(*)} {#SUBSTITUTE {~<font color=@", @colorname, "~>%%1~</font~>};#IF (%ends( ", %char( 34), "%%1", %char( 34), ", ", %char( 34), ".", %char( 34), ")) {#STATE ", @tagname, " 0}} {manual}")}

I fixed some errors and changed it to create the triggers using #EXEC. This way, expansion of variables can be controled. Also, the %'s of %1..%n were doubled to prevent zMUD from expanding it in the alias instead of the trigger.

Kjata
Reply with quote
RobMacAF
Apprentice


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Sat Jan 11, 2003 3:01 pm   
 
It worked good but it turned all of my text yellow as well and I can't seem to change it back to the default color.
Reply with quote
RobMacAF
Apprentice


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Sat Jan 11, 2003 3:14 pm   
 
Got it! Just restarted ZMud and it fixed itself. Works great though. I already have about 20 things highlighting
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