|
selth Newbie
Joined: 03 Aug 2005 Posts: 5
|
Posted: Wed Mar 07, 2007 9:38 pm
Triggering based on line color |
Okay, I want to do a couple of things with this trigger and I hope you all can help me. I think I can do it with paramaters and conditional triggers and the like, but I'm not sure.
Its a contrived example, but will let me do what I need to do.
Your mental power scry the following room. <-This line is just default text. No color (initial trigger line)
Parade of the Founders south of Founder's Monument. <----- This line is yellow. (14 per zmud)
It is raining lightly, and fat drops of rain fall pleasantly past. A cute little
humgii is sitting here placidly, attached to a leash. A runic totem is planted
solidly in the ground. There are 6 monolith sigils here. Samanthya
Xanatov-Taver, Wild Child is here. She wields a throwing axe in her left hand
and a Shield of Absorption in her right. Tiann Nae'vha is here. She wields a
Druidic quarterstaff in both hands.
You see exits leading north, northeast, south, and northwest. <-End of applicable trigger stuff.
key so I don't have to keep editing:
Bold text = room name, color 14 per zmud
underline text = people names, color 10 per zmud
italic text = what I want to use to stop the gagging/trigger from processing.
So, what I want to do is a couple of things.
First, I want to grab the room name (bolded name in example) which is yellow and store it in a variable.
Second, I want to gag everything but the room name (bold in example) and player names/titles (underline in example) which are bright green. This way, when I scry a room, I'm not overwhelmed with the possibility of there being 500 objects there that I don't want to see.
Is this doable?
I think I have it inflated in my mind past the point where it makes sense and I'm intimidating myself.
ETA : Sorry for repeated edits. I just wanted it to be clear. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Mar 07, 2007 10:44 pm |
This can be considerably more complicated when you consider that IRE games don't always colour the whole line the same colour (and you get those Flying above/in the trees above bits). But the simple way is to copy the text to the clipboard, check the ansi trigger option, and paste the text into the pattern box. The codes should come out.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Mar 09, 2007 7:11 am |
I am going to be very lazy and just paste my main room capturing trigger for Achaea. I adjusted the colors in the config, and the trigger is hugely complicated with some of the wacky parsing it does. With a little bit of tweaking and the use of #GAGON and #GAGOFF you should be able to get only the portions you want displayed. This does not include all the various support and control variables that you can see it use, and as I say I am being lazy and not explaining how things in it work.
Code: |
#REGEX "PrettyCapture" {(?:In the trees above|)(?PrettyCaptured:\033\[31m.*)$} {#IF (%pos("offers with higher prices have not been shown.",%line)) {#STATE PrettyCapture 0} {PlayersPresent=0}} "" {color}
#COND {^(?PCap:.*)} {#IF (@PrettyFinal) {PrettyBak=@PrettyCaptured;PrettyCaptured=%replace(@PrettyCaptured,%concat(%char(27),"[0m "),%concat(%char(27),"[32m"));PrettyCaptured=%replace(%replace(@PrettyCaptured,%char(34),"`"),".`","`.");PrettyCaptured=%replace(%replace(@PrettyCaptured,"!`","`!"),"?`","`?");PrettyCaptured=%replace(%replace(@PrettyCaptured,"____"," ")," "," ");PrettyCaptured=%replace(@PrettyCaptured,%concat(%char(27),"[0m",""),"");#STATE PrettyCapture 0;#T- AwaitingStep;#IF (%regex(@PrettyCaptured,"(\033\[31m.*?\.)",RoomName)=0) {RoomName=""} {PCap=%pos(@RoomName,@PrettyCaptured);#IF (@PCap) {PCap=%copy(@PrettyCaptured,1,%eval(@PCap-1));PrettyCaptured=%remove(@PCap,@PrettyCaptured);#IF (%pos(".",@PCap)) {PCap=%concat(%replace(@PCap,".",%concat(".",%crlf)),%crlf)}};PrettyCaptured=%remove(@RoomName,@PrettyCaptured);#NOOP "[37m Some graffiti has been scrawled [0m[37mhere. It reads, '[1;35mOr a Saltyweenie![0;37m'";#IF (%regex(@PrettyCaptured,"((?:\033\[(?:0;|)37m|)Some ?(?:\033\[(?:0;|)37m|) ?graffiti ?(?:\033\[(?:0;|)37m|) ?has.*?`.*?\033\[(?:0;|)37m`)",PCap)) {PrettyCaptured=%replace(@PrettyCaptured,@PCap,%concat(%char(27),"[35m",%replace(%subchar(%stripansi(@PCap),"!?.",""),"here It","here, it"),"."))};#IF (%regex(@PrettyCaptured,"(\033\[37m ?This ?(\033\[37m)?area ?(\033\[37m)?is ?(\033\[37m)?unnaturally ?(\033\[37m)?flooded ?(\033\[37m)?with ?(\033\[37m)?water\.)",PCap)) {PrettyCaptured=%replace(@PrettyCaptured,@PCap,%concat(%char(27),"[1;33m",%stripansi(@PCap)))};#IF (%regex(@PrettyCaptured,"(\033\[(?:0\;|)37m.*?)(?:\033\[(?:1;|)(?:31|32|33|34|35|36)m|$)",RoomDesc)=0) {RoomDesc=""} {PrettyCaptured=%remove(@RoomDesc,@PrettyCaptured);RoomDesc=%trim(%replace(%subchar(%stripansi(@RoomDesc),%concat(%char(34),"'"),"``")," "," "))};:Room:#CLR;#IF (@RoomName) {#WINDOW Room {%replace(@RoomName,"[3","[1;3")}};#IF (@RoomDesc) {#WINDOW Room {%ansi(white)@RoomDesc}};#IF (@RoomExit) {#WINDOW Room {Obvious exits: %expanddb(@RoomExit," ","=")}};RoomName=%trim(%stripansi(@RoomName))};#IF (@PrettyCaptured) {PrettyCaptured=%trim(%replace(@PrettyCaptured,%concat(%char(27),"[0m"),""));PrettyCaptured=%replace(@PrettyCaptured," "," ");#WHILE (%regex(@PrettyCaptured,"(\033\[\d+(?:\;\d+|)m (?:\033\[\d+(?:\;\d+|)|\a))",PCap)) {PrettyCaptured=%replace(@PrettyCaptured,@PCap,%replace(@PCap," ",""))};#WHILE (%regex(@PrettyCaptured,"(\033\[1\;36m[A-Za-z ,.'-]+?\. (?:She|He))",PCap)) {PrettyCaptured=%replace(@PrettyCaptured,@PCap,%replace(@PCap,". He",", he"));PrettyCaptured=%replace(@PrettyCaptured,@PCap,%replace(@PCap,". She",", she"))};PrettyCaptured=%replace(@PrettyCaptured,".",%concat(".",%crlf));PrettyCaptured=%replace(@PrettyCaptured,"!",%concat("!",%crlf));PrettyCaptured=%replace(@PrettyCaptured,"?",%concat("?",%crlf));PrettyCaptured=%replace(@PrettyCaptured,%concat(%crlf," "),%crlf);PrettyCaptured=%replace(@PrettyCaptured,%concat(%crlf," "),%crlf);#IF (@PrettyCaptured) {#IF (%regex(@PrettyCaptured,"\033\[1;36m")) {PlayersPresent=1};#WINDOW Room {%delete(@PrettyCaptured,%eval(%len(@PrettyCaptured)-1),2)}}};:Room:PerformUpdate;PrettyFinal=0} {#IF ((%match(%line,"You see {a single exit|exits} leading"))|(%match(%trim(%line),"{@DescBlocked}"))|(%match(%line,"There are no obvious exits"))) {PrettyFinal=1;RoomExit="";#IF (%begins(%line,"You see")) {PCap=%subchar(%replace(%word(%line,2,"leading ")," and ","|"),",(). ","|=");#DELITEM PCap {};#ADDKEY RoomExit {@PCap}}} {PrettyCaptured=%concat(@PrettyCaptured,"____",%replace(@PCap,%char(126),""))}}} {looppat|param=99|prompt|notrig|color|regex} |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Mar 09, 2007 3:13 pm |
I feel totally justified in saying "Jesus Christ on a bike".
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Mar 09, 2007 10:10 pm |
That all? After looking at that, I'd believe myself to be justified in making sailors blush (when Zugg introduced the multi-line stuff, I bet his neighbors heard the groan).
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|
|
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
|
|