egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

trivial.tcl html output

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
mr_fanatic
Voice


Joined: 31 Aug 2007
Posts: 11

PostPosted: Fri Aug 31, 2007 4:16 am    Post subject: trivial.tcl html output Reply with quote

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
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Fri Aug 31, 2007 11:22 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
mr_fanatic
Voice


Joined: 31 Aug 2007
Posts: 11

PostPosted: Sun Sep 02, 2007 7:25 am    Post subject: Reply with quote

it works but gives output like this:

@nick1 @nick2 @nick3 +nick4 +nick4 etc.
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Sun Sep 02, 2007 1:30 pm    Post subject: Reply with quote

Can you give me the url of the html file/log.
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
oxygen
Voice


Joined: 05 Sep 2005
Posts: 22
Location: Germany

PostPosted: Sun Sep 23, 2007 4:44 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber