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
DMUS
Beginner


Joined: 01 Sep 2003
Posts: 19
Location: USA

PostPosted: Mon Oct 20, 2003 4:31 am   

Stringlist Explanation
 
Which of these examples is preferred, and why?

Example 1
#TR {Arnold|Bob|Carry|Doug|Eleanor} {#cw red}

Example 2
#VAR friends Arnold|Bob|Carry|Doug|Eleanor
#TR {@friends} {#cw red}

Example 3
#VAR friends Arnold|Bob|Carry|Doug|Eleanor
#TR {(%w)} {#IF (%ismember(%1,@friends)) {#cw red}}


I'm sure the difference for a small stringlist is negligible, but what if this were a long stringlist (e.g. 50+ items), or what if the stringlist contained descriptions or sentences instead of single items? (e.g. Arnold is governor|Bob the builder|Carry the telepath|Doug the interior decorater|Eleanor Rigby)

I thought I read an explantion of this once, but I was unable to locate it. Any help explaining this would be great!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Oct 20, 2003 5:45 am   
 
Preferred by who?
Different people may have different preferences. The same person might even have different preferences, depending on the situation.

Example 1 is preferred. Since it includes everything in the pattern, you don't have to check somewhere else (the variable) to see what words will be colored. It can probably process slightly faster since zMUD also doesn't have to check somewhere else to see what words to color. This is a good choice when you have a short list that's not expected to change.

Example 2 is preferred. It's much easier to add and delete items from a list variable than from a trigger pattern. It's also much easier to view a list variable than a trigger pattern, particularly with a long stringlist. And, it's easier to check whether something is in the list with a variable. This is a good choice for longer lists or lists that will change often.

Example 3 is not preferred. #CW triggers get special handling so that they will color every occurence of the pattern. #IF triggers get normal handling and only fire once per line. Only the first word (alpha character string) of the line will be tested. If it's in the list, the color will be applied to the remainder of the line as well.
Reply with quote
DMUS
Beginner


Joined: 01 Sep 2003
Posts: 19
Location: USA

PostPosted: Tue Oct 21, 2003 2:47 am   
 
"Preferred by who?"

Preferred for optimal processing. I've seen these examples used in conjunction with stringlists in other posts and I wasn't sure which maintained the best performance.

I've got a class that, when enabled, noticeably slows down the mud response by a second or two, enough to affect play (effect? bleh - I can never remember). It's my autocure class, and it only contains triggers that check stringlist variables. I wasn't sure if the delay was due to the way I was checking the stringlists, so I figured I'd ask which "style" of stringlist checking is preferred.

So, preferred by whom? By zMUD users in general, but by experts more specifically.

If how I check stringlists isn't causing the delay, then it's probably more an issue of my old CPU, heh.

Thanks for the info!
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