Skip to content
General IRCd

Top 20 Voices

A TG007 community discussion started by TaReK.

Discussion 17 posts
Page 1 of 1
Open
Topic #12942 · 17 published posts · 3,848 views
well .. i need a code which could tell me the top 20 users who get +v in 1 room ... thx for help !! :)
Edited Jun 12, 2009 8:55 PM by TaReK

The last 20?

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

Edited Jun 12, 2009 11:04 PM by err0r

Get information about ircWx here

not the last 20 .. i meant the top 20 ... most active users

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 Jun 13, 2009 12:34 AM by Travis

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 Jun 13, 2009 2:28 AM by The Gate Keeper

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.

Get information about ircWx here

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 Jun 13, 2009 2:50 AM by Travis

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 ] ] } }
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 Jun 13, 2009 6:06 AM by TaReK

Thats exactly what it's supposed to do, so uhh, it works perfectly. Change $address to $nick if you like. Anyone can change their nick, but you cant change your $address.

 

Quick question about your code? HOw would they amass letters if they are not voiced? Or is the room not moderated and the +v shows your involvement level?

Edited Jun 13, 2009 6:40 AM by Travis
Thats exactly what it's supposed to do, so uhh, it works perfectly. Change $address to $nick if you like. Anyone can change their nick, but you cant change your $address.

 

Quick question about your code? HOw would they amass letters if they are not voiced? Or is the room not moderated and the +v shows your involvement level?

 

true .. my rooms are not moderated .. if u'd like to have a look on my server ... you can add me on msn [email protected] ... i'd be glad ...

and i still want a code which works on my code .. or related with it .. thx

well ... can we change the code from the top 20 voice to top 20 number of words ...

which means i can view the top 20 users which said highest number of words ... ?

on *:text:*:#:{

hinc -m top20 $nick $numtok($1-,32)

}

thx

im sorry one more thing ... someone made me this and its working

CODE
on ^*:TEXT:*:#:if ($nick isreg #) { inc -eu21000 %trig.word. [ $+ [ # ] $+ ] . [ $+ [ $nick ] ] }

 

but i want to message in the channel every six hours the highest 20 users in words

some help please ....

//timertopvoices 0 21600 /msg #channel <whatever u want>

on me:*:join:#:hop #