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
Krule
Adept


Joined: 12 Nov 2000
Posts: 268
Location: Canada

PostPosted: Mon Dec 17, 2001 2:15 pm   

Filtering triggers
 
I'm trying to make a trigger react so that when someone nods at a mob, I backstab it..

I've made it rather simple:

%1 nods at a %2
bs %2

Now, there are problems...sometimes it looks like this:

%1 nods at a %2.
or even
%1 nods at an %2
etc etc etc...

How do i avoid?
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Mon Dec 17, 2001 2:31 pm   
 
#TRIGGER {^(%w) nods at {a|an|the} (*)} {bs %word(%len("%2"))}

expand the {a|an|the} list for other variations you can expect

This will use the last word of the string %2 as keyword to backstab (since a mob usually has more than one word, and the last word is usually keyword).

If a character can have more than just a one-word name (e.g. a last name too) then use

#TRIGGER {^(*) nods at {a|an|the} (*)} {bs %word(%len("%2"))}


It's a general rule to use specific wildcards in your trigger pattern (%w, %d, etc.) and the numeric ones in your trigger value (%1, %2, etc.). Use the help files to find out what specific wildcards exist, and what they do.

Acaila
Reply with quote
Krule
Adept


Joined: 12 Nov 2000
Posts: 268
Location: Canada

PostPosted: Tue Dec 18, 2001 4:52 am   
 
oh yeah..i was just writing that fast :p

Thanks for info
Reply with quote
Krule
Adept


Joined: 12 Nov 2000
Posts: 268
Location: Canada

PostPosted: Tue Dec 18, 2001 5:45 pm   
 
Hmm...
Well..your trigger returned a number to me when i tried to backstab.oddly enough..

what I did is I just made it be
#TRIGGER {^(%w) nods at {a|an|the} (*)} {bs %2}

Except..i still have the problem that it does

Backstab gargoyle.

(Except, the period is not in the name, it's just a mud added feature...)

Here's the output that i'm given for the trigger

Deysai nods at a gargoyle.

I want to "backstab gargoyle"
not gargoyle.

Hope this helps! :)
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Dec 18, 2001 7:23 pm   
 
quote:

I want to "backstab gargoyle"
not gargoyle.



Then change your pattern to show the period to be outside the captured data:

#TRIGGER {^(%w) nods at {a|an|the} (*).} {bs %2}

I would be cautious about this trigger, anyone nodding at anything would send in you into combat. You might change it to set a leader and only have him be nodding.


#ALIAS fol {#VAR leader %1; follow %1}
#TRIGGER {^{@leader} nods at {a|an|the} (%w).} {bs %1}


The above will be more secure.

Troubadour
Reply with quote
Krule
Adept


Joined: 12 Nov 2000
Posts: 268
Location: Canada

PostPosted: Tue Dec 18, 2001 8:49 pm   
 
that's ok..cuz i dont mind if anyone makes me backstab anything...not worried about that..

But now..the thing is the period isn't always there......
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Tue Dec 18, 2001 10:58 pm   
 
If you're gonna go w/the trigger w/the (*), then you can do something like this:

#TRIGGER {^(%w) nods at {a|an|the} (*)} {bs %replace(%2, ".", "")}

If you're gonna go w/the trigger w/the '{a|an|the} (%w)' then you can just leave off the period altogether.

Iljhar
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Wed Dec 19, 2001 9:49 pm   
 
is there a way to unconditionally get the last word before a period? similar to what krule has been saying, only with an indefinite amount of precursors? as in it may have "the" "an" "small" "little lovable" etc. right before the keyword
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Wed Dec 19, 2001 10:23 pm   
 
If you're sure there's always gonna be a period, then just use:

#TRIGGER {^(%w) nods at * (%w)~.} {bs %replace(%2, ".", "")}

Wasn't sure if you need a tilde in front of the period, but just to be on the safe side I put it in.

Acaila
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Thu Dec 20, 2001 9:45 pm   
 
Try this:

#TRIGGER {^(%w) nods at {a|an|the} (*)} {#var tempstring %replace("%2", ".", "");bs %item(@tempstring, %numwords(@tempstring))}

Iljhar
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Thu Dec 20, 2001 10:20 pm   
 
Sorry to be such a bother, but...

I had it set up and it was working fine when I was attack "An elk" or "A brown deer", but when I try to get "mage" it doesn't work.

in case you want more background, i am doing it this way:

#TR {You have flagged * (%w).} {target = %1}
then some other stuff that doesn't really matter.

any ideas? or is the answer already in this post and I just can't find it?

***Fixed a typo.. no syntax errors in the code***
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Fri Dec 21, 2001 12:43 am   
 
Yes, the answer is in bits and pieces throughout this thread. Acailla's initial response came closest. Basically you assume that the mob's keyword is the last word in the direct object phrase in the MUD's output.


#TR {You have flagged (*)} {
#VAR target %word("%1", %numwords("%1")) //sets target as last word in %1
#VAR target %replace(@target, ".", "") //removes any periods
}


Troubadour
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Fri Dec 21, 2001 4:04 am   
 
Man, Troub, you are always helping out...

Okay, that works great... the only thing is that for some silly reason my mud doesn't like capitals. it gives me the "You have flagged Adventurer." so I have target as "Adventurer " but my mud wants "adventurer " That seems like more than a simple trigger, so unless I find almost exactly what I want somewhere else in this forum, (or some ambitious person wants to figure it out and post it) I will probably just deal with doing it manually
:) (OH no! actually typing things?)
Reply with quote
Murdlih
Beginner


Joined: 17 Dec 2001
Posts: 24
Location: USA

PostPosted: Fri Dec 21, 2001 4:28 am   
 
never mind! I found the %lower

I am happy again :)
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