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.
Help for those learning Tcl or writing their own scripts.
iNFERNiS
Voice
Posts: 13 Joined: Tue Aug 21, 2007 11:03 am
Post
by iNFERNiS » Fri Nov 02, 2007 3:29 pm
I'm very new to tcl and coding in general. I wanted to make a simple script that reads from a textfile, grabs a random line and outputs it to a channel, with a public trigger.
Suffice to say i failed horribly, i'm kind of stuck now. Can someone point me into the right direction?
bind pub o|o !randtext pub:randtext
proc pub:randtext { } {
putserv "PRIVMSG $channel : randline("randomness.txt")"
}
proc randline {file} {
set fs [open $file r]
set data [read -nonewline $fs]
close $fs
return [lindex $data [expr {int(rand()*[llength $data])}]]
}
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Fri Nov 02, 2007 8:07 pm
Start off with a basic TCL tutorial first, your code doesn't look like TCL to me :p
iamdeath
Master
Posts: 323 Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:
Post
by iamdeath » Sat Nov 03, 2007 4:46 am
metroid wrote: Start off with a basic TCL tutorial first, your code doesn't look like TCL to me :p
That was rude
|AmDeAtH @ Undernet
Death is only the *Beginning*...