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
Dyron
Apprentice


Joined: 08 Apr 2004
Posts: 103
Location: USA

PostPosted: Mon Sep 29, 2008 4:54 am   

String variable question.
 
I've looked over a lot of string variables, but have not found the answer to what I need. So, hopefully I'm not reasking a question thats been asked a ton of times.

I have a string variable I have been making called "Afflictions". Below are is an example of afflictions in it.

Sadness
Dementia
Confusion
Paranoia

I need to be able to check the variable "Afflictions" and cure those items in a certain order. Lets say this order is:

Confusion
Paranoia
Sadness
Dementia

After picking through the order, I then have to be able to check the affliction for the right cure.. Lets say this is a cure list:

Confusion is cured by goldenseal
Paranoia is cured by skullcap
Sadness is cured by valerian
Dementia is cured by bloodroot

Summary: I need to check an afflictions list against an affliction order and then pick the right cure.
Thanks a ton, you guys have been great.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Mon Sep 29, 2008 6:56 am   
 
#IF (%ismember("Confusion". @affliction)) {do this}

it is case sensative

then just

#DELI affliction Confusion

to remove it when it gets cured
_________________
Discord: Shalimarwildcat
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Sep 29, 2008 2:40 pm   
 
Set up an alternate afflictions variable, such as:

#VAR orderedafflictions {Confusion=goldenseal|Paranoia=skullcap|Sadness=valerian|Dementia=bloodroot}

Then do this:

#ALIAS cure {#LOOPDB @orderedafflictions {#IF (%ismember(%key, @affliction)) {use %val;#DELI affliction %key}}}

That'll go through the list in order. :P

Charneus
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Tue Sep 30, 2008 12:04 am   
 
As usual I've been beat to it. Charn has it ;)
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
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