bind pub n !generate noreg:generate
proc noreg:generate {nick uhost hand chan text} {
if {![file exists "web.txt"]} {
putserv "PRIVMSG $chan :Sorry, the file seems not to exist."
return
}
set r [open "result.html" w]
puts $r "\
<html>
<head>
<meta http-equiv=\"Content-Language\" content=\"en-us\">
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
<title>NoReg</title>
</head>
<body>
<p><b><font face=\"Verdana\">NoReg</font></b></p>
<table border=\"0\" width=\"50%\" id=\"table1\"><tr>
<td bgcolor=\"#e6e6e6\" width=\"3%\"><font face=\"Verdana\" size=\"2\"><b>No.</b></font></td>
<td bgcolor=\"#e6e6e6\" width=\"15%\"><font face=\"Verdana\" size=\"2\"><b>Channel</b></font></td>
<td bgcolor=\"#e6e6e6\" width=\"60%\"><font face=\"Verdana\" size=\"2\"><b>Date added<b></font></td>
<td bgcolor=\"#e6e6e6\" width=\"22%\"><font face=\"Verdana\" size=\"2\"><b>Added by</b></font></td>
</font></tr>
<tr>"
set i 0
set f [open "web.txt" r]
while {[gets $f line]>-1} {
incr i
regsub -all -- {\002|,} $line "" line
set channel [lindex $line 1]
set date [lrange $line 4 8]
set by [lindex $line 10]
puts $r "\
<tr>
<td bgcolor=\"#f9f9f9\" width=\"3%\"><font face=\"Verdana\" size=\"2\">$i.</font></td>
<td bgcolor=\"#f9f9f9\" width=\"15%\"><font face=\"Verdana\" size=\"2\">$channel</font></td>
<td bgcolor=\"#f9f9f9\" width=\"60%\"><font face=\"Verdana\" size=\"2\">$date</font></td>
<td bgcolor=\"#f9f9f9\" width=\"22%\"><font face=\"Verdana\" size=\"2\">$by</font></td>
</tr>
"
}
puts $r "\
</tr>
</table>
</body>
</html>"
close $f
close $r
if {$i} {
putserv "PRIVMSG $chan :Page generated."
} {
putserv "PRIVMSG $chan :Sorry, the file seems to be empty."
set r [open "result.html" w]
puts $r "\
<html>
<head>
<meta http-equiv=\"Content-Language\" content=\"en-us\">
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">
<title>NoReg</title>
</head>
<body>
<p><b><font face=\"Verdana\">Sorry, the file seems to be empty.</font></b></p>
"
close $r
}
}
also, replace inside your script from to \002 if you want it with bold. Anyway, the page generated dosen't have bold on it. I've done it cos I'm borred and as an example so use it as one. Change it to suit your needs.
Once the game is over, the king and the pawn go back in the same box.