bind pub - !fact pub_fact
proc pub_fact {nick mask hand channel args} {
global fact
puthelp "PRIVMSG $channel :[lindex $fact [rand [llength $fact]]]"
}
set fact {
"\" 's tears cure cancer. Too bad he has never cried. Ever.\""
_______________________________________________--
I am a total newb when it comes to tcl... if it were irc scripting, it would have been up and running... lol... I tried a few things and just ended up with errors. I did at least try, so I'm not just someone who wants ppl to do work for me, just know somone else can look at this and redo it in a matter of a minute. And that would make my life so much easier. So please someone hook me up with a moment of your time and post a solution for my needs.
Last edited by b4ugobye on Thu May 25, 2006 8:55 pm, edited 1 time in total.
missed that edit, but fixed... normally the chuck script reads a random line from the set fact (set chuck previously)
eg: "\"Chuck Norris is not Politically Correct He is just Correct Always.\""
my goal is to make the trigger !fact <nick>
so when you do !fact b4ugobye:
it sends to chan:
b4ugobye (read from set facts)is not Politically Correct He is just Correct Always.
b4ugobye wrote:in reality, I just need this one line converted to tcl, then I can make a txt file named facts.txt.
On *:TEXT:!fact*:#: Set %fact $read(facts.txt) | /msg $chan $2 %fact }
Ok, please convert all the variable to expanded functions first. Quite a lot of us do not use that IRC client. so you have to epand out what "%fact" and "$read" actually are.
This identifier works in conjunction with the /write command.
//echo $read(funny.txt)
Reads a random line from the file funny.txt.
[........]
If the n switch is specified then the line read in will not be evaluated and will be treated as plain text.
If the p switch is specified, command | separators are treated as such instead of as plain text.
If the first line in the file is a number, it must represent the total number of lines in the file. If you specify N = 0, mIRC returns the value of the first line if it's a number.
If the t switch is specified then mIRC will treat the first line in the file as plain text, even if it is a number.
bind pub - !fact pub_fact
proc pub_fact {n u h c t} {
set fl [open fact.txt]
set data [read $fl]
close $fl
set lines [split $data \n]
set randline [lindex $lines [rand [llength $lines]]]
putserv "privmsg $c $randline"
}
bind pub - !fact pub_fact
proc pub_fact {n u h c arg} {
set fl [open fact.txt]
set data [read $fl]
set arg [split $arg]
set x [lindex $arg 0]
close $fl
set lines [split $data \n]
set randline [lindex $lines [rand [llength $lines]]]
putserv "privmsg $c $x $randline"
}