This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

question about colours and variable

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

question about colours and variable

Post by ultralord »

hello i want to ask something is is possible to set colour and something

like that :




set nick1 "\00304 $nick \003" and then if somewhere on proc the variable nick1 runs the \00304 $nick \003 == $nick ...?

i want to set one nick with colour and the result i want to be a colour but i dont want to set colour on the result variable but from begging


thnx
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

set nick1 "\00304${nick}\003"
if {[string equal [stripcodes bcruag $nick] $nick1]} {
	putlog "Equal :D"
}{
	putlog "Not Equal :("
}
Use stripcodes, and definitely don't want to pad left/right with spaces. Stripcodes won't correct those spaces.

Code: Select all

set nick1 "\00304${nick}\003"
Stripcodes will correctly return "Equal" with the code conditions above if it were built within a real procedure. Notice I've used braces to denote the variable name so the interpreter doesn't get confused because it's not spaced out as yours was. This also makes it easier to spot the variable name within a segement of escape codes.
User avatar
ultralord
Master
Posts: 255
Joined: Mon Nov 06, 2006 6:52 pm

Post by ultralord »

thnx a lot :DD do you know where i can find the code for bold and other fuction?


thnx again
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

http://tclhelp.net/#faqcolor

If you want to make life simple on yourself, use a proc to bold/etc text, such as:

Code: Select all

proc bold {text} {
  return "\002${text}\017"
}

putserv "PRIVMSG $chan :[bold "this text is bold!"]"
Note \017 is "reset", as in for everything (color, bold, underline).
Post Reply