|
VasoolXanatov Newbie
Joined: 23 Feb 2009 Posts: 8
|
Posted: Mon Feb 23, 2009 6:04 pm
Problem highlighting enemy names |
OK, so I've got two scripts, one that places city enemies into a variable, and one that highlights names, as follows
#trig {Enemies of the City of %w:} {CityEnemies=""}
#cond {(*)} {#forall %replace(%1,", ","|") {#additem CityEnemies %i}}
#TR {{@CityEnemies}} {#CW bold,red}
The problem is that it not only highlights the enemy names, it also highlights any part of a word which contains a full enemyname.
I.E. I have an enemy named Pip, and another named Ani, so I will see things such asPipeline and Maniac which really makes playing the game confusing, as I only want the actual names of these people to be highlighted, and not portions of other words which happen to contain the names. Please let me know how I can fix this, thanks everyone! |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Mon Feb 23, 2009 6:34 pm |
Yeah, you need to use %q when Zscript or \b when Regex (both go for word boundary)
Code: |
#tri {%q{@CityEnemies}%q} {#CW bold,red}
|
|
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Feb 23, 2009 9:51 pm |
You need be careful if this list gets very big as well because it'll be very slow indeed. You may want to look into using a patricia tree to speed it up.
|
|
|
|
|
|
|
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
|
|