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


Joined: 02 Aug 2002
Posts: 2

PostPosted: Fri Aug 02, 2002 11:22 pm   

Expressions and If statement help
 
Im finding a little trouble with If statements and multiple wildcards.

For instance, i wish to pickup on the following pattern:
[51 Human Pri] [ Pirates ] (WANTED) mofoplay'er

so i use the following trigger
~[*~] ~[ ~P~i~r~a~t~e~s ~] ~(~W~A~N~T~E~D~) (%w~'%w)

which operates correctly, and colors thier name fine.

but when i use an if statement with a large OR expression, it does not seem to pick up things correctly.

I am tring to surpass the surname, and highlight only the charactors name, although not all players have surnames.

[51 Human Pri] [ Pirates ] (WANTED) Novitiate Tanoth,

use pattern:
~[*~] ~[ ~P~i~r~a~t~e~s ~] ~(~W~A~N~T~E~D~) (%w) (%w)

with this command:
#if (%1 != 'Novitiate' | 'Deacon' | 'Bishop' | 'Abbott' | 'Monsignor' | 'Cardinal')
#trigger {%1} {#cw 6} pk_names_active
#trigger {%2} {#cw 6} pk_names_active


now i threw #echo's in there and the variables do get picked up right, although the OR expression is always failing.

should i put both expressions in parens? (%1) != ('nov' | 'bish') ect?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Aug 03, 2002 3:13 am   
 
Just just want the player's last name and
not titles etc?

#VAR activepk {} {}

#TIRRGER {^~[*~] ~[ ~P~i~r~a~t~e~s ~] ~(~W~A~N~T~E~D~) (%*)$} {#ADDITEM activepk %word(%1,%numwords(%1))}

#TRIGGER {{activepk}} {#CW 6}

Btw if you have a player name like "mofoplay'er" you would need to match it with %x vs %w



Ton Diening
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Aug 03, 2002 5:33 am   
 
There's no need to use the ~ in front of everything. The various patterns would work just as well if they were
~[*~] ~[ Pirates ~] ~(WANTED~) (%w~'%w)
~[*~] ~[ Pirates ~] ~(WANTED~) (%w) (%w)
#TRIGGER {^~[*~] ~[ Pirates ~] ~(WANTED~) (%*)$} {#ADDITEM activepk %word(%1,%numwords(%1))}

In making a stringlist, it's the list that needs to be in "'s or {}, not the individual items in the list. The %ismember function is the usual method for determining if a particular string is included in a list.
#IF (!(%ismember(%1,"Novitiate|Deacon|Bishop|Abbott|Monsignor|Cardinal")))


LightBulb
Senior Member
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