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


Joined: 25 Feb 2002
Posts: 2
Location: USA

PostPosted: Mon Feb 25, 2002 12:58 am   

#IF and %ismember
 
Having problems getting the #if and %ismember functions to work. This is a trigger:

^You sense that %1 is scrying you.

#VAR @currentscry %1
#IF (!%ismember( @currentscry, @clanlist)){clan :lets you all know} {clan Quit
scryin me}

Now, @clanlist is a variable string list with the names of my clan members. What I want is, if %1 is NOT in the list, I want to fire the {clan :lets you know} msg. and if %1 IS in the list, then I want the {clan Quit scryin me} msg to fire. But no matter who it is, weather the name is in the list or not, it fires the {clan :lets you know} msg. Any ideas, please?

Aardwolf Rox
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Feb 25, 2002 1:15 am   
 
^You sense that (%w) is scrying you.

#VAR @currentscry "%1"
#IF (!%ismember( @currentscry, @clanlist)) {clan :lets you all know} {clan Quit scryin me}

You need to put brackets around things you want to refer to in the script.
So the (%1) or as I changed it to (%w) is needed.

I avoid putting the %1 in triggers as it can throw you sometimes.
I changed it to %x to match non space words. You might want %w if your mud
allows names with only letters and one word.

I put "%1" in to help if the user name has weird symbols in it.


TonDiening
Beta Upgrading to 6.26
Reply with quote
Bobmartin
Newbie


Joined: 25 Feb 2002
Posts: 2
Location: USA

PostPosted: Mon Feb 25, 2002 1:20 am   
 
Ok, made the change to (%w) and "%1" , as well as my spacing typo. However, when i test it with a name in clanlist and a name that's not in clanlist, it still only returns the {clan :lets you all know} msg. All names in my mud are one word and letters only.

Aardwolf Rox
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Mon Feb 25, 2002 1:36 am   
 
The functions are case-sensitive, so if your @clanlist had {joe|bob|sue} and @currentscry had "Sue", it'd never find it. You can use the %lower() or %upper() or %proper() functions to manipulate the variables.

Iljhar
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Mon Feb 25, 2002 2:59 am   
 
Also, the line
#VAR @currentscry "%1"
should be
#VAR currentscry "%1"


 - Charbal
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Feb 25, 2002 3:30 am   
 
Heh missed the most obvious issue

Time for coffee!

TonDiening
Beta Upgrading to 6.26
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