home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
ircii30.zip
/
script2
/
ncolor
< prev
next >
Wrap
Text File
|
1996-02-03
|
7KB
|
195 lines
# ncolor irc script to assign a color to any regular msgs from a nickname
# written by inkling 30-Jan-96 v1.1c
#
# you need mikhs' ircII beta 2.2 or later for OS/2 for this script to work
# or some other ircII client that supports control c color schemes
#
# NOTE: you need to edit your .ircrc file pointed to by $HOME
# LOAD NCOLOR
#
# NOTE: do /NCSAVE the very first time you run this to create ircolorc
# otherwise you might get an error message if you try /ncload
#
# the four commands for this script
# /ncsave save color definitions to ircolorc file
# /ncload load color definitions from ircolorc file
# /ucolor color will set your color
# /ncolor nick [color [MSG] ] | [DEL]
# [] indicates optional, | indicates or (but not both)
# nick by itself shows color and value assigned to nick
# 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/echo to more generic. only /colorecho now
# added color assignment save and load via /ncsave /ncload
# added different channel colors for current and other /cc
# color settings are saved in $HOME/ircolorc
#
# limitations:
# it seems to work better if loaded after your favorite script
# wont handle special chars in nick name. assign doesnt like em
# 'ncolor |dolt| 1c' wont work, but 'ncolor _dolt_ 1c' will.
#
# disclaimer:
# this program is not guaranteed to work.
# use it at your own risk.
#
eval set cntlc_colors on
set -input_prompt
set novice off
echo 0CN0BC0AO0DL0EO07R 1.1c for mikhs' ircII (2.4 or later) port for OS/2
# channel colors. only supporting two colors right now, color for the
# current channel you are on and channels that you are on but no window
# unlike the user color codes, these colors are not stored in an array
# $0 is color to set current channel
# $1 is color to set non-current channel to
alias cc ncolorchannel
alias ccolor ncolorchannel
alias ncolorchannel
{
if ( [$0] != [] )
{
^assign ncolor..current $0
^on ^public "% % *" {/echo $ncolor..current<$0> $2-}
}
if ( [$1] != [] )
{
^assign ncolor..other $1
^on ^public_other "% % *" {/echo $ncolor..other<$1:$0> $2-}
}
}
# 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.1c 0AUsage: 0B/ncolor nick 0E[ color [MSG] ] | 0D[DEL]
}
{
if ( [$1] == [] )
{
if ( [$ncolor[$0]] != [] )
{ echo 0CN0BC0AO0DL0EO07R nickname $ncolor[$0]$007 color $ncolor[$0] }
}
{
# this reached if $0 and $1 nonblank
# remove any old ON cmds for this nick
^on ^action -$0
^on ^msg -$0
^on ^notice -$0
^on ^public -$0
^on ^public_other -$0
^on ^public_notice -$0
# remove any old color code and msg flags for this nick
^assign -ncolor.$0
^assign -ncolor.msg.$0
# see if DEL was used in place of color. if so, we're done
# othwise add nick color responses
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}
# respond to the following ON message types matching nick
# ACTION, MSG, NOTICE, PUBLIC and PUBLIC_OTHER, PUBLIC_NOTICE
^on ^action $0 {/ncolorecho $0 *$0 $2-}
# for jcc ^on ^msg $0 {/ncolorecho $0 *$0* $1-}
^on ^notice $0 {/ncolorecho $0 -$0: $1-}
^on ^public $0 {/ncolorecho $0 <$0> $2-}
^on ^public_notice $0 {/ncolorecho $0 -$1:$0: $2-}
^on ^public_other $0 {/ncolorecho $0 [$1:$0] $2-}
}
}
}
}
# $0 is nick, $1 is style and $2 is full msg text
# this echos nick in color and msg text if ncolor.msg.$nick non blank
alias ncolorecho
{
@ncolor..temp = ncolor[$0]
if ( [$ncolor.msg[$0]] != [] )
{ echo $ncolor..temp$1 $2- }
{ echo $ncolor..temp$1$color_normal $2- }
}
alias ncload
{
echo 0CN0BC0AO0DL0EO07R loading ircolorc file...
load $HOME/ircolorc
}
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 }
if ( [$ncolor..current] != [] )
{ ^msg %ncosave ccolor $ncolor..current $ncolor..other }
foreach ncolor ii
{
if ( [$ncolor[$ii]] != [] )
{ ^msg %ncosave ncolor $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
}
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-
ncload