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
rocky
Newbie


Joined: 20 Jan 2004
Posts: 5

PostPosted: Sun Feb 08, 2004 1:05 am   

() in trigs
 
I have this line of code i want to switch to another window named foo.
[ 5] A/D ( 1%) You cut sand crab deeply in the head.
And to just put my hits in the window, need to have the trig run off of this part of that "A/D ( 1%) You" but i seem to be having a problem as the ( 1%) is seen by the trigger as a wildcard instead of actual text, any help on this?
Reply with quote
Firewalker
Beginner


Joined: 29 Nov 2000
Posts: 15
Location: USA

PostPosted: Sun Feb 08, 2004 1:49 am   
 
Try triggering on
~[ %d~] A/D ~(%*~) You cut sand crab deeply in the head.
Reply with quote
rocky
Newbie


Joined: 20 Jan 2004
Posts: 5

PostPosted: Sun Feb 08, 2004 1:53 am   
 
doesnt work
Reply with quote
Firewalker
Beginner


Joined: 29 Nov 2000
Posts: 15
Location: USA

PostPosted: Sun Feb 08, 2004 2:04 am   
 
It seems to work for me based on your example, how does the output vary? What do you wish to happen when the text is triggered?
Reply with quote
rocky
Newbie


Joined: 20 Jan 2004
Posts: 5

PostPosted: Sun Feb 08, 2004 2:16 am   
 
acutally got it, i changed the special chara for quotes and that is what does it, thanks. Next question though =) Taking something like this, RDMP 41 MONSTER_HEALTH little crab 30
how do i put the "little crab" into a variable considering the names can be anywhere from one word to 4 words long, not just two?
Reply with quote
Firewalker
Beginner


Joined: 29 Nov 2000
Posts: 15
Location: USA

PostPosted: Sun Feb 08, 2004 2:25 am   
 
%* will match any length of text and white space. If you need a variable you can change your trigger to put the text you are matching in () and then reference it in the trigger. For example #TR {You cut (%*) deeply in the head.} {#SHOW %1} will echo the mob name to the screen without saving it to a permanant variable. Otherwise you can do something like #TR {You cut (%*) deeply in the head.} {#VAR monster %1} to store the name to the variable monster.
Reply with quote
rocky
Newbie


Joined: 20 Jan 2004
Posts: 5

PostPosted: Sun Feb 08, 2004 2:34 am   
 
It is catching the full name into the %1 now, but when i put it into #VAR monster %1 and display the @monster, it only shows the first word instead of the whole name
Reply with quote
Firewalker
Beginner


Joined: 29 Nov 2000
Posts: 15
Location: USA

PostPosted: Sun Feb 08, 2004 2:37 am   
 
Then put the parameter in quotes, ie #VAR monster "%1"
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Feb 11, 2004 6:43 pm   
 
I'd suggest avoiding the use of %* in your trigger patterns. It is dangerous and could allow someone to "hack" your zMUD and execute commands, as pointed out in the documentation. Using * works for 99% of patterns that use the %*. Go with that instead.

Larkin
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Wed Feb 11, 2004 7:32 pm   
 
The security concerns are really only if you capture it. If you do need to in current public versions, then you must capture it directly to a variable via the trigger pattern and be _very_ careful about referring to it properly everywhere (only safe way known is %expand(@VarName, 1))

However, in the latest beta versions (and the upcoming public version), %* is unnecessary as * will match everything and properly quotes its arguments to avoid this security issue.
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