|
wth Novice
Joined: 14 Nov 2001 Posts: 37 Location: Poland
|
Posted: Tue Oct 22, 2002 9:17 pm
Trigger performance |
Hello
What would be faster:
#VARIABLE ppl1 "player1|player2| ... |playerX"
#VARIABLE ppl2 "ppl1|ppl2|ppl3| ... |pplN"
#TRIGGER {@ppl1} {#CW green}
#TRIGGER {@ppl2} {#CW red}
or
#TRIGGER {(%w)} {
#IF (%numitems("%1",@ppl1) > 0) {#CW green}
#IF (%numitems("%1",@ppl2) > 0) {#CW red}
}
I'm looking for highliting single words - in 1st case I will have highlightet inside parts of word which will match my patter too, and this isn't effect which I wish to have.
Best rgds,
--
Waldek
There are no mistakes, just learning experience |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Oct 22, 2002 9:48 pm |
You probably want %ismember(), not %numitems(). You don't need quotes around %1.
I have no idea which is faster. If one of them causes a noticeable slowdown, try the other and see if it's better. If there's no noticeable slowdown with the one you try first, then it doesn't really matter.
LightBulb
Senior Member |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Oct 22, 2002 9:56 pm |
The first one should be faster since the second one matches lines which may not necesarily contain an item from the stringlist and it is not until the code of the trigger is executed that you are able to find out if it is a match or not. Also, I'm not sure that the second one would match when one of the items from the stringlists appears after the first word in the line.
Kjata |
|
|
|
wth Novice
Joined: 14 Nov 2001 Posts: 37 Location: Poland
|
Posted: Tue Oct 22, 2002 10:58 pm |
Light: yea - I wanted 'ismember' function (was writting this post - not copy-paste from zmud) - my mistake
Kjata:
1/ If 2nd one would highlight only one work in line it is ok for me (this is info/alert that PK player is in the same room)
2/ how to make in 1st case to match only words, i.e.
ppl1 = "wth" and if triggered line would containe 'blah blah abcwthabc' it will highlight wth inside word and this isnt case I like. And the best could be case-sensitive too (1st character upper, rest lower)
--
Waldek
There are no mistakes, just learning experience
Ps. performance is for me most important (I have 80kb script file) - rest I can code :) |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Oct 23, 2002 1:44 am |
In the first case, since you are only interested in the first word of a line, anchor the trigger. Include a space at the end (either in the itemlist or the trigger) to ensure it won't go on LightBulb when you're looking for Light. Make your items proper (uppercase first letter) and use the "case" trigger option. That should do it.
Play around with these and see if they'll do the job or if you'll need "'s.
Trailing space in itemlist.
#VAR ppl1 {Player1 |Player2 |Player3 }
#ADDITEM ppl1 {Player4 }
#ADDITEM ppl1 {%proper(plAYer5) }
#TR {^{@ppl1}} {#CW green} {} {case}
Trailing space in trigger.
#TR {^{@ppl1} } {#CW green} {} {case}
LightBulb
Senior Member |
|
|
|
wth Novice
Joined: 14 Nov 2001 Posts: 37 Location: Poland
|
Posted: Wed Oct 23, 2002 8:32 am |
I said 'one word' not '1st word in line'. So if there is 2 or 3 words in a line I'm enough interested in highlighting only one of its.
But thx anyway - I thought that there are minor difference in performance of this two cases. Now I will choose the one that is better for me :)
Best rgds for you Kjata and LightBulb
--
Waldek
There are no mistakes, just learning experience |
|
|
|
|
|