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


Joined: 16 Aug 2005
Posts: 8

PostPosted: Tue Aug 16, 2005 1:32 am   

ismember question
 
Long time zmud user, first time poster. Hopefully the gurus here can assist me (I've seen some of the help you all have given others - good stuff!)

Here's my trigger:

#IF (%ismember( @mobsinroom, @AgroMobsToSleep)) {#FORALL @AgroMobsToSleep {cs %i}} {score}

What I'm trying to do is to compare entries from one string list against entries from another string list. Basically I have another set of triggers that populates the @mobsinroom variable whenever I walk into a room. If ANY of the values in @mobsinroom match, then I want to cast sleep (cs) on those mobs that match ANY value in the stringlist @AgroMobsToSleep. With the trigger posted above, I cast sleep on all of the mobs in the @AgroMobsToSleep variable if (and only if) there is only one value in the @mobsinroom variable, and if that value is within the @AgroMobsToSleep variable.

Is there anyway to compare each member of the @mobsinroom variable against each member of the @AgroMobsToSleep variable and if any values match then cast sleep on that member? If it's still not clear, I'll be happy to explain in more detail.
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Tue Aug 16, 2005 2:15 am   
 
Something like:

#FORALL @mobsinroom {#IF (%ismember("%i",@AgroMobsToSleep)) {cs %i}}

might work. As far as I know, you can't use %ismember to loop through a string var and compare it to another string var. It'd be nice if you could, and if I'm wrong here, please tell me so I can use it! (Btw, I know the above doesn't incorporate teh "score", but that seems like it could be handled pretty easily otherwise.)
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
slamboy
Newbie


Joined: 16 Aug 2005
Posts: 8

PostPosted: Tue Aug 16, 2005 3:01 am   
 
yeah, score was just entered for debugging purposes. I needed something that wouldn't get me killed :)
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