Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Ethan
Newbie


Joined: 14 Apr 2014
Posts: 4

PostPosted: Mon May 12, 2014 12:39 pm   

%ismember woes
 
I ran into a problem with %ismember that's causing me a bit of trouble.

What I'm doing is %ismember(@afflictions,@herbable) {herb}

so when it runs into an affliction that can be cured stored in the stringlist herbable, it pops out the cure.

While it works fine when there's only one affliction that matches herbable in affliction, whenever more than one affliction is inside @affliction, it stops matching.

Can anyone let me know what I'm doing wrong?

Thanks!
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Mon May 12, 2014 4:41 pm   
 
The first parameter to %ismember has to be a single item, not a list. If you want to check them all, you'll need to explicitly loop through the list:
Code:
#forall @afflictions {#if %ismember(%i, @herbable) {do something}}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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