Recently found the TCL shell on alberhtro's server, so I started playing with it. In less than 20 minutes, I had this beauty written out Razz

Code:
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!"
}


I'll be adding a check to see if it is the last bottle, and fix the pluralization (or lack there-of)
I don't see an "if {$a = 1} {puts "1 bottle of beer on the wall!" }" line as we discussed in IRC. Smile Congrats on your initial forays into TCL; I hope you'll see be writing modules for Melisma.
Now there is Wink Melisma is the bot that gives you OPs, isn't it? And the quiz bot?
_player1537 wrote:
Now there is Wink Melisma is the bot that gives you OPs, isn't it? And the quiz bot?
That's the one! In fact, every eggdrop uses TCL scripts for modules and features.
I tried getting eggdrop on Alberthro's server, but I'm not sure if I can download anything on it...

On another note, what's something else I can try to write in TCL (beginner please)
_player1537 wrote:
I tried getting eggdrop on Alberthro's server, but I'm not sure if I can download anything on it...

On another note, what's something else I can try to write in TCL (beginner please)
Hmm, did you try all the TI standards? Guessing game, quadratic solver, etc?

Code:
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]"
}
}

Very Happy
The quadratic equation is over 2a, not just a, but good job nonetheless. Smile

Code:
incr a $a

This is the same as 2 * A -> A
_player1537 wrote:

Code:
incr a $a

This is the same as 2 * A -> A
Ah, I thought that that meant A+1->A in TCL, my mistake. Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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

 

Advertisement