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


Joined: 22 Dec 2002
Posts: 13
Location: USA

PostPosted: Sat Jun 28, 2003 8:05 am   

pulling color from triggers?
 
Ok, is it possible to pull color from a triggered line? I know it is possible to trigger off color but thats not really what I'm wanting to do. For example:

+* A Human *+, +* A Large Rakshasa *+ and +* A Wild-Elf *+ and are a long ways off east from here.

I want to be able to make a trigger that will capture both the race and color and size of each and put them in a string/var like "Red Human, Large Green Rakshasa, and Purple Wild-Elf"

another example:

+* A Huge Illithid *+, +* A Tall Lich *+, +* A Tall Cave-Troll *+, +* A Lich *+ and +* A Tall Cave-Troll *+ are a long ways off south from here.

and the resulting string I would like to be like: "Huge Orange Illithid, Tall Green Lich, Tall Green Cave-Troll, Orange Lich, and Tall Brown Cave-Troll"


If someone could help me form a trigger(s) to gather this info, it would be much appreciated. Thanks.
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sat Jun 28, 2003 9:46 am   
 
ummmmm
*racks his brain*
as far as i know (i'm not authoritative) you are looking at alot of trouble for yourself.
best bet might be to make a color trigger for each possible creature. i.e. a trigger for green humans, a trigger for purple humans, etc.

Another option might be reparse state triggers. trigger the first state on the key phrase for the line "and are a long ways off east from here" or whatever. the reparse it lots of times looking for specific colors and capturing the text there.

i know these are vague ideas, um, i'm just a little bit tired and thought i would throw these thoughts out there on the off chance that they are useful.

more likely someone else here has a better idea (lightbulb ? Smile)

the easiest way would probably be a plugin, so you could have a very straight look at the ansi codes as they come in.

but if there was a different way to get the same information (other than relying on colors) you would be alot better off.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Jun 28, 2003 5:32 pm   
 
It is possible, but would depend on whether your mud is using MXP or ansi to color the mobs. I will write an ansi sample...

#CLASS {testscan}
#ALIAS test {#SHOW %ansi(white)+* %ansi(red)A Human%ansi(white) *+, +* %ansi(green)A Large Rakshasa %ansi(white)*+ and +* %ansi(magenta)A Wild-Elf%ansi(white) *+ are a long ways off east from here.}
#ALIAS CleanMobScan {#VAR %1 %replace(@{%1},"A ","");#VAR %1 %replace(@{%1},%ansi(green),"Green ");#VAR %1 %replace(@{%1},@ShortAnsi(red),"Red ");#VAR %1 %replace(@{%1},@ShortAnsi(magenta),"Purple ");#VAR %1 %replace(@{%1},@ShortAnsi(white),"")}
#VAR scaneast { Red Human , Green Large Rakshasa , Purple Wild-Elf }
#VAR ShortAnsi {%concat(%char(27),"[",%word(%ansi(%1),2,";"),"m")}
#TRIGGER "MobCap" {are a long ways off (%w) from here.} {#VAR scan%1 %replace(%line,"and",",");#STATE MobCap %numwords(scan%1,",")} "" {color}
#COND {+~*(*)~*+} {#VAR scan%t1 "%1";#STATE MobScan 0;CleanMobScan scan%t1} {reparse|color}
#COND {+~*(*)~*+ and +~*(*)~*+} {#VAR scan%t1 {"%1", "%2"};#STATE MobScan 0;CleanMobScan scan%t1} {reparse|color}
#COND {+~*(*)~*+, +~*(*)~*+ and +~*(*)~*+} {#VAR scan%t1 {"%1", "%2", "%3"};#STATE MobScan 0;CleanMobScan scan%t1} {reparse|color}
#CLASS 0

This trigger set expects that default color is green. In the CleanMobScan alias which ever is your default color goes into the one that is just %ansi, all other colors have to go in @ShortAnsi references. I only included those colors and only made enough ReParse states that were needed for testing. You can add the rest. I assumed the non-mob name text in the line was colored white, if that is not the case adjust that as well.
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sat Jun 28, 2003 6:58 pm   
 
neat vijilante Very Happy
what does this do?
quote:

#STATE MobScan 0;

Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jun 29, 2003 9:57 am   
 
Resets the trigger, so only the correct reparse condition, as calculated in the 0 state, is tested. Its probably not necessary, but I like code that protects itself from errors.

Ooops...too many hours spent reading the windows api. Thanks Lightbulb.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Jun 29, 2003 1:16 pm   
 
It's probably a typo -- should be:
#STATE MobCap 0
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