mIRC Home    About    Download    Register    News    Help

Print Thread
#256734 11/02/16 11:21 PM
Joined: Oct 2015
Posts: 8
E
ekwag Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
E
Joined: Oct 2015
Posts: 8
So, essentially, I have the points system that a bunch of people use for twitch, and i've run it silently behind a channel for months. Now, to make it visible, I am using !hours instead of points, which wasn't too hard, just adding a $calc, then dividing by 12. But, I want to add this !top10 command that I found, that does work, but i can't find a spot to run the $calc(____/12) that doesn't crash mirc. Thank you all.

My guess currently would be that %p is the points pulled from the file, so could I just add a $calc(%p/12)?

edit: I got it to work with a %p = $calc(%p / 12) before the aline.

So, can anyone help me come up with a more efficient method?

Currently, when run, an example output of the !top10 command is "Top 10 point are: user1 #, user2 #, ..."

on *:TEXT:!top10:#:{
if ($nick isop #) { top10 # }
else { msg # You are not allowed to use !top10. }
}

alias -l top10 {
window -h @. | var %i 1
while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
aline @. %n %p
var %i $calc($readn + 1)
}
filter -cetuww 2 32 @. @.
var %i 1 | while %i <= 10 {
var %list $addtok(%list,$line(@.,%i),44)
inc %i
}
msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
window -c @.
msg $chr(44)
}

Last edited by ekwag; 12/02/16 04:48 AM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
What does 12 have to do with anything? Where is the actual code for the points?

Looping and searching in such a way is very inefficient, see this post for a better starting point: http://forum.swiftirc.net/viewtopic.php?p=209311&sid=c12773d99a0e2dcee18eef90190f4790#p209311

Joined: Oct 2015
Posts: 8
E
ekwag Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
E
Joined: Oct 2015
Posts: 8
12 would make it into hours because 1 point is gained every 5 minute, so 12 times per hour.

But, thanks for the link, I will check that out. I agree the while loop was incredibly inefficient, so hopefully the link has something better to work with


Link Copied to Clipboard