|
Dyron Apprentice
Joined: 08 Apr 2004 Posts: 103 Location: USA
|
Posted: 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. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: 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 |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: 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 |
|
|
|
|
|