home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
ncolor13.zip
/
ncolor
Wrap
Text File
|
1996-12-30
|
10KB
|
305 lines
# ncolor irc script to assign colors under ircii 3.0 mikh code
# written by inkling, last edited: 01-Jan-97, version: 1.3
#
# you need mikhs' ircII 3.0 or later for OS/2 for this script to work
# or some other ircII client that supports ^c color and $% encoding
#
# HINT: latest mikh ircii3.0 works real well ;) ;)
#
# NOTE: you need to edit your .ircrc file pointed to by HOME
# LOAD NCOLOR
# at least if you want this script loaded automatically ;)
#
# NOTE:
# [] indicates optional parameters,
# {} indicates mandatory parameters,
# | indicates exclusive-or (either but not both)
#
# THESE ARE THE SUPPORTED COMMANDS:
# /ncload
# Load color definitions from ircolorc file in $HOME
#
# /ncsave
# Save color definitions to ircolorc file in $HOME
# NOTE: /exit will do an /ncsave automatically
#
# /nclist
# List all current color settings
#
# /ucolor color
# Sets the color of the things you type
#
# /ccolor color #chan {color | DEL}
# Sets #channel to color, the # is needed
# DEL removes channel color definitions
#
# /ncolor [ nick [color [MSG]] | [DEL] ]
#
# nick by itself shows nick color and msg settings
# nick color sets color of nicks' name only
# nick color MSG sets color of nicks' name and full msg text
# nick DEL removes all color definitions for nick
#
# color is given as 2 digit hexadecimal values, where:
# left digit (top nibble) background color
# right digit (bottom nibble) foreground color
#
#
# mod history:
#
# v1.0 first version up and working on PUBLIC on current channel
#
# v1.1 version doing most all public messages
#
# v1.1a fix to correct nick display on MSG
#
# v1.1b added the following features:
# PUBLIC_OTHER msgs in right color, channel left, nick right
# PUBLIC_NOTICE msgs in right color same as above
# NC nick DEL to delete definitions for nick
# NC nick color MSG to color on full msg text (default nick only)
#
# v1.1c added the following:
# fixed COLORMSG/COLORECHO to more generic. only COLORECHO now
# added color assignment save and load via NCSAVE and NCLOAD
# added channel colors for current and otherwise, CCOLOR or CC
# color settings are saved in $HOME/ircolorc
#
# v1.1d added the following:
# NCLIST to display current ncolor nicks in current colors
#
# v1.2 added following:
# removed limitations on nick/channel names via $%
# fixed nclist code to work with new $% encoded format
#
# NC works with [dolt] and _dolt_ now using $encode/$decode
# CC multiple channels now,
# EX: /CC #os/2 1F = #os/2 brt white on blue
# NOTE: nick colored will override channel settings
# NOTE: new support for illegal assign chars in nicknames
# and channels via the $% autoencode and $decode()
# functions, but only works on ircii30.zip + later
# v1.2a added the following:
# CCOLOR changes will echo current channel in its set color
# CC set channels will NOT display #chan# info, color clue only
#
# fixed /ME messages from current and other channels
# fixed bad parsing of CC resulting in garbage on NCLIST
# fixed up documentation at top of file to reflect new changes
#
# v1.3 rewrote logic on channel/nick color display
# instead of creating separate ON commands for each chan/nick it will
# use a single ON command for each possible message type. the color
# lookup is done in the ncolorecho routine now. the memory usage with
# this method is 1/n of previous method, where n is the number of
# chan/nicks stored in the ncolor array. bye bye wasteful ON programming
#
# limitations:
# It seems to work better if loaded after your favorite script.
#
# disclaimer:
# This program is NOT guaranteed to work.
# USE IT AT YOUR OWN RISK!
#
# thanks:
# to mikh for doing such a nice job with the ircII port for OS/2!
# to anyone using this script in spite of all the peculiarities!
#
# *mikh* /eval echo $decode($%{[blah]})
# *mikh* will display blah
#
#
# GMJ/lms
eval set cntlc_colors on
set -input_prompt
set novice off
echo 0CN0BC0AO0DL0EO07R v1.3 for mikhs' ircII (3.0 or later) port for OS/2
#
# this is the ncolor chan/nick lister
#
alias nclist
{
^set hold_mode on
echo *** 0CN0BC0AO0DL0EO07R CHANNEL colors:
foreach ncolor.chan jj
{
if ( [$ncolor.chan[$jj]] != [] )
{ echo $ncolor.chan[$jj] $decode($jj) $ncolor.chan[$jj] }
}
echo *** 0CN0BC0AO0DL0EO07R NICKNAME colors:
foreach ncolor ii
{
if ( [$ncolor[$ii]] != [] )
{
if ( [$ncolor.msg[$ii]] != [] )
{ echo $ncolor[$ii] $decode($ii) $ncolor[$ii] $ncolor[$ii]$ncolor.msg[$ii] }
{ echo $ncolor[$ii] $decode($ii) $ncolor[$ii] }
}
}
^set hold_mode off
}
#
# this is the channel color section
# channel colors! now you can color any channel to any default you want.
# nickname colors will override the channel colors.
# $0 is channel
# $1 is color to set channel to
# NOTE: both parms need to be specified, i.e. /cc #OS2 1F, use /nclist to see
alias cc ncolorchannel
alias ccolor ncolorchannel
alias ncolorchannel
{
if ( [$1] != [] )
# means only do this if two parms passed
{
# delete old info for new assignment
^assign -ncolor.chan[$%0]
# check to see if there will be new assignments
if ( [$1] != [DEL] )
{
^assign ncolor.chan[$%0] $1
}
}
}
# this is for making other nicks messages in color
alias nc ncolornick
alias ncolor ncolornick
# ncolornick definitions
# $0 is nickname
# $1 is color (00-FF) or DEL to stop after removing definitions
# $2 is MSG to enable color nick and message (default is nick only)
alias ncolornick
{
if ( [$0] == [] )
{ echo 0CN0BC0AO0DL0EO07R v1.3 0CUsage: 0B/ncolor [ 0Dnick 0E[ color [MSG] ] | 0D[DEL] 0B] }
# implied else follows
{
if ( [$1] == [] )
{
if ( [$ncolor[$%0]] != [] )
{ echo 0CN0BC0AO0DL0EO07R nickname $ncolor[$%0]$00F color $ncolor[$0] }
}
# this reached if $0 and $1 nonblank
{
# remove any old color code and msg flags for this nick
^assign -ncolor[$%0]
^assign -ncolor.msg[$%0]
# if not DEL specified (meaning done) then add nick color
if ( [$1] != [DEL] )
{
# specify the ncolor nick to add the color (simplicity itself)
^assign ncolor[$%0] $1
# check to enable flag for whole message text to be displayed in color
if ( [$2] == [MSG] ) {^assign ncolor.msg[$%0] MSG}
}
}
}
}
# $0 is nick, $1 is channel $2 is nickformat and $3 is full msg text
# this will display channel color (if exists) then nick color,
# then nickformat, then message. if the color hasnt been assigned
# it will display NULL character hopefully
#
# this echos nick in color if ncolor.$nick non-blank
# and msg text in color if ncolor.msg.$nick non-blank
alias ncolorecho
{
if ( [$ncolor.msg[$%0]] != [] )
{ echo $ncolor.chan[$%1]$ncolor[$%0]$2 $3- }
{ echo $ncolor.chan[$%1]$ncolor[$%0]$2$ncolor.chan[$%1] $3- }
}
alias ncload
{
echo 0CN0BC0AO0DL0EO07R loading ircolorc file...
load $HOME/ircolorc
}
# this will allow saving of current ncolor settings
# no abbreviation but it is run automatically with /exit
alias ncsave
{
^on ^exec_error "ncsave *" #
eval ^exec -name ncsave rm $HOME/ircolorc
wait %ncsave
eval ^exec -name ncosave cat >> $HOME/ircolorc
^msg %ncosave # ncolor save file
if ( [$ncolor..user] != [] )
{ ^msg %ncosave ucolor $ncolor..user }
# write all current channel colors to file
foreach ncolor.chan jj
{
if ( [ncolor.chan[$jj] != [] )
{ ^msg %ncosave ccolor $decode($jj) $ncolor.chan[$jj] }
}
# write all current nick colors to file
foreach ncolor ii
{
if ( [$ncolor[$ii]] != [] )
{ ^msg %ncosave ncolor $decode($ii) $ncolor[$ii] $ncolor.msg[$ii] }
}
echo 0CN0BC0AO0DL0EO07R saved ircolorc file...
^on ^exec_error -"ncsave *"
^exec -close %ncosave
wait %ncosave
}
# this will save the color settings when you exit
alias exit
{
ncsave
//exit
}
# this is for making all my own messages in color
alias uc ncoloruser
alias ucolor ncoloruser
alias ncoloruser
{
^assign ncolor..user $0
ncolor ${N} $0 MSG
}
# specify the current user (you) colors for messages sent by you
#
on ^send_action * echo $ncolor..user* ${N} $1-
on ^send_msg * echo $ncolor..user*$0* $1-
on ^send_notice * echo $ncolor..user-$0: $1-
on ^send_public * echo $ncolor..user<${N}> $1-
#
# specify a generic color lookup for all these possible msgs
# ACTION, MSG, NOTICE, PUBLIC and PUBLIC_OTHER, PUBLIC_NOTICE
##
###
####
##### here is where you can put some customizations (change whats below)
####
###
##
#
on ^action * {/ncolorecho $0 $1 ->$0 $2-}
on ^msg * {/ncolorecho $0 $C *$0* $1-}
on ^notice * {/ncolorecho $0 $C +$0+ $1-}
on ^public * {/ncolorecho $0 $1 <$0> $2-}
on ^public_notice * {/ncolorecho $0 $1 +$0:$1+: $2-}
on ^public_other * {/ncolorecho $0 $1 <$0:$1> $2-}
#
# as last thing, load all the current colors defined in ircolorc
#
ncload
#
# GMJ/lms 1/1/97