|
seraph1126 Newbie
Joined: 09 Dec 2006 Posts: 2
|
Posted: Sat Dec 09, 2006 8:23 pm
Comparing between two variable string lists or data records? |
Hello Everyone,
I'm new here, and although I've been playing MUD's (IRE) for a few years now, I'm always looking for newer and better ways to improve my systems. So here's the problem I'm facing. I want to know if it's at all possible to compare between the string lists or data records of two (or more) variables, and execute a command based on whether it can find matching items on both.
For example:
The Variable "Afflictions" Has:
Paralysed
Frozen
Confused
-meanwhile-
The Variable "bloodrootcures" Has:
Paralysed
Slickness
LimbParalysis
Is is possible to code something that would compare the things in the "afflictions" variable to the things in "bloodrootcures" and execute a command if it finds a match? Like in this case, it would find that both variables have the "paralysed" item on their list, and thus would execute an alias that cures paralysis. Any and all help is appreciated. Thanks
Seraph |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Dec 09, 2006 8:53 pm |
#if (%ismember(paralysed,@afflictions) AND %ismember(paralysed,@bloodrootcures)) {do something}
One possible application of this could be:
#alias bloodrootcheck {#if (%ismember(%1,@afflictions) AND %ismember(%1,@bloodrootcures)) {#exec %2} |
|
|
|
seraph1126 Newbie
Joined: 09 Dec 2006 Posts: 2
|
Posted: Sat Dec 09, 2006 9:10 pm |
Thanks for the quick reply, although it wasn't quite what I was looking for. Probably because I didn't explain what I wanted too well .
Basically, the variable "afflictions" starts empty, I just put in those things there for that example. What I'm looking for is a way for me to get a command executed if any item listed in the variable "Bloodrootcures" shows up in the variable "afflictions". Any suggestions?
Seraph |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Dec 09, 2006 9:48 pm |
Oh I see! Well, I'd suggest simply running that alias every time you add an item to the string. A better way would be to use an expression trigger, but they slow you down a lot.
|
|
|
|
|
|