This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

User level - based on time spent

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
c
crymsun
Voice
Posts: 33
Joined: Tue Nov 13, 2018 8:24 pm

User level - based on time spent

Post by crymsun »

I found this: http://forum.egghelp.org/viewtopic.php? ... track+user and thought it was super interesting. I'd love to see if it could be modified to reflect the following:

Level 1 - achieved after user has spent X (X=1) hours in channel
Level 2 - X + 20 hours
Level 3 - X + 40 hours
Level 4 - X + 60 hours
Level 5 - X + 80 hours
... and so on

Upon entering the channel, the bot would announce:

"<nick> has earned a <level> user rating. Thank you for your commitment to <channel name>"

The purposes of the script:
- acknowledge/recognize users for the time they commit to the channel
- tracking how many are new, how many are "regulars", etc.
- provide a recognition incentive to be in channel more

I can test the code & report back quite quickly... but testing thorough functionality may take time.
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: User level - based on time spent

Post by willyw »

crymsun wrote:I found this: http://forum.egghelp.org/viewtopic.php? ... track+user and thought it was super interesting.
Have you loaded it, tested it, and learned how to work it as -is ?
If not, do that first.
Need to be sure it works as expected, before doing any additions / modifications.
This way, you've established a known starting point.
I'd love to see if it could be modified to reflect the following:

Level 1 - achieved after user has spent X (X=1) hours in channel
Level 2 - X + 20 hours
Level 3 - X + 40 hours
Level 4 - X + 60 hours
Level 5 - X + 80 hours
... and so on

Upon entering the channel, the bot would announce:

"<nick> has earned a <level> user rating. Thank you for your commitment to <channel name>"
Now that you have it working as expected :

Go to the bottom of the script, and add these lines

Code: Select all


####  additions start here #######

bind join - "* *" announce_level

proc announce_level {nick uhost handle chan} {
global timespent

        if {![channel get $chan timespent]} {
                return 0
        }

         set host [lindex [split $uhost @] 1]

        if {![info exists timespent($chan,$host)]} {
                return 0
        }

        set num_seconds [lindex [split $timespent($chan,$host) ] 0 ]
        set level [expr (($num_seconds /20 ) / 3600) + 1]

        putserv "privmsg $chan :$nick has earned a \0031,15Level $level\003 user rating. Thank you for your commitment to $chan"

}

### end addtions ###
###

I can test the code
Good. Test it. A lot. :)
Because I have tested it only briefly.
... ... but testing thorough functionality may take time.
Find me on irc, and I'll explain how you can fake it out, with any amount of time you want, for testing. ;)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
Dominatez
Halfop
Posts: 50
Joined: Mon Jan 14, 2019 5:08 pm
Location: United Kingdom

Post by Dominatez »

Works fine until you do !timespent

It returns the following.

!timespent

Dominatez - Nickname has no info on this channel

It is not returning any information for whomever does !timespent

It gives info for !timespent NICKNAME
Post Reply