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.

trivial.tcl html output

Support & discussion of released scripts, and announcements of new releases.
Post Reply
m
mr_fanatic
Voice
Posts: 11
Joined: Fri Aug 31, 2007 4:04 am

trivial.tcl html output

Post by mr_fanatic »

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: Select all

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>"
		}
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

You could try something like this, bare in mind its not tested:

Code: Select all

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
m
mr_fanatic
Voice
Posts: 11
Joined: Fri Aug 31, 2007 4:04 am

Post by mr_fanatic »

it works but gives output like this:

@nick1 @nick2 @nick3 +nick4 +nick4 etc.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Can you give me the url of the html file/log.
r0t3n @ #r0t3n @ Quakenet
o
oxygen
Voice
Posts: 22
Joined: Mon Sep 05, 2005 2:22 pm
Location: Germany

Post by oxygen »

Hello mr_fanatic

Try this:

Code: Select all

  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
Post Reply