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
itsmarty
Novice


Joined: 29 Jan 2002
Posts: 37
Location: USA

PostPosted: Mon Feb 25, 2002 3:38 am   

matching multiple lines
 
I'm trying to create variables for what's in my hands, but the information line wraps and my trigger doesn't see it.

>glance
You glance down to see a broadsword in your right hand and an ordinary shield
in your left hand.

#TR {(%w) in your right hand} {#VAR rhand %1}
#TR {(%w) in your left hand} {#VAR lhand %1}

The signficant word is always the one right before 'in your', so I get broadsword for rhand but not shield for lhand because of the line splitting near the end. Any help would be appreciated.

Thanks,
Martin

(almost forgot...which variable holds the second to last command you typed? If I entered the commands

look
exp
health

I'd like alt-enter to return 'exp'. I can't seem to narrow that down. Thanks!)
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Feb 25, 2002 4:00 am   
 
1) I'd do it with two triggers and unfortunately I'd go with a %* pattern.
I added right|left for the nasty lp muds that switch them on you now and then.

#TR {^You glance down to see (%*) in your ({left|right}) hand and (%*) in your ({left|right}) hand.$} {#VAR %2hand %1;#VAR %4hand %3}

#TR {^You glance down to see (%*) in your ({left|right}) hand.$} {#VAR %2hand %1}

2) %lastcom2 the command before the last command executed

Predefined Variables:
%lastcom the last command executed
%lastcom2 the command before the last command executed
%lastcom3 the command before %lastcom2

%lastinput the last line of commands executed
%line the last line received from the MUD
%line2 the line before the last line received
%line3 the line before the line before the last line received
%linecol color attribute of the first character in the current line

TonDiening
Beta Upgrading to 6.26
Reply with quote
itsmarty
Novice


Joined: 29 Jan 2002
Posts: 37
Location: USA

PostPosted: Mon Feb 25, 2002 4:39 am   
 
Thanks for responding. Unfortunately, the fact that "in your left hand" wraps to the next line causes the whole trigger not to fire. If I cut the trigger down to just look at what appears on the first line like so:

#TR {^You glance down to see * (%w) in your right hand and * (%w)$} {#VAR righthand %1;#VAR lefthand %2}

it works, but that's just to illustrate the problem...it doesn't always wrap at the exactly the right point for this to work well. I'll keep playing with it a little. I changed your trigger a little because I'm certain my mud never changes the order of hands, not because I think I'm smart or anything :)

%lastcom2 is what I was afraid I had to use...half the time when I try it I get something like #ALARM +1 {#ADD roundtime -1}. I was hoping there was something that just took keyboard input, but I can always just use the up arrow...no loss.

Thanks,
Martin
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Feb 25, 2002 5:37 am   
 
1)
Check to see if you can do "width 65535" and let zMud word wrap for you.
That would solve that issue.

The issue you'll have have will deal with the fact that the lp mud won't send
you very clear flag that it has finished sending you the line. Can't
rely on your prompt either.

You could try 2 triggers
Fits on line:
#TR {^You glance down to see (%*) in your ({left|right}) hand and (%*) in your ({left|right}) hand.$} {#VAR %2hand %1;#VAR %4hand %3}

#TR {^You glance down to see (%*) in your ({left|right}) hand and (%*)$(%*)hand.$}
Then parse out and make sense of the %3 %4 here. It assumes you have at least another
word with hand wrapped :(.

Maybe someone has a better way of handling that.

2)
You can track with #oninput {^(%*)$} {..} your last 5 commands.





TonDiening
Beta Upgrading to 6.26
Reply with quote
itsmarty
Novice


Joined: 29 Jan 2002
Posts: 37
Location: USA

PostPosted: Mon Feb 25, 2002 6:14 am   
 
Sounds good, I'll keep playing with it. And I appreciate the oninput tip.

Thanks,
Martin
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