!peak script for a bot

By PuNkTuReD on May 21, 2008

replace #YOUR_CHANNEL_NAME_HERE with your channel name

on *:text:*:*: {
  if ($$1 = !peak) && (%peakwait == wait) { msg $chan 4,8Please wait 30seconds before checking Peak Users again. }
  if ($$1 = !peak) && (%peakwait == $null) {
    set -u30 %peakwait wait
  msg %botchan 7Most users to chat on4 $chan 7is4 %mostusers }
}

on *:load: {
  echo -a Welcome to !peak script By PuNkTuReD
  echo -a Type !peak to check Channel Peak
  set %mostusers 0
}
on *:JOIN:#PUT_YOUR_CHANNEL_NAME_HERE: { 
  if (%mostusers < $nick($chan,0)) { set %mostusers $nick($chan,0) }
  else { halt }
}

Comments

Sign in to comment.
Stewie1k94   -  May 01, 2011

anyone got a peak script that shows how many regular users ops halfops voiced owners and admins are in achannel ?

 Respond  
napa182   -  Apr 25, 2010

um this should make it like that just after you load the code type /hfree peak so you can start fresh..

#Peak on
on $@*:text:/^@peak$/iS:#:if ($nick isop #) msg # $iif(!$hget(Peak,$+($network,#)),Sorry No count yet.,Most users on04 # was04 $gettok($hget(Peak,$+($network,#)),1-11,32) before $+($duration($calc($ctime - $gettok($hget(Peak,$+($network,#)),12,32)),1),!))
on !*:join:#: { 
  if ($nick(#,0) > $gettok($hget(Peak,$+($network,#)),1,32) || !$hget(Peak,$+($network,#))) { 
    .hadd -m Peak $+($network,#) $nick(#,0) Users on04 $date(m/d/yy) at04 $time(h:nn tt) with last joiner $+($nick,$chr(44)) $ctime
    msg # !!New User Peak Record Reached!! In04 # With04 $gettok($hget(Peak,$+($network,#)),1-7,32) 
  } 
}
#Peak end
on *:start:{ $Peakstartup } 
on *:connect:{ $Peakstartup }
on *:exit:{  $Peakclose } 
on *:disconnect:{ $Peakclose }
alias -l Peakclose { .hsave Peak $qt($scriptdirPeak.hsh)  } 
alias -l Peakstartup {  
  if (!$hget(Peak)) { .hmake Peak 100 } 
  if ($exists($qt($scriptdirPeak.hsh))) { .hload Peak $qt($scriptdirPeak.hsh) } 
}
menu Channel,menubar {
  .Turn Peak $iif($group(#Peak) = On,Off,On): $iif($group(#Peak) = On,.disable,.enable) #Peak | echo -a Peak Script is now $group(#Peak)
}
 Respond  
Cheiron   -  Apr 25, 2010

ah i know what i spotted missing that i wanted to ask to be added.. on Noutorius's version you had

05<02:43pm> -Titan_Bot- Most users on #Socialchat were 10 with last joiner Sleeping_On_The_Job, before 5secs! on the @peak command..

can you edit yours to include this ?

 with last joiner $+($gettok($($+(%,peak,$chan),2),2,124),$chr(44))

thats the bit on Noutorius's that did that

 Respond  
Cheiron   -  Apr 24, 2010

yeah i didnt look at the trigger right when i loaded it hence why it took me 2 attempts lol.. but it works fine :)

 Respond  
napa182   -  Apr 24, 2010

um I don't use ! in my triggers for the most part cuz of conflicts with anope. I mostly use @ ,but if you want to use ! just change the @ to a ! or if you want to use both @ and ! you can do..

for !

 on $@*:text:/^!peak$/iS:#:

for @

 on $@*:text:/^@peak$/iS:#:

for either or

 on $@*:text:/^[!@]peak$/iS:#:
 Respond  
Cheiron   -  Apr 24, 2010

nice edit. ty napa.. there may be another edit coming up soon.
see below for the results so far.

12<20812:208pm12> * Joins: Lanceallen (Lanceallen@)
12<20812:208pm12> !!New User Peak Record Reached!! In04 #roleplayofallkinds With04 81 Users on04 4/24/10 at04 8:08 pm

12<20812:209pm12> ChanServ sets mode: +qo Cheiron Cheiron
12<20812:209pm12> !!New User Peak Record Reached!! In04 #Socialchat With04 9 Users on04 4/24/10 at04 8:09 pm
12<20812:209pm12> <angel{MQ}> wb Cheiron
12<20812:209pm12> woo hoo
12<20812:210pm12> !peak
12<20812:210pm12> hmmm
12<20812:210pm12> that still dont work though
12<20812:210pm12> hmm
12<20812:210pm12>
Melly grrs
12<20812:210pm12> @peak
12<20812:210pm12> Most users on04 #Socialchat was04 9 Users on04 4/24/10 at04 8:09 pm

i will add another post here once i work out what edit we need so keep eyes peeled :)

 Respond  
napa182   -  Apr 24, 2010

um it's

on @*:text:*:#:

but that is for the bot or who ever is running the code. for the nicks triggering the code it's

if ($nick isop #)

or

if ($nick(#,$nick,o))

here is a one i made awhile back using hash...

#Peak off
on $@*:text:/^@peak$/iS:#:if ($nick isop #) msg # $iif(!$hget(Peak,$+($network,#)),Sorry No count yet.,Most users on04 # was04 $hget(Peak,$+($network,#))) 
on !*:join:#: { 
  if ($nick(#,0) > $gettok($hget(Peak,$+($network,#)),1,32) || !$hget(Peak,$+($network,#))) { 
    .hadd -m Peak $+($network,#) $nick(#,0) Users on04 $date(m/d/yy) at04 $time(h:nn tt) 
    msg # !!New User Peak Record Reached!! In04 # With04 $hget(Peak,$+($network,#)))
  } 
}
#Peak end
on *:start:{ $Peakstartup } 
on *:connect:{ $Peakstartup }
on *:exit:{  $Peakclose } 
on *:disconnect:{ $Peakclose }
alias -l Peakclose { .hsave Peak $qt($scriptdirPeak.hsh)  } 
alias -l Peakstartup {  
  if (!$hget(Peak)) { .hmake Peak 100 } 
  if ($exists($qt($scriptdirPeak.hsh))) { .hload Peak $qt($scriptdirPeak.hsh) } 
}
menu Channel,menubar {
  .Turn Peak $iif($group(#Peak) = On,Off,On): $iif($group(#Peak) = On,.disable,.enable) #Peak | echo -a Peak Script is now $group(#Peak)
}
 Respond  
Cheiron   -  Apr 24, 2010

bleugh... i've done something wrong somewhere... it wont trigger when i alter the on text event to on @:TEXT: to prevent non ops triggering it. i got brain mush atm.. can someone lend me a hand lol sorry
using Noutorious's edit for the @ version .. or trying too btw

 Respond  
Cheiron   -  Apr 24, 2010

nice script works very well :)

 Respond  
RicJames   -  Mar 20, 2010

Thx for the script napa182 :) would it be possible to add a bit of code to the script to msg the chan when a new peak is set?

 Respond  
napa182   -  May 24, 2008

on Noutrious code you should also add a ! to the on join so it dont reset the var back to 1 when the bot joins.

on !*:JOIN:#:
 Respond  
PuNkTuReD   -  May 24, 2008

thats very nice noutrious, cheers.

 Respond  
Noutrious   -  May 23, 2008

Okay, better replace every 124 in my version with 255 for example, forgot that Nei|sen ($chr(124)) can be in nicknames - causing it functioning wrongly. :)

 Respond  
Noutrious   -  May 22, 2008

¬ 03:19:26pm| Neisen: !peak
¬ 03:19:27pm| --> NOTICE: From [ testyu ] : Sorry, #test hasn\'t got it\'s peak yet.
¬ 03:19:28pm| * Attempting to rejoin channel #test
¬ 03:19:29pm| --> JOIN: You are now talking in #test
¬ 03:19:30pm| Neisen: !peak
¬ 03:19:31pm| --> NOTICE: From [ testyu ] : Most users on #test were 3 with last joiner Neisen, before 1sec!

on *:JOIN:#:if ($+(%peak,$chan) <= $nick($chan,0)) set $+($chr(37),peak,$chan) $+($nick($chan,0),$chr(124),$nick,$chr(124),$ctime)
on *:TEXT:*:*:if ($1 == !peak) && ($chan) notice $nick $iif($numtok($($+(%,peak,$chan),2),124) = 3,Most users on $chan were $gettok($($+(%,peak,$chan),2),1,124) with last joiner $+($gettok($($+(%,peak,$chan),2),2,124),$chr(44)) before $+($duration($calc($ctime - $gettok($($+(%,peak,$chan),2),3,124)),1),!),$+(Sorry,$chr(44)) $chan hasn\'t got it\'s peak yet.)

Here you go! :)

 Respond  
PuNkTuReD   -  May 22, 2008

ahh thank you so much napa . i have it as %botchan because
coz of my script , and nice work on the date too i didnt think of that lol

 Respond  
napa182   -  May 22, 2008

um you have msg %botchan and there is no way of setting that on ur script.
or you can do it all like this

on *:text:!peak:#: {
  msg $chan $iif($($+(%,peak,$nick,$chan),2),4 $+ $chr(44) $+ 8Please wait 30seconds before checking Peak Users again.,7Most users to chat on4 $chan 7is4 $($+(%,mostusers,$chan),2) 7on4 $($+(%,$chan,mostusers),2)) 
  set -u30 $+(%,peak,$nick,$chan) wait
}
on *:load: {
  echo -a Welcome to !peak script By PuNkTuReD
  echo -a Type !peak to check Channel Peak
}
on !*:join:#: { 
  if ($nick($chan,0) > $($+(%,mostusers,$chan),2)) || (!$($+(%,mostusers,$chan),2)) { 
    set $+(%,mostusers,$chan) $nick($chan,0) 
    set $+(%,$chan,mostusers) $date(mm/dd/yy)
  } 
}

but anyway nice work 6/10

 Respond  
PuNkTuReD   -  May 22, 2008

cool cheers napa182

 Respond  
napa182   -  May 22, 2008

$iif(C,T,F)
Returns T or F depending on whether the evaluation of the Conditional C is true or false.

/help $iif

 Respond  
criminal   -  May 21, 2008

Same way

 Respond  
PuNkTuReD   -  May 21, 2008

you would use

on *:JOIN:#: { 
  if ($($+(%,mostusers,$chan),2) < $nick($chan,0)) { set %mostusers $+ $chan $nick($chan,0) }
  else { halt }
}

on *:text:*:*: {
  if ($$1 = !peak) && (%peakwait == wait) { msg $chan 4,8Please wait 30seconds before checking Peak Users again. }
  if ($$1 = !peak) && (%peakwait == $null) {
    set -u30 %peakwait wait
  msg %botchan 7Most users to chat on4 $chan 7is4 $($+(%,mostusers,$chan),2) }
}
 Respond  
criminal   -  May 21, 2008

I\'ve got a question, you can use this for all channels you\'re in, right?
If you change %mostusers to %mostusers. [ $+ [ $chan ] ]

Just a question :D

 Respond  
PuNkTuReD   -  May 21, 2008

niice so

$iif(%peakwait,4 $+ $chr(44) $+ 8

checks if variable exists ?

and if it doesnt it displays the text after \" , \" ?

 Respond  
napa182   -  May 21, 2008

you could make the on text like this

on *:text:!peak:#: {
  msg $chan $iif(%peakwait,4 $+ $chr(44) $+ 8Please wait 30seconds before checking Peak Users again.,7Most users to chat on4 $chan 7is4 %mostusers) 
  set -u30 %peakwait wait
}
 Respond  
Vox91   -  May 21, 2008

Easy but usefull :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.