mIRC Home    About    Download    Register    News    Help

Print Thread
#87664 20/06/04 07:06 PM
Joined: May 2004
Posts: 4
Z
zopha Offline OP
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: May 2004
Posts: 4
Hey. I am making a quiz/trivia script, and i want to set up a scoreboard. I want my script to msg top ten players.

the file containing highscores are built like this:

<start>scores.ini
[nick]
points=1000
<stop>

could someone help me build this script.

#87665 21/06/04 12:25 AM
Joined: Oct 2003
Posts: 143
D
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2003
Posts: 143
try downloading http://tatarize.com/trivia.htm Tats trivia bot. It has a built in HTML score board. Look threw the code there is some comments in it on how he made it. Hes very nice too Im shore if you e-mail him he would show you how also. Just though Id give you a little help.


if (Windows isin %txt.1) { /kick # $nick Windows is a badword tisk tisk tisk. }
#87666 21/06/04 12:04 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
id use toks for this
in the form of points.nickname.

and then use msg $chan $+(1.,$gettok($sorttok(%score,nr),1,32)) $+(2.,$gettok($sorttok(%score,nr),2,32))
etc etc

Last edited by Mpdreamz; 21/06/04 12:04 PM.

$maybe
#87667 21/06/04 02:20 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

you could organise your .ini file like this:

[scores]
nick1=522
nick2=899
nick3=....
...

Then use this alias (I believe qwerty was the first to use this approach):
Code:
 
alias topscore {
  window -h @scores 
  filter -fwxute 2 61 scores.ini @scores [scores]
  var %a = 1
  while (%a &lt; 11) &amp;&amp; $line(@scores,%a) { tokenize 61 $ifmatch | echo -a %a -&gt; $1 with $2 points | inc %a }
  window -c @scores
}

Replace echo -a with whatever suits you best.

Short explanation of the code:

The contents of scores.ini are filtered into a hidden window @scores using the /filter command and following flags:

f --> the infile is a file (scores.ini)
w -> the outfile is a window (@scores)
x --> the x flag excludes lines that match the matchtext [scores]
u --> perform a numeric sort
e --> make the sort descending: from highest to lowest
t --> makes the filter command sort the file based on a column (C) and seperator (S). In the ini file, the first column is the one with the nicks, the second column are the scores. The columns are seperated by a = which is $chr(61). So we filter scores.ini on on column 2 with seperator 61.

Hope this helps you on your way,

Greets

Last edited by FiberOPtics; 21/06/04 02:51 PM.

Gone.
#87668 21/06/04 02:57 PM
Joined: May 2004
Posts: 4
Z
zopha Offline OP
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: May 2004
Posts: 4
Thanx alot ppl, you have helped me out here. The best choice was FiberOPtics post. Thanks alot everyone =) grin

And now there was a problem...

I created a small file just to test this stuff. and here is what i came up with:

1 -> kossen with 3423235 points
2 -> annhi with 9983 points
3 -> farmor with 3434 points
4 -> falli with 2424 points
5 -> ZynaX with 2000 points
6 -> pappa with 1534 points
7 -> Madsoul with 300 points
8 -> ZopHa with 100 points
9 -> mamma with 13 points
10 -> Klompen with 60932 points

I guess there must be something wrong since klompen has pretty much points, but he is at the last place. What is this. I tried to read about /filter, but i did'nt see what is wrong. Please help me again =)

Last edited by zopha; 21/06/04 03:41 PM.
#87669 21/06/04 04:06 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

I could not reproduce this.

Made this scores file:

[scores]
ZopHa=100
mamma=13
Klompen=60932
farmor=3434
falli=2424
kossen=3423235
pappa=1534
Madsoul=300
annhi=9983
ZynaX=2000

Results:

1 -> kossen with 3423235 points
2 -> Klompen with 60932 points
3 -> annhi with 9983 points
4 -> farmor with 3434 points
5 -> falli with 2424 points
6 -> ZynaX with 2000 points
7 -> pappa with 1534 points
8 -> Madsoul with 300 points
9 -> ZopHa with 100 points
10 -> mamma with 13 points

Are you sure you copied the code from this msg board, not from your email, because I had edited my code shortly after posting. Also be sure to copy the code first to wordpad, and then to mirc, to keep newlines. (start -> run -> wordpad.exe -> paste code -> copy code to mirc scripts editor)

Greets


Gone.
#87670 22/06/04 05:43 PM
Joined: May 2004
Posts: 4
Z
zopha Offline OP
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: May 2004
Posts: 4
hey. thanks again. I have done that, but i figured out the problem at my own. I was using mirc 5.91, which i personally like best. And it can't handle that great numbers i think. (i just guess this, because i don't want to install a version above 6.*)

But i just have to cut down the scores. Thanx alot for bothering. Peace out!


Link Copied to Clipboard