Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Sun Apr 18, 2004 3:08 am   

CaebColor (a zChat Helper) Update
 
//CaebColor Update
//Updating All My Scripts now
//Changes: First CaebColor was real bad but somehow worked:P
// Fixed now does background colors too

//CaebColor is a little function I wrote for zChat to correctly display color to
//Mudmaster Users. I wrote it as a function so I could easily search and replace
//my %ansi calls with @CaebColor, but although similar it does not offer all the
//functionality that %ansi has.
//
//Examples:
//Colors it accepts for forecolor
//black blue green red cyan magenta yellow white
//these all may be prefixed with "reset," or "bold," to get
//either the bold or reset version of each color, also know
//that reset, blue is the same as just blue. (added it to be compatible with %ansi)
//backcolor only accepts the color names no reset or bold since all must be
//a 'reset' color anyway
//reset as your color by itself sets it to your default forecolor
//and bold by itself changes to using bold of the previous color
//@CaebColor(forecolor, backcolor) ==SYNTAX
//@CaebColor(reset, blue, black) ==gives you dim blue on black background
//@CaebColor(bold,blue) ==gives you bold blue on current background
//@CaebColor(bold,yellow,yellow) ==gives you bold yellow on reset yellow
//
//Last but not least if you do not use this function correctly
//Let's say you do @CaebColor(blue,blue,blue) which is incorrect
//because the only time 3 parameters is acceptable is when the first is reset or bold
//you wont get an error message, theres no "error checking" so make sure you use it right :)

//All my scripts
//ZTrader, ZMaverick, etc require this script btw

#DELCLASS {CaebColor}

#CLASS CaebColor
#VARIABLE CCTypeList {bold|reset}
#VARIABLE CCNameList {black|blue|green|cyan|red|magenta|yellow|white|reset|bold}
#VARIABLE CCForeList {30|34|32|36|31|35|33|37|0|1}
#VARIABLE CCBackList {40|44|42|46|41|45|43|47}
#FUNCTION CCFore {%item(@CCForeList,%ismember(%1,@CCNameList))}
#FUNCTION CCBack {%item(@CCBackList,%ismember(%1,@CCNameList))}
#FUNCTION CaebColor {%if(%3,@CC3(%1,%2,%3),%if(%2,@CC2(%1,%2),@CC1(%1)))}
#FUNCTION CC1 {%e[@CCFore(%1)m}
#FUNCTION CC2 {%if(%ismember(%1,@CCTypeList),@CC2FC(%1,%2),@CC2BG(%1,%2))}
#FUNCTION CC3 {%e[@CCFore(%1);@CCFore(%2);@CCBack(%3)m}
#FUNCTION CC2FC {%e[@CCFore(%1);@CCFore(%2)m}
#FUNCTION CC2BG {%e[@CCFore(%1);@CCBack(%2)m}

#ALIAS ccalltest {cc1test;cc2fctest;cc2bgtest;cc3test}
#ALIAS cc1test {#FORALL @CCNameList {#SHOW @CaebColor(%i)CC1Test %i}}
#ALIAS cc2fctest {#FORALL @CCTypeList {#FORALL @CCNameList {#SHOW @CaebColor(%i,%j) CC2FCtest %i %j}}}
#ALIAS cc2bgtest {#FORALL @CCNameList {#FORALL @CCNameList {#SHOW @CaebColor(%i,%j) CC2BGtest %i %j}}}
#ALIAS cc3test {#FORALL @CCNameList {#FORALL @CCNameList {#SHOW @CaebColor(bold,%i,%j)CC3Test %i %j}}}
#CLASS 0
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net