|
john_taylor_jr Wanderer
Joined: 17 Jan 2003 Posts: 57 Location: USA
|
Posted: Fri Jan 17, 2003 6:25 am
#IF scripting problem |
If @people is a string array
why doesn't the expression
#IF ((@bot = 1) & (@people !=~ %1))
work?
It also sends a bunch of junk that looks like part of the array screen to the mud |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jan 17, 2003 6:30 am |
Probably because %1 isn't a string array. What's the rest of the script?
LightBulb
Senior Member |
|
|
|
john_taylor_jr Wanderer
Joined: 17 Jan 2003 Posts: 57 Location: USA
|
Posted: Fri Jan 17, 2003 10:41 pm |
%1 is a value in the string array
What I'm trying to do is this if I have
Bob, Joe, and Sue as values in the string array if %1 wich will be a string doesn't match bob, joe, or sue and the bot value is true I want it to execute certain commands |
|
|
|
shibbidy joe Wanderer
Joined: 02 Nov 2002 Posts: 76 Location: Tuvalu
|
Posted: Sat Jan 18, 2003 12:05 am |
%ismember is the answer.
-Shib |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Jan 18, 2003 12:06 am |
Perhaps he means a list. In which case he would be much better served using the %ismember function. Example:
#IF ((@bot = 1) & !(%ismember("%1",@people))) |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Sat Jan 18, 2003 1:15 am |
Don't forget that case matters with %ismember.
#SH %ismember("bob","Bob|Mary|Sue")
0
#SH %ismember("Bob","Bob|Mary|Sue")
1
Ton Diening |
|
|
|
mimique6 Newbie
Joined: 09 Jan 2003 Posts: 9 Location: USA
|
Posted: Sun Jan 19, 2003 10:59 pm |
quote:
Don't forget that case matters with %ismember.
indeed, that can be a pesky problem. If I read you right, you're having it first see if the Bot is on (@BOT=1)
You had #IF ((@bot = 1) & !(%ismember("%1",@people)))
I would use
#IF (@bot) {#IF (%ismember( %lower( %1), @people)) {
TRUE
} {
FALSE
}}
This is basically "IF @Bot <> 0" then check "IF %1 (lowercase) is a member of @people." Still, it's case-sensitive, but if all your entries of @people are lowercase, wouldn't be a problem.
Hope this works for you
~Mimique
Is it bad when Zmud plays more than you do? |
|
|
|
|
|