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
Jdawg
Newbie


Joined: 17 Jan 2002
Posts: 5
Location: Sweden

PostPosted: Wed Apr 03, 2002 2:13 pm   

#sub help
 
My problem is that when I get a lot of lines with the same message I want to #sub all but the first one, so I know what's going on.
For instance, if I walk into a room and there are four guards with the same description, and they all attack me, it might look like this:
The tall muscular guard attacks you!
The tall muscular guard attacks you!
The tall muscular guard attacks you!
The tall muscular guard attacks you!
Is there a way to keep the first line and #sub the three others?

Thanks!/Jdawg
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Apr 03, 2002 5:30 pm   
 
I havent tried, but maybe you could try something with a multiline trigger like this :

#TR {^(%*)$^(%*)} {#IF (%1=%2) {#SUB %1;#CR;#SUB whatever}}
Reply with quote
heidi
Newbie


Joined: 04 May 2002
Posts: 1

PostPosted: Wed Apr 03, 2002 7:30 pm   
 
First, I'd avoid using the #Sub command for this, this task seems to be built for #Gag. Following is an example I tested that seems to work:

#trigger {^%*$} {#if (%trigger = @Lasttrigger) {#gag}}
#trigger {^*$} {#var LastTrigger %trigger}

Note, the order is important. You wouldn't want to reverse these because then every line would match. Also, I had to use both methods of identifying any text (%* and *) since the triggers couldn't have the same name.

Enjoy,

El_Dickman
Reply with quote
Jdawg
Newbie


Joined: 17 Jan 2002
Posts: 5
Location: Sweden

PostPosted: Wed Apr 03, 2002 10:48 pm   
 
El_****man:
That didn't seem to work for me, it works if only one thing is happening at a time, but it can't react to the right thing when a lot of other triggers are set off at the same time. Is there a way I could change the wildcards to a more specified trigger? for instance {guard attacks you!}

Thanks/Jdawg
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Apr 03, 2002 11:40 pm   
 
Perhaps the simpler route is to let Zmud do all the line tracking for you. This trigger like all full wild triggers eats some preformance.

For all duplicate gagging:
#TR {^%*$} {#IF (%line=%line2) {#GAG}}

For more specific gagging:
#TR {guard attacks you!$} {#IF (%line=%line2) {#GAG}}

Do not use both.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Apr 04, 2002 2:03 am   
 
quote:

Perhaps the simpler route is to let Zmud do all the line tracking for you. This trigger like all full wild triggers eats some preformance.

For all duplicate gagging:
#TR {^%*$} {#IF (%line=%line2) {#GAG}}

For more specific gagging:
#TR {guard attacks you!$} {#IF (%line=%line2) {#GAG}}

Do not use both.





Hmm, seems like he's wanting to make each line reflect WHICH guard/NPC is attacking him--thus his wanting to #sub all subsequent lines but not the first.

#trigger {^(%*)$} {
;check to see if this line is the same as the one before it
#if (%line = %line2) {
#NOOP it is, so increment the counter and determine what to do with this line
#add Count 1
#forall @LinePatterns {
#if ("%1" ~= "^The (*) attacks you!") {#sub {The @Count%case(%right(@Count,1),th,st,nd,rd,th,th,th,th,th,th) %%i attacks you~!}} {#NOOP this line is a new pattern, so do nothing until you can figure out what you want to do}}
} {
#NOOP it isn't, so reset all variables and do other cleanup
Count = 1
}
}

li'l shmoe of Dragon's Gate MUD
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