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
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Wed Jul 16, 2003 7:33 am   

faster alternative to #TR {{@list}}
 
I use triggers similar to..
#TR {{@enemies}} {#CW 12} to keep colour quite a few groups. allies, enemies, ordermates, known and trusted merchants etc etc.
Having multiple such triggers all checking -every- word slows things down a bit, especially when I sometimes use an older, slower comp. Usually I just disable the ones I dont need... and all except for enemies, if I'm on that older comp. Today though, I was pondering quicker ways to do it. I thought I'd list a couple and ask which would be the quicker (if any).

Before I begin.. these are just ideas written off the top of my head, from memory of available commands/syntaxes. Just ignore the minor bugs if there are any; I'm asking about speed here Smile

Idea 1: Db variable
#ADDKEY names {name1=ally|name2=ally|name3=enemy|name4=enemy|name5=merchant}
#TR {(%w)} {#IF (%iskey(@names,%1) > 0) {col%db(@names,%1)}
#AL colally {#CW 10}
#AL colenemy {#CW 12}

Idea 2: %ismember
enemies={ename1|ename2|...|enamen}
allies={aname1|aname2|...|anamen}
#TR {(%w)} {
#IF (%ismember(%1,@enemies) > 0) {#CW 12;#ABORT 1}
#IF (%ismember(%1,@allies) > 0) {#CW 10;#ABORT 1}
...
}


Other ideas... somehow use nested dbvariable.. which I have no idea how would work, or to use paired stringlists to simulate a dbvariable in the way the first idea would work...if that'd be quicker.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jul 16, 2003 11:18 am   
 
You might just try the record variable with the color numbers you want for that text...
#TR {({@recordVar})} {#CW %db(@recordVar,"%1")}
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Thu Jul 17, 2003 3:11 am   
 
quote:
Originally posted by Vijilante

You might just try the record variable with the color numbers you want for that text...
#TR {({@recordVar})} {#CW %db(@recordVar,"%1")}



Ooh, thanks. I nevr realised record vars would match like lists do. Thats perfect! Smile
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 17, 2003 4:06 am   
 
Sorry, Vijilante. It was an interesting concept but it doesn't work. If the same line contains two (or more) names, one of which is an enemy and the other an ally, they will both be the same color. Which color it is changes depending on which name comes first.
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