Name Highlighter v3

Share your scripts and packages with other Mudlet users.
User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Name Highlighter v3

Post by Vadi »

Image Image
This script highlights names. For now, it just highlights city enemies, but in the future you will be able to add other groups too. Based on Heiko's demo script.

Features:
Very, very, very fast. With 1,800 names being highlighted in my case, there was no lag added.

Commands:
- city enemies: gets the list of city enemies.
- hlshow: shows some info about the scripts status.
- hlshow enemies: shows which enemies is it highlighting
- hlraid, hlraid on, hlraid off: toggles/enables/disabled raid mode. In raid mode, the names are more visible.
- hlpp, hlpause, hlunpause: toggles/pauses/unpauses the script.
- hlclear: resets all city enemies.

Upgrading
Before upgrading, delete the Name Highlighter alias, trigger and group folders.

API
This script provides the following functions you can use in your scripts:
- hl.isEnemy(name): returns true/false if the given name is a city enemy.

Download v3:
Achaea version:
Attachments
name-highlighterv3.xml
(11.05 KiB) Downloaded 2128 times

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Name Highlighter

Post by Vadi »

An example of the hl.isEnemy use - http://www.ubuntu-pics.de/bild/39052/sc ... 2y7O26.png

Code: Select all

if hl.isEnemy(matches[2]) then
	echo(matches[2] .. ", an enemy, just came into our room!")
end

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Name Highlighter

Post by Vadi »

If you need to update any of the triggers for another MUD, please post the script back here - I'll add it to the list.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Name Highlighter

Post by Vadi »

Updated to v2, so that hl.isEnemy actually works.

Lideron
Posts: 4
Joined: Fri Feb 05, 2010 2:45 am

Re: Name Highlighter

Post by Lideron »

Very handy script... I've run into one small issue though. When I do an hlclear, it echos the "Cleared all enemies", but all the enemies are still highlighted. It's supposed to go through all the pairs and delete the temp triggers. I know you mentioned, Vadi, there may be a bug in there, but I don't see it, looks pretty straightforward.

When I do 'city enemies' again, it will pull in the new enemies (most of the time, generally have to enter the command two or three times) and start highlighting them, but it still gives me all the unenemied people as well.

Usually exiting Mudlet and restarting gives me the correct highlighting. Any ideas on this one?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Name Highlighter v3

Post by Vadi »

Posted v3, fixes bug above

Ricktava
Posts: 11
Joined: Wed Mar 31, 2010 5:18 am

Re: Name Highlighter v3

Post by Ricktava »

I edited the script and changed it to Highlight Citizens of your city enjoy! I havent had it show any issues when thay are used togeather so just let me know if you find a issue.

works just the same but you use citizens insted of city enemies. Good for those who watch out for fellow citizens on deathsight in achaea.

EDIT: Also made one for city allies but im running into a issue between the citizen and allies packs Im working on it but Ill post here as I really have no clue waht to look for. Any help would be great thanks!

Second EDIT: well thay broke somehow and wont work at all now so Im turning this into a request for this type of thing thanks!

Fixed!: Have to use them in order of city enemies, city allies, and then citizens but thay are working togeather nicely the new Screenshot reflects the change also made the red a bit darker but you can always change that new package is working as fas as I know let me know if you have issues!
Attachments
NameHighlighterCeCaCitOe.xml.xml
(55.12 KiB) Downloaded 926 times
New Screenshot
New Screenshot
Last edited by Ricktava on Wed Aug 04, 2010 5:15 am, edited 1 time in total.

Parnakra
Posts: 35
Joined: Tue Apr 21, 2009 10:48 am

Re: Name Highlighter v3

Post by Parnakra »

I've also fiddled a bit with this script. My version currently works for city enemies and citizens. The order in which you load them in does not matter. Also, I took into account the fact that CITIZENS outputs a . at the end, as opposed to enemies - which meant the last citizen name would not be highlighted as expected.

Because I wasn't too sure what was going on with the loading/saving/persistency of the tables, I left some spaghetticode behind, but if/when I come back to this, I'll be sure to fix that up and make it a bit more generic/abstract.

For now, if you want to add another list (your personal allies/enemies/clanmembers (not sure how this is outputted), you'll have to:
  • create a similar trigger chain to capture the names (make sure you take into account the trailing point)
  • create a similar alias that makes sure the trigger chain is disabled after x amount of time
  • in the hl.main script, add these functions/this code (all similar to the existing ones):
    • add the line to save your list (choose a filename and list variable) to hl.saveAll()
    • add the code to load from a file to hl.init() (name of the file should match that in hl.saveAll()
    • hl.readFoo(map)
    • hl.clearFooTriggers()
You pass the colours you wish to use to the highlightPerson() function - background colours are optional and will only be shown if raid mode is enabled.
Attachments
namehighlighter.xml
(18.8 KiB) Downloaded 1016 times

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Name Highlighter v3

Post by Vadi »

Glad to see it helping serve as a jumping board :)

Denex
Posts: 5
Joined: Thu Oct 07, 2010 12:58 am

Re: Name Highlighter v3

Post by Denex »

Any chance of showing how to add additional cities citizens to the list? I have no idea where to even begin to code, it'd just be nice to be able to gather a list of CityX's citizens, to proc to the list as a seperate color. Hell, even a table listing you manually update would be great.

Post Reply