Jump to content

Top 20 Voices


TaReK

Recommended Posts

i don't have time atm to write it but off the top of my head i would say just do a $addtok then if $numtok = 21 then deltok the first entry.. that would be for the last 20.. for the top twenty you would have to just keep a running number of every +v you do in a room and inc it per address.. just dont' see the point in it but hey it can be done

Link to comment
Share on other sites

Guest Travis

Well, this is what I see you would need to do.

 

First of all you would need to log everyone who comes into your room and gets +v.

 

Then you need to set a continuous timer that checks their $idle time.

 

You could make it so that when they join they get added to the list if they havent already been. Then if their idle time is ... I dunno, past a minute, and if there are more than 20 users in your list, remove their nick from the list.

 

Or!! Have a list of only 20 people. If someone joins check everyones idle time in the list and remove the longest one.

 

My favorite idea:

Or! Log everyone who joins, use a timer to check idle time. Log their idle time. Overwrite their stored idle time if it is a lower number. Then write an alias that finds the 20 lowest idle times in your list.

 

Edit: $nick(#,$nick).idle

Edited by Travis
Link to comment
Share on other sites

i think you misinterpreted him travis. I believe he just wants something that will tell who are the 20 most active users. This is probably all you want...

 

on *:TEXT:*:#: {
  inc -eu2 %topcount.[ $+ [ $chan ] $+ . $+ [ $address ] ]
  if (%topcount.[ $+ [ $chan ] $+ . $+ [ $address ] ] == 1) {
    inc %topvoice.[ $+ [ $chan ] $+ . $+ [ $address ] ]
  }
  if (!top20 isin $1-) {
// echo out the top 20    
  }
}

 

This is the sort of template to use. I forgot how to get all the variables that begin with something or if its even possible, so i just left it as this so hopefully travis/err0r can complete the code. If its not possible the other alternative is to use a hash table as ini would be quite slow for a constant task like this.

 

I put in the topcount so that people can't flood it and it will only count 1 message every 2 seconds. I'm use to working in C++/Java where you work with maps and that to do this sort of thing. Individual variables are quite limiting when you understand multi-dimensional variables.

Edited by The Gate Keeper
Link to comment
Share on other sites

another thing you could do is just inc actions and text... do a hash table of users and just have it inc per on text and on action and list them by the number from largest to smallest limiting it to 20 instances... then you could just recall the table as needed.

Link to comment
Share on other sites

Guest Travis

good idea err0r.

 

on *:start:{
if (!$hget(top20)) hmake top20 100
if ($file(top20.txt).shortfn) hload top20 $ifmatch
}
alias h_top20 {
if ($hget(top20)) hsave -o top20 top20.txt
}
on *:exit:h_top20
on *:disconnect:h_top20
on *:text:*:#:hinc top20 $address
on *:action:*:#:hinc top20 $address
;untested

 

This should count every text and action and store it in a hash table named 'top20' based on their $address.

 

You can use $hget(top20,0).item to get the total number of users logged then use a while loop to scan the table. I think I would /hadd -m a second temporary table to store the top20, then /hfree the table after I finished with it. Or you could write it to a text file and /play it.

Edited by Travis
Link to comment
Share on other sites

well .. im using this code with users so they can get +v .. they have to say 2000 letters and 150 lines , if we can make a code which tells me the top 20 who get +v in a single room ... related with that code .. i'd be very thankfull !!!

CODE
On @*:text:*:#:if ($nick isreg #) { inc -u2000 %av. [ $+ [ # ] $+ ] . [ $+ [ $nick ] ] | if (%av. [ $+ [ # ] $+ ] . [ $+ [ $nick ] ] >= 125) { mode # +v $nick 125.lines | msg # 4 $nick , 11 You Have Been Voiced Due to ur Activity in the last minutes | unset %av. [ $+ [ # ] $+ ] . [ $+ [ $nick ] ] } }
Link to comment
Share on other sites

good idea err0r.

 

on *:start:{
if (!$hget(top20)) hmake top20 100
if ($file(top20.txt).shortfn) hload top20 $ifmatch
}
alias h_top20 {
if ($hget(top20)) hsave -o top20 top20.txt
}
on *:exit:h_top20
on *:disconnect:h_top20
on *:text:*:#:hinc top20 $address
on *:action:*:#:hinc top20 $address
;untested

 

This should count every text and action and store it in a hash table named 'top20' based on their $address.

 

You can use $hget(top20,0).item to get the total number of users logged then use a while loop to scan the table. I think I would /hadd -m a second temporary table to store the top20, then /hfree the table after I finished with it. Or you could write it to a text file and /play it.

 

well ... thats not working i tried it ... it keeps the gate address .. not the nicknames .. and i want the nicknames to be auto messaged every 6 hours in the channel

Edited by TaReK
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...