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


Joined: 28 Oct 2000
Posts: 24
Location: USA

PostPosted: Sat Jun 07, 2003 5:43 am   

Trying to set up some simple triggers.
 
I used to have a trigger that would take a line like the following, Extract the name, And let me give a warning about it over a channel.

For Example:
The Fist looks very uncomfortable.

The trigger would capture the name, And allow me to give a warning:

The Fist is cursed!

I just forgot how to capture the name, Keeping in mind that the name is variable. Can anyone help me? Thanks.




When the world needs a hero...
Rexxon the Mighty.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jun 07, 2003 6:57 am   
 
This is all explained under Pattern Matching.

#TR {(*) looks very uncomfortable} {ChannelPrefix %1 is cursed!}

LightBulb
Advanced Member
Reply with quote
Rexxon
Beginner


Joined: 28 Oct 2000
Posts: 24
Location: USA

PostPosted: Sun Jun 08, 2003 7:00 am   
 
Bleh, Sorry, But I'm still having problems.

I'll use this trigger as an example:

^(%w)is blinded by the dirt in (%w)eyes!

The first %w is the target's name, The second is it's gender (his/her/its).

The problem is that I don't seem to get any response out of this trigger.

On the other hand:

Roots grow up from the ground and entangle (%w)!

Produces the results I'm looking for. I believe it's because the %w is not at the beginning of the line.

Can anyone help me out. I had this fixed at one time, But now I can't remember how I did it. Thanks.


When the world needs a hero...
Rexxon the Mighty.
Reply with quote
DeathofOne
Beginner


Joined: 03 Jun 2003
Posts: 25

PostPosted: Sun Jun 08, 2003 9:50 am   
 
Did you copy those I see one problem.
NEw
#Trigger{^(%w)_is_blinded_by_the_dirt_in_(%w)_eyes!}
_ is for a space It needs to no there is a space there becuase %w does not see if there is one there.

Old
#trigger {^(%w)is_blinded_by_the_dirt_in_(%w)eyes!}

The one I gave will dectect
Death is blinded by the dirt in his eyes!
Yours will dectect
Deathis blinded by the dirt in hiseyes!

See the difference.


Also a %w might be bad there. What about if the mud comes with something like.
A man is blinded by the dirt in his eyes!

Also could make the trigger more like this.
#Trigger {^&%*Var is blinded by the dirt in {his|her|its} eyes!}
This will make it faster and You will be able to use @Var if you need to. To do something else also the %* will cacth if it is multi words.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Jun 08, 2003 1:02 pm   
 
If you really don't need to match zMUD's special characters (like a semi-colon for example), don't use %*. Although the way DeathofOne used %* is the safe way of using it, it is better to not use it when not needed.

The part that says &%*Var may be converted to &Var with the same result, except that it will not match special characters, but I doubt that a MUD allows any of these special characters inside a name.

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Jun 08, 2003 1:32 pm   
 
To summarize:
%w only matches letters, not spaces, so you need to leave a space between it and the following word.

^ marks the beginning of the line, so ^(%w) only allows one word. Since the target being blinded might sometimes be more than one word, you should either drop the ^ or use (*).

(%w) is blinded by the dirt in (%w) eyes!
^(*) is blinded by the dirt in (%w) eyes!

Beware of people who encourage you to use %*. That's like removing your virus protection when you're having trouble installing a program.

LightBulb
Advanced Member
Reply with quote
Rexxon
Beginner


Joined: 28 Oct 2000
Posts: 24
Location: USA

PostPosted: Mon Jun 09, 2003 3:29 am   
 
Bah, Still doesn't seem to be working. I took Deathofone's advice.

Trigger:
^&%*Var is blinded by the dirt in {his|her|its} eyes!

Note that there IS a space between the Var and the is. Space as in the spacebar key on the keyboard.

Can anyone help me figure out why it won't work? Everyone I'm talking to says it should, But it doesn't.


When the world needs a hero...
Rexxon the Mighty.
Reply with quote
DeathofOne
Beginner


Joined: 03 Jun 2003
Posts: 25

PostPosted: Mon Jun 09, 2003 6:58 am   
 
&Var sends whatever to the variable called Var.

So in the whatever (mind not working right now) you need to have something like
(Channel whatever) @Var is cursed!
Channel whatever = say, chat, war, or whatever.

Variables are a powerfull thing once you learn to use them. Then arrays are 10times stronger.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jun 09, 2003 6:58 am   
 
You don't need to use %*.
Either of the patterns I suggested should suffice.

You don't need to use the &Var pattern syntax. You aren't familiar with it and it's causing you problems. Stick to the (*) patterns until you've got more experience.

Without seeing the entire trigger, there's no way for anyone to tell why you're having trouble. Problems are at least as likely to be in the Value (commands) of the trigger as in its pattern.

I find it hard to understand why you'd ignore the advice of two people who have a combined record of over 5K posts in favor of someone with less than 25.

LightBulb
Advanced Member
Reply with quote
Rexxon
Beginner


Joined: 28 Oct 2000
Posts: 24
Location: USA

PostPosted: Tue Jun 10, 2003 4:35 am   
 
Well, Lightbulb. Truth is, I've tried your method too, and it still doesn't seem to work.

This is the exact trigger (Part that goes in the pattern space):

^(*) is blinded by the dirt in (%w) eyes!

Strangely, When I copied and pasted it, There was 2 spaces between the (*) and the next letter, But in the editor window there is only 1 space.

This is what is going in the value spot:

clooc {C Note: %1 is blinded by dirt.

I can't for the life of me find anything wrong, But it doesn't seem to fire. When I take the text and try it in the test, It matches perfectly, It just doesn't seem to be giving me my warning.


When the world needs a hero...
Rexxon the Mighty.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Jun 10, 2003 4:41 am   
 
quote:

^(*) is blinded by the dirt in (%w) eyes!



Would the word in %w happen to be possessive (ie, Matt's)? If so, this will make the pattern not match. %w matches only letters. To match both letters and symbols, you need to use %x instead.

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


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jun 10, 2003 5:16 am   
 
There should only be one space after (*) since there would only be one space between a name and is. Having two spaces is probably the cause of your trigger not firing.
Rexxon is blinded by the dirt in his eyes! (one space)
Rexxon  is blinded by the dirt in his eyes! (two spaces)

It's also not a good idea to use special characters without marking them with the ~. The actual trigger should be
Pattern:
^(*) is blinded by the dirt in (%w) eyes!

Value:
clooc ~{C Note: %1 is blinded by dirt.

This has been tested, and does work, assuming the color code {C is allowed on the clooc channel. If you still have problems, check punctuation, spelling, and exact wording.

Test phrases:
LightBulb is blinded by the dirt in its eyes!
Matt Lofton is blinded by the dirt in his eyes!
Shade is blinded by the dirt in her eyes!

LightBulb
Advanced Member
Reply with quote
Rexxon
Beginner


Joined: 28 Oct 2000
Posts: 24
Location: USA

PostPosted: Wed Jun 11, 2003 3:49 am   
 
Got it working.

I did need the ~ before the {, which is wierd, as I didn't need it while mudding, Just in the editor window.

Thanks a bunch everyone. :)



When the world needs a hero...
Rexxon the Mighty.
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