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


Joined: 22 Feb 2002
Posts: 48
Location: Latvia

PostPosted: Thu Jul 18, 2002 4:34 pm   

Patter question
 
You think that the weakness of (%w) is at the (%w) (%w).

At the moment my patter looks like above.
But I'm having a problem
cos the message could look like
You think that the weakness of guard is at the right hand.
You think that the weakness of guard is at the left hand. <-- notice space before word left
You think that the weakness of guard is at the chest.

And in case of left/right stuff trigger is doing aim l_%3 or aim r_%3 so far everything is fine.
But as soon as mud gives out that weakness is at the chest. my trigger fails, cos it doesn't match pattern is this possible to write both of these in one trigger? How?

I can't put patter on ...at the (%w) cos then I won't make r_ l_ stuff to work :/

Please help :)

-Jurz
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Thu Jul 18, 2002 5:14 pm   
 
#TR {You think that the weakness of (%w) is at the (*).} {#IF (%2="left hand" OR %2="right hand") {aim %left(%trim(%2),1)_hand} {aim chest}


That should work. The part in red you may need to fix in order to get the spacing right, because if there is a space in front of the left hand, %2 will capture that space also, and it wont match correctly. I wasnt certain, because both your trigger pattern and example output didnt include said space.Also I wasnt certain of the aim command for the chest.
Reply with quote
jurz
Novice


Joined: 22 Feb 2002
Posts: 48
Location: Latvia

PostPosted: Thu Jul 18, 2002 5:20 pm   
 
Here comes the problem it can be a lot of else things besides hand
it can me left/right arm hand foot leg and where the chest is can be chest head stomach

-Jurz
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Thu Jul 18, 2002 6:25 pm   
 
Try this then:

#TR {You think that the weakness of (%w) is at the (*).} {#IF (%2= "left hand") {#VAR aimpart 1} {};#IF (%2= "right hand") {VAR aimpart 2} {};#IF (%2= "left leg") {#VAR aimpart 3} {};#IF (%2= "right leg") {#VAR aimpart 4} {};#IF (%2= "left arm") {#VAR aimpart 5} {};#IF (%2= "right arm") {#VAR aimpart 6} {};#IF (%2= "left foot") {#VAR aimpart 7} {};#IF (%2= "right foot") {#VAR aimpart 8} {};#IF (%2= "chest") {#VAR aimpart 9} {};#IF (%2= "head") {#VAR aimpart 10} {};#IF (%2= "stomach") {#VAR aimpart 11} {};#CASE @aimpart {aim l_hand} {aim r_hand} {aim l_leg} {aim r_leg} {aim l_arm} {aim r_arm} {aim l_foot} {aim r_foot} {aim chest} {aim head} {aim stomach}}


Again you will have to go through it to make sure the spacing is right for that pattern matches(highlighted in red), and that all the command sent to the mud are correct(highlighted in green.
Reply with quote
jurz
Novice


Joined: 22 Feb 2002
Posts: 48
Location: Latvia

PostPosted: Thu Jul 18, 2002 6:38 pm   
 
Muah thanks a lot but I prefer less word processing
RTFM is what I was doing and solved the problem
for those who are interested:

Pattern:
You think that the weakness of (%w) is at the(%s)(%w)(*).

Command:
#IF (%3==left) {#VARIABLE aimp l_%trim( %4)} {#VARIABLE aimp %3}
#IF (%3==right) {#VARIABLE aimp r_%trim( %4)} {#VARIABLE aimp %3}
aim @aimp

Comments: (%s) - any number or spaces/tabs (fix the space bug in mud)
(%w) - take the first word see if it's right or left if no we aim at it
if is then we just do a prefix r_ or l_ and aim on r_%4 or l_%4

tested and it works fine :)

-Jurz
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Thu Jul 18, 2002 7:11 pm   
 
In this solution the number of words is counted. If only one, that's what is aimed at. If two, then the phrase is parsed, concatenating the first letter of the first word onto "_" and the second word.

#TR {You think that the weakness of (%w) is at the%s(*).} {#CASE %numwords(%2) {aim %2} {aim %concat(%left(%word(%2,1),1),"_",%word(%2,2))}}

Troubadour
Reply with quote
jurz
Novice


Joined: 22 Feb 2002
Posts: 48
Location: Latvia

PostPosted: Thu Jul 18, 2002 7:33 pm   
 
Wow this works much better and doesn't bug when aim point is left.
Thanks a lot man. You helped me much :)

-Jurz
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