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


Joined: 30 Jul 2001
Posts: 20

PostPosted: Thu Jan 17, 2002 3:57 pm   

trigger help
 
I need help making this trigger. I'd like to capture the room exits from the room description and put them in a variable list. This is what I get from my mud:
You could progress northwards, eastwards,
southwards.

That is just an example but of course there could be linebreaks anywhere between the words. Also there are of course variable amounts of exits from room to room. Any ideas?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jan 18, 2002 1:07 am   
 
I am adding things to strip the "wards" off of each direction for legebility.
Is there a "northeastwards"? If there is then you will have to modify a bunch of this.

#VAR ExitLine {}
#AL CaptureExitLine {
ExitLine=%concat(@ExitLine,%trigger)
#IF (%ends(@ExitLine,".")=0) {
#TEMP {} {CaptureExitLine}
} {
ExitLine=%remove("You could progress ",@ExitLine)
ExitLine=%replace(@ExitLine,"wards,","")
#FORALL @ExitLine {
#IF (%item(@ExitLine,1=%i) {ExitLine=""}
#NOOP You can add other processing here
#ADDITEM ExitLine %trim(%i)
}
}
}
#TR {^You could progress} {
ExitLine=""
CaptureExitLine
}
Reply with quote
dantelestat
Beginner


Joined: 30 Jul 2001
Posts: 20

PostPosted: Fri Jan 18, 2002 3:46 pm   
 
Okay I haven't tested it yet but its really hard for me to follow the logic so I don't know what I will need to modify. Yes there are exits for northeastwards, southeastwards, etc. so what should I do then? Also there's no guarantee that this sentence starts at the beginning of the line does the ^ take care of this? I have no idea.
Reply with quote
dantelestat
Beginner


Joined: 30 Jul 2001
Posts: 20

PostPosted: Fri Jan 18, 2002 4:01 pm   
 
Okay I just tried that solution and it didn't seem to populate the Exitline variable at all so forgive me for being vague here is a complete room description from the mud and please note I only want the room exits so the direction the entrance of the buildings are in makes absolutely no difference to me:

Rue de la Tromaiserie.
You are able to see by the light of the lantern. The Rue de la Tromaiserie
continues to the north-west. To your south is the Great Square in the centre
of southern Paris.
Nearby to your north-east is the entrance of Regfitters. Nearby to your
north-east is the entrance of Boutique des Reves. You could progress
southwards, northwestwards. In your immediate vicinity you see a great
warhorse.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jan 18, 2002 5:26 pm   
 
I don't know if this will work, but give it a try:

#TR {You could progress} {#VAR exits %null;#T+ Exits}
#CLASS Exits
#TR northwards {#ADDITEM exits north}
#TR northeastwards {#ADDITEM exits northeast}
#TR eastwards {#ADDITEM exits east}
#TR southeastwards {#ADDITEM exits southeast}
#TR southwards {#ADDITEM exits south}
#TR southwestwards {#ADDITEM exits southwest}
#TR westwards {#ADDITEM exits west}
#TR northwestwards {#ADDITEM exits northwest}
#TR upwards {#ADDITEM exits up}
#TR downwards {#ADDITEM exits down}
#TR {~.} {#T- Exits}
#CLASS 0


Add/modify directions as needed, but the general principle should work.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Jan 19, 2002 12:15 am   
 
Ah, what I wrote expects the your could progress to be at the start of a line and the . for the end of it to be at the end of the line. Use LightBulb's solution it is much easier.
Reply with quote
dantelestat
Beginner


Joined: 30 Jul 2001
Posts: 20

PostPosted: Sat Jan 19, 2002 9:06 pm   
 
Thank you both for your help. Lightbulb's solution does indeed work with one slight problem. The eastwards and westwards triggers always fire when northeastwards, northwestwards, etc. are encountered. This is because eastwards for example is a substring of northeastwards or southeastwards. Therefore this actually sets off the eastwards or westwards trigger when it should not. I have yet to find a work around for this problem so suggestions are welcome.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Jan 19, 2002 9:27 pm   
 
#TR {northwards} {#ADDITEM exits north}
#TR {northeastwards} {#ADDITEM exits northeast}
#TR { eastwards} {#ADDITEM exits east}
#TR {southeastwards} {#ADDITEM exits southeast}
#TR {southwards} {#ADDITEM exits south}
#TR {southwestwards} {#ADDITEM exits southwest}
#TR { westwards} {#ADDITEM exits west}
#TR {northwestwards} {#ADDITEM exits northwest}
#TR {upwards} {#ADDITEM exits up}
#TR {downwards} {#ADDITEM exits down}

The {}'s are proper form and also let you put a nifty space in front of eastwards and westwards.
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