build html scores and rank titles - it needs major help to reduce build time (everything works 100%)

By bandbonjtv on Feb 02, 2013

this is not my script, merely an edited section of it that i personalized. i need help shortening and reducing the time it takes to build the html score file. the only parts im really concerned with are the BADGE AND RANK TITLES for each winner (automatically) it works as is, it just takes too damn long to build, and is killin my resources on my pc. thanks in advance

alias htmldir { setset build dir $sdir($mircdir) }
alias htmlbuild {
  var %start.ticks = $ticks, %htmlfile = " $+ $ifd($getset(build,dir),$mircdir) $+ \ $+ $ifd($getset(build,html),triv.htm) $+ "
  sort score
  if ($exists(%htmlfile)) { .remove %htmlfile }
  write %htmlfile <HTML><head><title> $+ $iden Trivia Scores $+ </title></head>
  write %htmlfile <script src="sorttable.js"></script><body bgcolor="#132899" text="#FFFFFF" link="#F0DB1F" alink="#279812" vlink="#8a94cc" >
  write %htmlfile The Scores file was updated on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt $time(zzz)) <br><ol>
  write %htmlfile Congratulations $getset(Champ, $ini(trivia.ini, Champ, 0)) $+ ! You are the New Champion. <br>
  write %htmlfile Each Champ earns a Mod Badge in chat. <br>
  write %htmlfile 1st to 1,000 Wins! Good Luck Everyone! <br><ol>
  write %htmlfile <table class="sortable" table BORDER COLS=5 WIDTH="80%" >
  write %htmlfile <tr><th><font color="#FFFFFF" /font>Ranking</th><th><font color="#FFFFFF" /font>Badge</th><th><font color="#FFFFFF" /font>Screen Name</th><th><font color="#FFFFFF" /font>Score</th><th><font color="#FFFFFF" /font>Best Time</th><th><font color="#FFFFFF" /font>Best Streak</th><th><font color="#FFFFFF" /font>Best WPM</th></tr>
  var %i = 1, %j = $hof.size 
  if ($getset(build,top) isnum 1 - %j) { %j = $getset(build,top) }
  while (%i <= %j) { 
    ;mod
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == valon22) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == valon22) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == theraven362cope) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == theraven362cope) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == the_beast_under_your_bed) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == the_beast_under_your_bed) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == citizenmayfly) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == citizenmayfly) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == curlybot) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == curlybot) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == hellokittykandy) write %htmlfile <tr><th> $+ %i $+ <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == hellokittykandy) write %htmlfile <tr><th> $+ %i $+ <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == leech11) write %htmlfile <tr><th> $+ %i $+ <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == leech11) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == gribblebix) write %htmlfile <tr><th> $+ %i $+ <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == gribblebix) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == cerealkiller2010) write %htmlfile <tr><th> $+ %i $+ <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == cerealkiller2010) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == rockys50) write %htmlfile <tr><th> $+ %i $+ <td align="right"> CHAMP: MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == rockys50) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> MOD: $getmrank($hof(%i,1)) $+ :</td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 

    ;broadcaster(admin)
    if ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == mwconjtv) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> CHAMP: ADMIN: </td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0))) && ($hof(%i,1) == mwconjtv) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> ADMIN: $getmrank($hof(%i,1)) $+ : </td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 

    ;notmod and not listed
    if ($hof(%i,1) !isop $chan) &| ($hof(%i,1) != mwconjtv) || ($hof(%i,1) != rockys50) || ($hof(%i,1) != cerealkiller2010) || ($hof(%i,1) != theraven362cope) || ($hof(%i,1) != the_beast_under_your_bed) || ($hof(%i,1) != citizenmayfly) || ($hof(%i,1) != curlybot) || ($hof(%i,1) != hellokittykandy) || ($hof(%i,1) != valon22) || ($hof(%i,1) != leech11) ||  ($hof(%i,1) != gribblebix) || ($hof(%i,1) == $getset(Champ, $ini(trivia.ini, Champ, 0)))) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> $getmrank($hof(%i,1)) $+ : CHAMP: </td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) !isop $chan) &| ($hof(%i,1) != mwconjtv) || ($hof(%i,1) != rockys50) || ($hof(%i,1) != cerealkiller2010) || ($hof(%i,1) != theraven362cope) || ($hof(%i,1) != the_beast_under_your_bed) || ($hof(%i,1) != citizenmayfly) || ($hof(%i,1) != curlybot) || ($hof(%i,1) != hellokittykandy) || ($hof(%i,1) != valon22) || ($hof(%i,1) != leech11) ||  ($hof(%i,1) != gribblebix) || ($hof(%i,1) != $getset(Champ, $ini(trivia.ini, Champ, 0)))) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> $getmrank($hof(%i,1)) $+ : </td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    if ($hof(%i,1) !isop $chan) write %htmlfile <tr><th> $+ %i $+ </th> <td align="right"> $getmrank($hof(%i,1)) $+ : </td> <td> <a href="http://www.justin.tv/ $+ $hof(%i,1) $+ /videos $+ " target="_blank"> $hof(%i,1) $+ </a> </td> <td> $+ $hof(%i,2) $+ </td> <td> $+ $hof(%i,3) $+ </td> <td> $+ $hof(%i,4) $+ </td> <td> $+ $hof(%i,5) $+ </td></tr> 
    inc %i 
  }
  write %htmlfile </table><br>
  write %htmlfile Made with <a href="http://themikejudgenetwork.freeforums.org" "target="_blank"> $+ $strip($msg.trivia.version) $+ </A><br>
  echo -a $e2(Finished:) $e1(%htmlfile) $e2(is written. In) $e1($calc(($ticks - %start.ticks) / 1000)) $+ $e2(secs.)
  if ($getset(build,web)) { tsay $msg.features.built($getset(build,web)) }
  if (($getset(build,auto)) && ($exists($+(",$triv(dir),\,ftpbatch.txt,")))) { run -n ftp $+(-s:,",$triv(dir),\,ftpbatch.txt") }
}

Comments

Sign in to comment.
Conscious   -  Feb 04, 2013

It would be helpful if you also supplied the aliases used as they're probably a high user in this

bandbonjtv  -  Feb 06, 2013

i provided the whole thing if you check the comments

bandbonjtv  -  Feb 06, 2013

bandbonjtv - 3 days ago
here is the whole script if you dare to dive into it with me. i dont want to post the whole thing here cause its huge, and its not my original script. i just need help with the section mentioned that i personally added. im nowhere near good at scripting, but im not bad either, and i pick it up quickly. im eager to learn more. help me o wise ones. thank you for your response felicanox. i also have another script i need help with if you wanna check it out on my profile. but ill leave that subject there. lol

trivls616main.mrc
http://www37.zippyshare.com/v/49128990/file.html

Sign in to comment

FelicianoX   -  Feb 03, 2013

do something like

var %gs = $getset(Champ, $ini(trivia.ini, Champ, 0))

and use that variable in the if statements. This way it will only read the INI file once, making the alias run faster.

bandbonjtv  -  Feb 03, 2013

ok, that sped it up by about 5-10secs alone. thank you. anyway you can help me stop the duplicates of a name (badged person is not in chat, so it adds a null row too for them....example in Screencap in comments

Sign in to comment

FelicianoX   -  Feb 03, 2013

What does $hof and $getset do? How big is $hof.size?

It might be slow because you have a ton of $ini()'s which can be really slow. If $ini(trivia.ini, Champ, 0) never changes through-out the function, you can save it in a variable and access it with the variable, so it doesn't have to check the ini file every time.

bandbonjtv  -  Feb 03, 2013

here is the whole script if you dare to dive into it with me. i dont want to post the whole thing here cause its huge, and its not my original script. i just need help with the section mentioned that i personally added. im nowhere near good at scripting, but im not bad either, and i pick it up quickly. im eager to learn more. help me o wise ones. thank you for your response felicanox. i also have another script i need help with if you wanna check it out on my profile. but ill leave that subject there. lol

trivls616main.mrc
http://www37.zippyshare.com/v/49128990/file.html

Sign in to comment

bandbonjtv   -  Feb 02, 2013

i need help

 Respond  
bandbonjtv   -  Feb 02, 2013

here is a screencap of the page that it created, it works, it just takes too damn long to build the /scores.html file

Sorasyn  -  Feb 04, 2013

mIRC's never been very efficient speed wise. I doubt you'd be able to have it crank out score sheets in a time effective manner.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.