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.

Need Help on html page in souperman trivia.tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

Need Help on html page in souperman trivia.tcl

Post by janii »

Hello Need Sum help adding top10 time , cps ,streak, answers , fastx , in customise soupeman trivia.tcl

Code: Select all

#this generates an html file with all the people on the chan with
#their score, as well as a list of all scores, sorted by rank
# Table Colors 
set tgbcolor "#000000"       ;#Border Color 
set tgcellcolor "#E6E6FA"    ;#Cell color 
set tgcellcolor_top "FFE1B5" ;# Table Head color 

# Java chat available? 
set tgjavachat "0" ;# 0 is no java chat, 1 is javachat 
set tgjavaurl "http://axe4.axenet.org/index.php?page=chat&channel=trivia" ;# Url to point to 
proc tghtml {} { 
 global tgchan botnick tghtmlfile tghtmlrefresh server tgscoresbyname tgranksbyname 
 global tgscorestotal tgranksbyname tgrealnames tgscoresbyrank tgranksbynum tgplaying 
 global tgquestionstotal tghtmlrefreshtimer tghtmlfont 
 global tgbcolor tgcellcolor tgcellcolor_top tgjavachat tgjavaurl 
 tggetscores 
 tgreadqdb 
 set _file [open $tghtmlfile~new w] 
 puts $_file "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" 
 puts $_file "<html>" 
 puts $_file " <head>" 
 puts $_file "  <title>$botnick's trivia channel: $tgchan on [lindex [split $server :] 0]</title>" 
 puts $_file "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" 
 puts $_file "  <meta http-equiv=\"refresh\" content=\"$tghtmlrefresh\">" 
 puts $_file "  <meta name=\"generator\" content=\"Trivia.tcl script for #TriviaPoint. http://www.trivia.info/\">" 
 puts $_file " </head>" 
 puts $_file " <body>" 
 puts $_file " <body bgcolor=\"#4682B4\">"
 puts $_file "  <table cellspacing=4 cellpadding=4 border=0 align=center><tr><td>" 
 puts $_file " <b><font face=\"Verdana\" size=\"3\">Trivia Statistics for $tgchan on [lindex [split $server :] 0]</font></b><br><font face=\"Verdana\" size=\"3\"><b>Generated on [strftime %A,\ %d\ %B\ %Y\ @\ %H:%M:%S]</b></font><br>" 
 if {$tgjavachat>0} { 
  puts $_file " <a href=\"$tgjavaurl\">Play Now!</a>" 
 } 
 puts $_file " <HR ALIGN=LEFT NOSHADE SIZE=1 WIDTH=480>" 
 if {![onchan $botnick $tgchan]} { 
  puts $_file "  <p>Hmmm... for some reason I'm not on $tgchan at the moment. Please try again later.</p>" 
 } else { 
  puts $_file "  <p>Trivia game is currently <b>[expr $tgplaying==1?"on":"off"]</b>. There are <b>$tgquestionstotal</b> questions in the database."
	 puts $_file "                    <p><b>$tgchan</b> is owned by <b>souperman</b> and <b>sniper</b> ."
}
	if {$tgscorestotal>0} {
   puts $_file "         <p>There [expr $tgscorestotal==1?"is":"are"] currently <b>$tgscorestotal</b> [expr $tgscorestotal==1?"nick":"nicks"] in the score table:<br>" 
  set _rank 1 
  puts $_file " <table width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"$tgbcolor\" align=center><tr><td bgcolor=\"$tgcellcolor_top\"><b>Rank</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Nickname</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Score</b></td></tr> " 
  while {$_rank<=$tgscorestotal} { 
   puts $_file "<tr><td bgcolor=\"$tgcellcolor\"><b>$_rank</b></td><td bgcolor=\"$tgcellcolor\">$tgrealnames($tgranksbynum($_rank))</td><td bgcolor=\"$tgcellcolor\">$tgscoresbyrank($_rank)</td></tr>" 
   incr _rank 
  } 
  puts $_file " </table> " 
 } else { 
  puts $_file "<p><small>There are currently no nicks in the score table.</small></p><br>" 
 } 
  puts $_file "  <p><b>People on $tgchan right now:</b><br><br>" 
  puts $_file "  <table width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$tgbcolor\">" 
  puts $_file "   <tr>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Nick</b></td>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Score</b></td>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Rank</b></td>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Idle</b></td>" 
  puts $_file "   </tr>" 
  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 bgcolor=\"$tgcellcolor\">[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 bgcolor=\"$tgcellcolor\">$tgscoresbyname([strlwr $nick])</td>" 
         } else { 
            puts $_file "    <td bgcolor=\"$tgcellcolor\">-</td>" 
         } 
         if {[info exists tgranksbyname([strlwr $nick])]} { 
            puts $_file "    <td bgcolor=\"$tgcellcolor\">$tgranksbyname([strlwr $nick])</td>" 
         } else { 
            puts $_file "    <td bgcolor=\"$tgcellcolor\">-</td>" 
         } 
         puts $_file "   <td bgcolor=\"$tgcellcolor\">[expr [getchanidle $nick $tgchan]>10?"[getchanidle $nick $tgchan]m":"-"]</td>" 
         puts $_file "   </tr>" 
      } 

	puts $_file " </body>"
	puts $_file "</html>"
	close $_file
	file rename -force $tghtmlfile~new $tghtmlfile
	set tghtmlrefreshtimer [utimer $tghtmlrefresh tghtml]
}
My Question is about the below code

Code: Select all

   if {$tgscorestotal>0} {
   puts $_file "         <p>There [expr $tgscorestotal==1?"is":"are"] currently <b>$tgscorestotal</b> [expr $tgscorestotal==1?"nick":"nicks"] in the score table:<br>"
  set _rank 1
  puts $_file " <table width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"$tgbcolor\" align=center><tr><td bgcolor=\"$tgcellcolor_top\"><b>Rank</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Nickname</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Score</b></td></tr> "
  while {$_rank<=$tgscorestotal} {
   puts $_file "<tr><td bgcolor=\"$tgcellcolor\"><b>$_rank</b></td><td bgcolor=\"$tgcellcolor\">$tgrealnames($tgranksbynum($_rank))</td><td bgcolor=\"$tgcellcolor\">$tgscoresbyrank($_rank)</td></tr>"
   incr _rank
  }
  puts $_file " </table> "
 } else {
  puts $_file "<p><small>There are currently no nicks in the score table.</small></p><br>"
 } 
Last edited by janii on Wed Mar 27, 2013 11:31 pm, edited 1 time in total.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Why don you use BogusTrivia ? Its a new trivia script and has HTML page with user statistics. That Souperman tribia script is old.

http://www.egghelp.org/tclhtml/3478-4-0 ... trivia.htm

Further more the author of BogusTrivia frequenty helps on this forum so if you would have questions about the script im sure he will help you.
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

Post by janii »

Thanx Madalin but the above is an old trivia.tcl but i ve modified it to full extend i enhanched it with Chars per seconds words per minute , jackpot ,duel ,streaks , top time ,bonus , bonus breaker and many more options .. i ve used every tcl here spike trivia is the most stable one but every1 has its choice i like this trivia .. so m looking for the solution in here if any1 can help me tht ll be highly appreciated .. thanks
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

I edited it to work for me but need help with a lil problem

Post by janii »

Hello i ve managed to add top streakers command in the html successfully and can add cps toptime etc as well but therez a problem that it shows the whole streak list i want it to just show top10 streakers kindly help thanks

Code: Select all

#this generates an html file with all the people on the chan with
#their score, as well as a list of all scores, sorted by rank
# Table Colors 
set tgbcolor "#000000"       ;#Border Color 
set tgcellcolor "#E6E6FA"    ;#Cell color 
set tgcellcolor_top "FFE1B5" ;# Table Head color 

# Java chat available? 
set tgjavachat "0" ;# 0 is no java chat, 1 is javachat 
set tgjavaurl "http://axe4.axenet.org/index.php?page=chat&channel=trivia" ;# Url to point to 
proc tghtml {} { 
 global tgchan botnick tghtmlfile tghtmlrefresh server tgscoresbyname tgranksbyname 
 global tgscorestotal tgranksbyname tgrealnames tgscoresbyrank tgranksbynum tgplaying 
 global tgquestionstotal tghtmlrefreshtimer tghtmlfont
 global tgbcolor tgcellcolor tgcellcolor_top tgjavachat tgjavaurl
 global tgpbstreakf tgpbstreaktotal tgpbstreak tgpbstreakbyname tgpbstreakranksbyname tgpbstreakranksbynum tgpbstreakrealnames tgpbstreakbyrank
 tggetscores 
 tgreadqdb 
 tggetpbstreak

 set _file [open $tghtmlfile~new w] 
 puts $_file "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" 
 puts $_file "<html>" 
 puts $_file " <head>" 
 puts $_file "  <title>$botnick's trivia channel: $tgchan on [lindex [split $server :] 0]</title>" 
 puts $_file "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" 
 puts $_file "  <meta http-equiv=\"refresh\" content=\"$tghtmlrefresh\">" 
 puts $_file "  <meta name=\"generator\" content=\"lotsatrivia.tcl script for #lotsatrivia. http://www.lotsatrivia.com/\">" 
 puts $_file " </head>" 
 puts $_file " <body>" 
 puts $_file " <body bgcolor=\"#4682B4\">"
 puts $_file "  <table cellspacing=4 cellpadding=4 border=0 align=center><tr><td>" 
 puts $_file " <b><font face=\"Verdana\" size=\"3\">Trivia Statistics for $tgchan on [lindex [split $server :] 0]</font></b><br><font face=\"Verdana\" size=\"3\"><b>Generated on [strftime %A,\ %d\ %B\ %Y\ @\ %H:%M:%S]</b></font><br>" 
 if {$tgjavachat>0} { 
  puts $_file " <a href=\"$tgjavaurl\">Play Now!</a>" 
 } 
 puts $_file " <HR ALIGN=LEFT NOSHADE SIZE=1 WIDTH=480>" 
 if {![onchan $botnick $tgchan]} { 
  puts $_file "  <p>Hmmm... for some reason I'm not on $tgchan at the moment. Please try again later.</p>" 
 } else { 
  puts $_file "  <p>Trivia game is currently <b>[expr $tgplaying==1?"on":"off"]</b>. There are <b>$tgquestionstotal</b> questions in the database."
	 puts $_file "                    <p><b>$tgchan</b> is owned by <b>JuRiSt</b> and <b>I-M-BEST</b> ."
}
	if {$tgscorestotal>0} {
   puts $_file "         <p>There [expr $tgscorestotal==1?"is":"are"] currently <b>$tgscorestotal</b> [expr $tgscorestotal==1?"nick":"nicks"] in the score table:<br>" 
  set _rank 1 
  puts $_file " <table width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"$tgbcolor\" align=center><tr><td bgcolor=\"$tgcellcolor_top\"><b>Rank</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Nickname</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Score</b></td></tr> " 
  while {$_rank<=$tgscorestotal} { 
   puts $_file "<tr><td bgcolor=\"$tgcellcolor\"><b>$_rank</b></td><td bgcolor=\"$tgcellcolor\">$tgrealnames($tgranksbynum($_rank))</td><td bgcolor=\"$tgcellcolor\">$tgscoresbyrank($_rank)</td></tr>" 
   incr _rank 
  } 
  puts $_file " </table> " 
 } else { 
  puts $_file "<p><small>There are currently no nicks in the score table.</small></p><br>" 
 } 

  puts $_file "  <p><b>People on $tgchan right now:</b><br><br>" 
  puts $_file "  <table width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" bgcolor=\"$tgbcolor\">" 
  puts $_file "   <tr>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Nick</b></td>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Score</b></td>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Rank</b></td>" 
  puts $_file "    <td bgcolor=\"$tgcellcolor_top\"><b>Idle</b></td>" 
  puts $_file "   </tr>" 
  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 bgcolor=\"$tgcellcolor\">[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 bgcolor=\"$tgcellcolor\">$tgscoresbyname([strlwr $nick])</td>" 
         } else { 
            puts $_file "    <td bgcolor=\"$tgcellcolor\">-</td>" 
         } 
         if {[info exists tgranksbyname([strlwr $nick])]} { 
            puts $_file "    <td bgcolor=\"$tgcellcolor\">$tgranksbyname([strlwr $nick])</td>" 
         } else { 
            puts $_file "    <td bgcolor=\"$tgcellcolor\">-</td>" 
         } 
         puts $_file "   <td bgcolor=\"$tgcellcolor\">[expr [getchanidle $nick $tgchan]>10?"[getchanidle $nick $tgchan]m":"-"]</td>" 
         puts $_file "   </tr>" 
      } 

	puts $_file " </body>"
	puts $_file "</html>"
	close $_file
	file rename -force $tghtmlfile~new $tghtmlfile
	set tghtmlrefreshtimer [utimer $tghtmlrefresh tghtml]
}
Last edited by janii on Wed Mar 27, 2013 11:33 pm, edited 1 time in total.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Code: Select all

       if {$tgpbstreaktotal>0} { 
  puts $_file "  <p><b>$tgchan Top Streakers :</b><br><br>" 
  set _rank 1 
  puts $_file " <table width=\"100%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"$tgbcolor\" align=center><tr><td bgcolor=\"$tgcellcolor_top\"><b>Rank</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Nickname</b></td><td bgcolor=\"$tgcellcolor_top\"><b>Streakers</b></td></tr> " 
  while {$_rank<=$tgpbstreaktotal} { 
   puts $_file "<tr><td bgcolor=\"$tgcellcolor\"><b>$_rank</b></td><td bgcolor=\"$tgcellcolor\">$tgpbstreakrealnames($tgpbstreakranksbynum($_rank))</td><td bgcolor=\"$tgcellcolor\">$tgpbstreakbyrank($_rank)</td></tr>" 
   incr _rank 

   if {$_rank>"10"} { break }

  } 
 
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
j
janii
Halfop
Posts: 41
Joined: Wed Aug 03, 2011 8:08 am

hmmmm problem solved

Post by janii »

hey spike thank you very very much for ur help once again you are one great helper u helped me i think 4 or 5 times here on this forum .. i knew if sum1 will solve my problem it ll be the great spike ... thanks once again man luv yaaa
Post Reply