Yes, there are a few issues to point out, regarding the script.
Code: Select all
set runchan "#weirdo"
bind pub - !rules2 pub:chanrule2
proc pub:chanrule2 { nick host hand chan text} {
global runchan rulefile ruletext
if {$chan != $runchan} {return 0}
if {![file exists text/rules.file]} {
set rulefile [open text/rules.file r]
set ruletext [read $rulefile 1000]
close $rulefile
}
putserv "Notice $nick :$ruletext"
}
First, the "putserv" command is triggered, even if the file does not exist.
Second, you have set the "ruletext" variable global. There is no need to do this, unless you have a need to access the variable outside of the script.
Third, you use the "read" command to read the file. This will read from the current position int he file (you can be located at any point other than the start) up to the end of output (in the case of a file, the end of it). This includes any newline characters (ie, the start of the next line in the file). When outputing this to a IRC server, it will display only the first line, because IRC server interpret the newline as the end of the current command, then treats the next line, as a whole new command (which causes an error).
You need to split the output into chunks, in needed.
And lastly, the main cuase of the problem
Code: Select all
if {![file exists text/rules.file]} {
This states, if the file does not exist, read the file (contradiction of statments).
Simply remove the !.
You should then move the putserv within the IF block, so it is only tirggered if the file exists (AKA, only tigger if data is available).