| View previous topic :: View next topic |
| Author |
Message |
mr_fanatic Voice
Joined: 31 Aug 2007 Posts: 11
|
Posted: Fri Aug 31, 2007 4:16 am Post subject: trivial.tcl html output |
|
|
Greetings egg lovers,
I've been using this tcl (trivia.tcl v1.3.4 by Graeme Donaldson) for 2 years and works perfectly fine till now. But i have problem regarding the HTML output generated by the tcl. When generating, it gives the output mixing the @ops, normal ops and voices nick. What i mean is, how can the tcl be modified in such a way that it will displayed as the example i've given below:
Nick Score Rank Idle
@nick1 7364 14 1m
@nick2 - - 5m
@nick3 786 76 10m
+nick4 76 99 50m
+nick5 - - -
normalnick1 768 67 20m
normalnick2 - - -
normalnick3 - - -
normalnick4 76776 4 80m
normalnick5 - - -
normalnick6 - - -
etc.
that is, the @OP's nick at the 1st, Voices nick at the second and normal nick on the bottom. Here is the original html part of the tcl.
| Code: | foreach nick [lsort [chanlist $tgchan]] {
puts $_file " <tr>"
puts $_file " <td>[expr [isop $nick $tgchan]?"@":""][expr [isvoice $nick $tgchan]?"+":""]$nick[expr [string match $nick $botnick]?" (that's me!)":""]</td>"
if {[info exists tgscoresbyname([strlwr $nick])]} {
puts $_file " <td>$tgscoresbyname([strlwr $nick])</td>"
} else {
puts $_file " <td>-</td>"
}
if {[info exists tgranksbyname([strlwr $nick])]} {
puts $_file " <td>$tgranksbyname([strlwr $nick])</td>"
} else {
puts $_file " <td>-</td>"
}
puts $_file " <td>[expr [getchanidle $nick $tgchan]>10?"[getchanidle $nick $tgchan]m":"-"]</td>"
puts $_file " </tr>"
} |
|
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Fri Aug 31, 2007 11:22 am Post subject: |
|
|
You could try something like this, bare in mind its not tested:
| Code: | set op ""
set voice ""
set reg ""
foreach nick [lsort [chanlist $tgchan]] {
if {$nick == ""} { return }
set line1 " <td>-</td>"
set line2 " <td>-</td>"
if {[info exists tgscoresbyname([string tolower $nick])]} {
set line1 " <td>$tgscoresbyname([string tolower $nick])</td>"
}
if {[info exists tgranksbyname([string tolower $nick])]} {
set line2 " <td>$tgranksbyname([string tolower $nick])</td>"
}
if {[isop $nick $tgchan]} {
lappend op " <tr>\n@$nick\n$line1\n$line2\n <td>[expr [getchanidle $nick $tgchan]>10?"[getchanidle $nick $tgchan]m":"-"]</td>\n </tr>"
} elseif {[isvoice $nick $tgchan]} {
lappend voice " <tr>\n+$nick\n$line1\n$line2\n <td>[expr [getchanidle $nick $tgchan]>10?"[getchanidle $nick $tgchan]m":"-"]</td>\n </tr>"
} else {
lappend reg " <tr>\n$nick\n$line1\n$line2\n <td>[expr [getchanidle $nick $tgchan]>10?"[getchanidle $nick $tgchan]m":"-"]</td>\n </tr>"
}
}
foreach line "[join "$op $voice $reg" "\n"]" {
if {$line == ""} { return }
puts $_file "$line"
}
}
|
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
mr_fanatic Voice
Joined: 31 Aug 2007 Posts: 11
|
Posted: Sun Sep 02, 2007 7:25 am Post subject: |
|
|
it works but gives output like this:
@nick1 @nick2 @nick3 +nick4 +nick4 etc. |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Sun Sep 02, 2007 1:30 pm Post subject: |
|
|
Can you give me the url of the html file/log. _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
oxygen Voice
Joined: 05 Sep 2005 Posts: 22 Location: Germany
|
Posted: Sun Sep 23, 2007 4:44 am Post subject: |
|
|
Hello mr_fanatic
Try this:
| Code: |
set _op ""; set _vo ""; set _reg "";
foreach nick [lsort [chanlist $tgchan]] {
if {[isop $nick $tgchan]} {
lappend _op $nick
} elseif {[isvoice $nick $tgchan]} {
lappend _vo $nick
} else {
lappend _reg $nick
}
}
set _chanlist [join "$_op $_vo $_reg"]
foreach nick $_chanlist {
puts $_file " <tr>"
puts $_file " <td>[expr [isop $nick $tgchan]?"@":""][expr [isvoice $nick $tgchan]?"+":""]$nick[expr [string match $nick $botnick]?" (that's me!)":""]</td>"
if {[info exists tgscoresbyname([strlwr $nick])]} {
puts $_file " <td>$tgscoresbyname([strlwr $nick])</td>"
} else {
puts $_file " <td>-</td>"
}
if {[info exists tgranksbyname([strlwr $nick])]} {
puts $_file " <td>$tgranksbyname([strlwr $nick])</td>"
} else {
puts $_file " <td>-</td>"
}
puts $_file " <td>[expr [getchanidle $nick $tgchan]>10?"[getchanidle $nick $tgchan]m":"-"]</td>"
puts $_file " </tr>"
}
|
Regards,
werner |
|
| Back to top |
|
 |
|