www.ClassicTW.com
https://mail.black-squirrel.com/

ANSI Colors
https://mail.black-squirrel.com/viewtopic.php?f=15&t=30838
Page 1 of 1

Author:  Promethius [ Sun Jan 09, 2011 2:49 pm ]
Post subject:  ANSI Colors

While doing a complete rewrite on my colonizing script, I got tired of using ANSI_12 ($red), ANSI_11 ($cyan) all of the time for my echos, so I did what I thought TWX should have - gave the colors descriptive names. If you want a detailed tutorial, visit http://www.navhaz.com and the TW-Cabal link ( http://tw-cabal.navhaz.com/strategy/twxansitricks.html ). The link also has some information on preventing spoofing.

BTW, do not accidently type "send $white" rather than "echo $white". Strange things will probably happen, and most likely not good.

ah, proEcolonizer (or proEZcolonizer) will be released in a couple of weeks as version 5 if all goes well and testing works out. The version jump is mainly due to simplifying its use, speeding it up, removal of "All keys" usage, a bug fix, and two new colonizing modes, - one of which may never be used, but in the right situation might be good to have. The script is not BOT friendly, and I have no desire to make it that way.

Code:
setVar $i 30
goSub :ansi
echo $cls
while ($i <= 37)
    setVar $intenseColor #27 & "[1;" & $i & "m"
    echo $intenseColor & "*Intense Color*"
    if ($i = 30)
    # black (30) will not show unless "intense" on a black background
       echo $blackWhite "Can't see black/black so..*" $resetBlack
    else
       setVar $color #27 & "[0;" & $i & "m"
       echo $color & "Normal  Color*"
    end
    add $i 1
end
halt

#---------- goSubs ----------
:ansi
  # $cls clears the screen
  setVar $cls #27 & "[2J"
  setVar $black #27 & "[1;30m"
  setVar $red #27 & "[1;31m"
  setVar $green #27 & "[1;32m"
  setVar $yellow #27 & "[1;33m"
  setVar $blue #27 & "[1;34m"
  setVar $magenta #27 & "[1;35m"
  setVar $cyan #27 & "[1;36m"
  setVar $white #27 & "[1;37m"
  setVar $darkRed #27 & "[0;31m"

  # with background (add 10 to base color for background: #27 & "[1;37;41m" (41 is red)
  setVar $whiteRed #27 & "[1;37;41m"
  setVar $redWhite #27 & "[1;31;47m"
  setVar $blackWhite #27 & "[0;30;47m"

  # resets background to black with white text
  setVar $resetBlack #27 & "[1;37;40m"
return

Author:  ElderProphet [ Sun Jan 09, 2011 8:50 pm ]
Post subject:  Re: ANSI Colors

That's actually a really good idea for TWX.

Author:  Promethius [ Mon Jan 10, 2011 9:38 pm ]
Post subject:  Re: ANSI Colors

I agree it would be great to have the descriptive colors in addition to the ANSI_xx so it doesn't break scripts. Actually, I don't know why I didn't write that snippet a long time ago. Traitor did some very nice work on the TW-Cabal page and that is where I got the ANSI codes.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/