Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;**************
- ;* WOLFCOLORS *
- ;**************
- ;A script for coloring the names of players in #wolf
- ;BLAME ARAMIL
- ;Original code by nialo
- ;Preset colors by modargo
- ;Self-coloring by modargo
- ;Version 1.2.1, released 8/23/09 10:23
- */
- *************
- * CHANGELOG *
- *************
- * 1.1.0: Added coloring of emotes.
- * 1.1.1: Removed extraneous debug echoes.
- * 1.1.2: Fixed coloring for replacements
- * 1.2.0: Added coloring of own text and emotes, plus ability to easily disable it. Removed unnecessary piping code.
- * 1.2.1: Various minor clarifications to use instructions. Added testing instructions. Some additional comments.
- * Expanded installation instructions. Split installation instructions into new and upgrade sections.
- */
- ;****************
- ;* INSTALLATION *
- ;****************
- ;In mIRC, go to Tools -> Script Editor. Go to the Remote tab.
- ;IF YOU ARE INSTALLING WOLFCOLORS FOR THE FIRST TIME:
- ;Make a new script file (File -> New) and paste everything here into it
- ;Save the result as wolfcolors.mrc so you can easily locate it later (File -> Save As)
- ;(You do not need to use that specific name, but it helps to use something easy to remember)
- ;Check out the configuration section below
- ;IF YOU ARE UPGRADING FROM A PREVIOUS VERSION OF WOLFCOLORS:
- ;Find the previous version of the wolfcolors script. Replace everything in it with this new code, and save the result.
- ;Note that this will reset all the configuration changes you have made to the defaults.
- ;(If you have substantially changed the colors you are using, you may wish to record them so you can re-enter them).
- ;Check out the configuration section below.
- ;********************
- ;* USE INSTRUCTIONS *
- ;********************
- ;Script should automatically start at the beginning of a game
- ;and automatically deactivate at the end
- ;If it does not start, it can be manually started by doing /wcs (or /startwolfcolors)
- ;If it does not deactivate, it can be manually deactivated by doing /wce (or /endwolfcolors or /stopwolfcolors)
- ;The most recently used set of colors can be reactivated by doing /wca (or /activatewolfcolors) (warning: may have weird results)
- ;***********
- ;* TESTING *
- ;***********
- ;To verify that everything is working properly:
- ;1. Get a few people voiced in #wolf
- ;2. Do /wcs or /startwolfcolors
- ;3. Say the full nicks of some of the voiced people. If you have self-coloring on, the nicks should be colored.
- ;4. Have someone else say the full nicks of some of the voiced people. The nicks should be colored.
- ;*****************
- ;* CONFIGURATION *
- ;*****************
- ;You should configure the color lists below in startwolfcolors to your liking
- ;If you are using a default background or text color other than black or white,
- ;you probably want to edit the color configuration below to remove that color,
- ;as it is likely to be either invisible or indistinguishable from normal text
- ;You may want to change the background color for nicks
- ;You should also to consult the misc configuration section and fiddle with things
- alias startwolfcolors {
- ;*************************
- ;* BASICS OF MIRC COLORS *
- ;*************************
- ;The format for a color is: x,y
- ;Where x is an integer for the text color
- ;And y is an integer for the background color
- ;The comma and the background color may be ommitted, which causes the default background color to be used
- ;The color codes are as follows:
- ;0=white, 1=black, 2=dark blue, 3=dark green, 4=red, 5=brownish, 6=purple,
- ;7=orange, 8=bright yellow, 9=bright green, 10=tealish, 11=light blue,
- ;12=medium blue, 13=pink, 14=dark gray, 15=light gray
- ;**********************
- ;* MISC CONFIGURATION *
- ;**********************
- ;CHANGE THE 1 BELOW TO 0 IF YOU DO NOT WANT YOUR OWN MESSAGES COLORED
- set %wolf.color_own_messages 1
- ;************************
- ;* COLORS CONFIGURATION *
- ;************************
- ;CHANGE THIS TO THE COMPLETE LIST OF COLORS YOU WANT TO USE
- ;Colors are used in the order given: put marginal or ugly colors at the end
- ;set %wolf.colors.all 4 13 6 7 8 9 10 11 14 12 15 5
- ;Uncomment the below and comment out the above to have the background set to black
- set %wolf.colors.all 4,1 13,1 6,1 7,1 8,1 9,1 10,1 11,1 14,1 12,1 15,1 5,1
- ;*************************
- ;* PRESETS CONFIGURATION *
- ;*************************
- ;CHANGE THIS TO THE LIST OF PRESET NAMES/COLORS YOU WANT TO USE
- ;Each entry on the names list is given the color in the corresponding entry on the preset colors list
- ;free to add: 14 12 15 5
- set %wolf.presets.names modargo Kirushi ktulu ktulu- nialo Calisc LeeSharpe Leecifer Lee|work Wishthink Crispy` Crispy-
- ;Uncomment the below and comment out the above to disable presets entirely
- ;set %wolf.presets.names .
- ;set %wolf.presets.colors 7 13 6 6 8 4 11 11 11 9 10 10
- ;Uncomment the below and comment out the above to have the background set to black
- set %wolf.presets.colors 7,1 13,1 6,1 6,1 8,1 4,1 11,1 11,1 11,1 9,1 10,1 10,1
- ;IMPORTANT NOTES:
- ;Lists should be the same length
- ;Entries in each list should be unique
- ;If a player with a preset color is not in the game, their color may be used for someone else
- ;**************************************************
- ;* BEGINNING OF THE ACTUAL CODE *
- ;* DO NOT TOUCH UNLESS YOU KNOW WHAT YOU'RE DOING *
- ;**************************************************
- set %wolf.game 1
- set %wolf.colors
- set %wolf.colors.unused %wolf.colors.all
- if ($nick(#wolf, 0, v) > 0) {
- set %wolf.players.count $nick(#wolf, 0, v)
- set %i 1
- set %wolf.players
- while (%i <= %wolf.players.count) {
- set %wolf.curnick $nick(#wolf,%i,v)
- set %wolf.players $addtok(%wolf.players, %wolf.curnick, 32)
- ;If a player with a preset color is in the game,
- ;remove that color from the list of available colors
- if ($istok(%wolf.presets.names, %wolf.curnick, 32)) {
- set %wolf.toknum $findtok(%wolf.presets.names, %wolf.curnick, 32)
- set %wolf.curcolor $gettok(%wolf.presets.colors, %wolf.toknum, 32)
- set %wolf.toknum $findtok(%wolf.colors.unused, %wolf.curcolor, 32)
- set %wolf.colors.unused $deltok(%wolf.colors.unused, %wolf.toknum, 32)
- }
- inc %i
- }
- set %i 1
- set %wolf.players.count $numtok(%wolf.players,32)
- while (%i <= %wolf.players.count) {
- set %wolf.curnick $gettok(%wolf.players, %i, 32)
- ;If the player has a preset color, use that color
- ;Otherwise, take the first of the available unused colors
- if ($istok(%wolf.presets.names, %wolf.curnick, 32)) {
- set %wolf.toknum $findtok(%wolf.presets.names, %wolf.curnick, 32)
- set %wolf.curcolor $gettok(%wolf.presets.colors, %wolf.toknum, 32)
- }
- else {
- set %wolf.curcolor $gettok(%wolf.colors.unused, 1, 32)
- set %wolf.colors.unused $deltok(%wolf.colors.unused, 1, 32)
- }
- set %wolf.colors $addtok(%wolf.colors, %wolf.curcolor, 32)
- inc %i
- }
- }
- }
- ;Automatically activate/deactivate wolfcolors on +m/-m
- ;Note that activation on +m is currently disabled.
- ;Instead, activation on the "day 1 begins" message from Narrator is used.
- on *:mode:#wolf:{
- if ( *+m* iswm $1- ) {
- ;If for some reason you need to enable activation on +m,
- ;uncomment the line below
- ;timerwolfcolors 1 15 startwolfcolors
- }
- else if ( *-m* iswm $1- ) {
- timerwolfcolors off
- endwolfcolors
- }
- }
- ;Start wolf colors when Narrator says "day 1 begins" at the start of the game
- on *:notice:*day 1 begins*:#wolf:{
- if ( $nick == Narrator ) {
- startwolfcolors
- }
- }
- ;Give players that replace in the same color as the player they replaced
- on *:text:*replaces*:#wolf:{
- set %wolf.temp $gettok($3,1,$asc(.))
- set %wolf.temp $right(%wolf.temp, $len(%wolf.temp) - 1)
- set %wolf.newnick $strip($1)
- if ( ( $nick == Narrator ) && ( %wolf.temp isin %wolf.players ) ) {
- set %wolf.players $replace(%wolf.players,$+(%wolf.temp,$chr(32)),$+(%wolf.newnick,$chr(32)))
- }
- }
- ;Deactivate wolf colors
- alias endwolfcolors {
- set %wolf.game 0
- }
- alias stopwolfcolors {
- endwolfcolors
- }
- ;Makes wolf colors display again, but DOES NOT reset anything
- ;Uses whatever colors and names that were last used by the script
- alias activatewolfcolors {
- set %wolf.game 1
- }
- ;Shorter aliases for the start, end, and activate commands
- alias wcs {
- startwolfcolors
- }
- alias wce {
- endwolfcolors
- }
- alias wca {
- activatewolfcolors
- }
- ;Colors a nick based on the current active colors
- alias color_nick {
- set %wolf.color.nick $+ $gettok(%wolf.colors,$findtok(%wolf.players,$1,1,32),32) $+ $nick $+
- return %wolf.color.nick
- }
- ;Colors a line based on the current active colors
- alias color_line {
- set %wolf.color.text $1-
- set %wolf.color.counter 1
- while ( %wolf.color.counter <= %wolf.players.count ) {
- ;echo -tm #wolf %wolf.color.counter $gettok(%wolf.colors,%wolf.color.counter,32)
- set %wolf.color.replacement $+ $gettok(%wolf.colors,%wolf.color.counter,32) $+ $gettok(%wolf.players,%wolf.color.counter,32) $+
- set %wolf.color.text $replace(%wolf.color.text,$gettok(%wolf.players,%wolf.color.counter,32),%wolf.color.replacement)
- inc %wolf.color.counter
- }
- return %wolf.color.text
- }
- ;Processing for other people's lines
- on ^*:text:*:#wolf:{
- if ( %wolf.game == 1 ) {
- haltdef
- set %wolf.color.nick $color_nick($nick)
- set %wolf.color.text $color_line($1-)
- echo -tm #wolf < $+ [ %wolf.color.nick ] $+ > %wolf.color.text
- }
- }
- ;Processing for other people's emotes
- on ^*:action:*:#wolf:{
- if ( %wolf.game == 1 ) {
- haltdef
- set %wolf.color.nick $color_nick($nick)
- set %wolf.color.text $color_line($1-)
- echo -tm #wolf * [ %wolf.color.nick ] %wolf.color.text
- }
- }
- ;Processing for own lines and emotes
- on *:input:#wolf:{
- if ( ( %wolf.game == 1 ) && ( %wolf.color_own_messages == 1) ) {
- set %wolf.first_char $left($1,1)
- if ( ( %wolf.first_char != / ) || ( $1 == /me ) ) {
- haltdef
- if ( %wolf.first_char != / ) {
- set %wolf.color.nick $color_nick($nick)
- set %wolf.color.text $color_line($1-)
- echo -tm #wolf < $+ [ %wolf.color.nick ] $+ > %wolf.color.text
- .msg #wolf $1-
- }
- else {
- set %wolf.color.nick $color_nick($nick)
- set %wolf.color.text $color_line($2-)
- echo -tm #wolf * [ %wolf.color.nick ] %wolf.color.text
- .me $2-
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement