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


Joined: 09 Dec 2006
Posts: 2

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
seraph1126
Newbie


Joined: 09 Dec 2006
Posts: 2

PostPosted: 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 Neutral .

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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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