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
john_taylor_jr
Wanderer


Joined: 17 Jan 2003
Posts: 57
Location: USA

PostPosted: 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
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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
Reply with quote
john_taylor_jr
Wanderer


Joined: 17 Jan 2003
Posts: 57
Location: USA

PostPosted: 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
Reply with quote
shibbidy joe
Wanderer


Joined: 02 Nov 2002
Posts: 76
Location: Tuvalu

PostPosted: Sat Jan 18, 2003 12:05 am   
 
%ismember is the answer.

-Shib
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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)))
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: 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
Reply with quote
mimique6
Newbie


Joined: 09 Jan 2003
Posts: 9
Location: USA

PostPosted: 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?
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