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
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun May 19, 2002 12:03 am   

~= patterns containing captured data
 
I'm probably going to have to do things via multiple triggers, but I'd like to try it this way first.

I have a trigger with this pattern:

~[(%*)~]

which matches three sets of bracketed messages as follows:

[3 sec. delay]
[Room name here.]
[ You hear the sound of roosters crowing. ] (there are four messages of this type, two for sunset and two for sunrise)

the above pattern is the only way to capture the room name (not all room names have a period at the end), but of course it'll capture the other two as well. I wish to do two separate things for the extra two messages, but how to do I extract the number from the delay message via ~=?

This is the body of the trigger as I have it thus far:

#IF ("%1" != " You hear the sound of roosters crowing. " and "%1" != " Daybreak. The sun has just risen. " and !%pos( delay, %1)) {
#CW Magenta,bold
#T+ tRoomDesc
} {#IF ("%1" ~= "(%d) sec. delay") {
#SAY yep
delay = %%1
} {#SAY nope}}


The bold part is where I deal with the delay and sun messages. Although the #IF command correctly matches the condition, I'm having trouble extracting the number into the @delay variable so I can work with it in the delay counter. Any tips/suggestions?

li'l shmoe of Dragon's Gate MUD
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun May 19, 2002 2:46 am   
 
quote:

I'm probably going to have to do things via multiple triggers, but I'd like to try it this way first.

I have a trigger with this pattern:

~[(%*)~]

which matches three sets of bracketed messages as follows:

[3 sec. delay]
[Room name here.]
[ You hear the sound of roosters crowing. ] (there are four messages of this type, two for sunset and two for sunrise)

the above pattern is the only way to capture the room name (not all room names have a period at the end), but of course it'll capture the other two as well. I wish to do two separate things for the extra two messages, but how to do I extract the number from the delay message via ~=?

This is the body of the trigger as I have it thus far:

#IF ("%1" != " You hear the sound of roosters crowing. " and "%1" != " Daybreak. The sun has just risen. " and !%pos( delay, %1)) {
#CW Magenta,bold
#T+ tRoomDesc
} {#IF ("%1" ~= "(%d) sec. delay") {
#SAY yep
delay = %%1
} {#SAY nope}}


The bold part is where I deal with the delay and sun messages. Although the #IF command correctly matches the condition, I'm having trouble extracting the number into the @delay variable so I can work with it in the delay counter. Any tips/suggestions?

li'l shmoe of Dragon's Gate MUD



Do it the easy way
#TR {~[(%d) sec. delay~]} {delay = %1}

P.S. You'll note that there wasn't any particular value to me quoting your entire post, since you could have just scrolled back up if you needed to read it again.

LightBulb
Vague questions get vague answers
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun May 19, 2002 4:52 am   
 
I would recommend you continue to use the more general trigger you have now.

You can detect the delay messages with code like this...
#IF (%isnumber(%word("%1",1))) {do stuff} {check for time messages and roomname}
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun May 19, 2002 6:55 am   
 
quote:

I would recommend you continue to use the more general trigger you have now.

You can detect the delay messages with code like this...
#IF (%isnumber(%word("%1",1))) {do stuff} {check for time messages and roomname}



Forgot all about %word()! Now where's that cap at, hmm?

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