Author Topic: TCL  (Read 2882 times)

0 Members and 1 Guest are viewing this topic.

_player1537

  • Guest
TCL
« on: September 18, 2010, 01:38:48 am »
<3 now (especially when I learn to do graphics with it ^^).  Found it on Alberthro's server, and started playing with it.  In <20 minutes, I had this:
Code: [Select]
proc 99bottles {} {
for { set i 99 } {$i > 0} {incr i -1} {
puts "$i bottles of beer on the wall!"
puts "$i bottles of beer!"
puts "Take one down, pass it around!"
set a [expr $i -1] 
if {$a > 1} {puts "$a bottles of beer on the wall!" }
if {$a == 1} {puts "1 bottle of beer on the wall!" }
after 500
puts ""
}
puts "No bottles of beer on the wall!"
}

And of course, no programming language would be complete without one of these ;)
Code: [Select]
proc quad {a b c} {
set x1 [expr pow($b,2) - (4 * $a * $c)]
incr a $a
set b [expr $b * -1]
if {$x1 < 0} {
puts "Undefined / NaN"
} {
puts "X = [expr ($b + sqrt($x1)) / $a],[expr ($b - sqrt($x1)) / $a]"
}
}


Going to play with this more later today or tomorrow :)

(Btw, http://en.wikipedia.org/wiki/Tcl )

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TCL
« Reply #1 on: September 18, 2010, 02:02:13 am »
Darn I haven't looked at that in ages. I used to have an eggdrop in 2005. Unfortunately I never got to understand TCL nor how to use external scripts x.x

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: TCL
« Reply #2 on: September 18, 2010, 02:50:33 am »
Wait, so what is this exactly?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

_player1537

  • Guest
Re: TCL
« Reply #3 on: September 18, 2010, 02:56:02 am »
Tool Command Language (pronounced "Tickle").  Basically, it was designed to be an easier to use programming language (or more-so, shell language).  Every variable is really a string.  In other words, (oh and "set varname varvalue" is the equivilence of "varname = varvalue" and "varvalue -> varname")
set Variable 5
is really storing "5" to the variable Variable.  This string gets changed into a number when it is being acted upon like a number.

Err... that was random...  It's just a shell scripting language that's supposed to be more readable and easy :)  A lot of people use it for IRC bots (Melisma in #cemetech for example). 

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: TCL
« Reply #4 on: September 18, 2010, 03:02:33 am »
Ah ok. Cool. What are those two code examples you put?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

_player1537

  • Guest
Re: TCL
« Reply #5 on: September 18, 2010, 03:08:24 am »
The first one is the classic 99 bottles of beer program.  The second the quadratic formula.  To call them from the TCL Shell, you do:
Code: [Select]
99bottlesand
Code: [Select]
quad 1 1 -20
Of course, the quad program takes different arguments depending on what you give it.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: TCL
« Reply #6 on: September 18, 2010, 03:14:20 am »
Ah ok, cool :)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)