!peak script?
#124070
01/07/05 09:09 PM
|
Joined: Apr 2005
Posts: 64
Vinniej
OP
Babel fish
|
OP
Babel fish
Joined: Apr 2005
Posts: 64 |
Hi, I'm looking to a good working !peak script wich one is easily to start. Hope someone can help me 
|
|
|
Re: !peak script?
#124071
01/07/05 10:56 PM
|
Joined: Sep 2003
Posts: 4,230
DaveC
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
alt-r/file/new/ then add this line
on *:text:!peak*:*:{ echo -a Peak Script Triggered, Amazing Eh! }
|
|
|
Re: !peak script?
#124072
05/07/05 01:45 PM
|
Joined: Oct 2004
Posts: 8,327
Riamus2
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,327 |
on *:join:#yourchan: {
if ($nick(#,0) >= $+(%,peak.,$chan)) {
set $+(%,peak.,$chan) $nick(#,0) $ctime
}
}
on *:text:!peak:#yourchan: {
msg $chan On $date($gettok($+(%,peak.,$chan),2,32),mmm dd yyyy) $+ , there were $gettok($+(%,peak.,$chan),1,32) users in $chan $+ !
}
Note that you can add in the time as well as the date by just editing the output line's $date statement. That's why I used $ctime when setting the variable. This will work for multiple channels as long as the channel names are different (i.e. not the same name on two different networks).
Invision Support #Invision on irc.irchighway.net
|
|
|
Re: !peak script?
[Re: Riamus2]
#179925
30/06/07 12:33 PM
|
Joined: Apr 2006
Posts: 464
OrionsBelt
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 464 |
I do like this script, it's pretty simple and basic set up. The only thing I dislike it the way it stores the info... By setting it as variables. In my opinion you should avoid having long lists of variables in your variable window.
How would you make a version using hash tables?
|
|
|
Re: !peak script?
[Re: OrionsBelt]
#180055
03/07/07 01:02 AM
|
Joined: Oct 2004
Posts: 8,327
Riamus2
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,327 |
Here's a hash version.
on *:join:#: {
if (!$hget(PeakStats)) {
hmake PeakStats 10
if ($isfile($scriptdir\PeakStats.hsh)) { hload PeakStats $scriptdir\PeakStats.hsh }
}
if ($nick(#,0) >= $hget(PeakStats,$chan)) {
hadd PeakStats $chan $nick(#,0) $ctime
hsave PeakStats $scriptdir\PeakStats.hsh
}
}
on *:text:!peak:#: {
msg $chan On $date($gettok($hget(PeakStats,$chan),2,32),mmm dd yyyy) $+ , there were $gettok($hget(PeakStats,$chan),1,32) users in $chan $+ !
}
Invision Support #Invision on irc.irchighway.net
|
|
|
Re: !peak script?
[Re: Riamus2]
#180065
03/07/07 05:13 AM
|
Joined: Apr 2006
Posts: 464
OrionsBelt
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 464 |
 Aha, there we go. Gonna test it tonight, Thanks Riamus!
|
|
|
Re: !peak script?
[Re: Riamus2]
#180088
03/07/07 05:56 PM
|
Joined: Apr 2006
Posts: 464
OrionsBelt
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Uhm, you missed one section. Thats in case the channel doesn't exist yet. But I could figure that part myself. Here is the slightly updated version:
on *:join:#:{
if (!$hget(PeakStats)) {
hmake PeakStats 10
if ($isfile($scriptdir\PeakStats.hsh)) { hload PeakStats $scriptdir\PeakStats.hsh }
}
if ($nick(#,0) >= $hget(PeakStats,$chan)) {
hadd PeakStats $chan $nick(#,0) $ctime
hsave PeakStats $scriptdir\PeakStats.hsh
}
if (!$hget(PeakStats,$chan)) {
hadd PeakStats $chan $nick(#,0) $ctime
hsave PeakStats $scriptdir\PeakStats.hsh
}
}
on *:text:!peak:#:{
msg $chan On $date($gettok($hget(PeakStats,$chan),2,32),mmm dd yyyy) $+ , there were $gettok($hget(PeakStats,$chan),1,32) users in $chan $+ !
}
|
|
|
Re: !peak script?
[Re: OrionsBelt]
#180107
04/07/07 12:15 AM
|
Joined: Oct 2004
Posts: 8,327
Riamus2
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,327 |
Here:
on *:join:#:{
if (!$hget(PeakStats)) {
hmake PeakStats 10
if ($isfile($scriptdir\PeakStats.hsh)) { hload PeakStats $scriptdir\PeakStats.hsh }
}
if ($nick(#,0) >= $hget(PeakStats,$chan) || !$hget(PeakStats,$chan)) {
hadd PeakStats $chan $nick(#,0) $ctime
hsave PeakStats $scriptdir\PeakStats.hsh
}
}
on *:text:!peak:#:{
msg $chan On $date($gettok($hget(PeakStats,$chan),2,32),mmm dd yyyy) $+ , there were $gettok($hget(PeakStats,$chan),1,32) users in $chan $+ !
}
Invision Support #Invision on irc.irchighway.net
|
|
|
Re: !peak script?
[Re: Riamus2]
#180287
07/07/07 05:53 AM
|
Joined: Jan 2004
Posts: 509
LostShadow
Fjord artisan
|
Fjord artisan
Joined: Jan 2004
Posts: 509 |
on *:join:#yourchan: {
if ($nick(#,0) >= $+(%,peak.,$chan)) {
set $+(%,peak.,$chan) $nick(#,0) $ctime
}
}
on *:text:!peak:#yourchan: {
msg $chan On $date($gettok($+(%,peak.,$chan),2,32),mmm dd yyyy) $+ , there were $gettok($+(%,peak.,$chan),1,32) users in $chan $+ !
}
Note that you can add in the time as well as the date by just editing the output line's $date statement. That's why I used $ctime when setting the variable. This will work for multiple channels as long as the channel names are different (i.e. not the same name on two different networks). $date()? I only see $date. Anyways.. On , there were %peak.#channel.Network users in #channel! Not working.. On join event:
if ($nick(#,0) >= $+(%,peak.,$chan,.,$network)) {
set $+(%,peak.,$chan,.,$network) $nick(#,0) $ctime
/echo $chan On $asctime($gettok($+(%,peak.,$chan,.,$network),2,32),mmm dd yyyy) $+ , there were $gettok($+(%,peak.,$chan,.,$network),1,32) users in $chan $+ !
}
Last edited by LostShadow; 07/07/07 05:54 AM.
|
|
|
Re: !peak script?
[Re: Vinniej]
#180288
07/07/07 06:19 AM
|
Joined: Nov 2006
Posts: 1,559
Horstl
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
In the on text event, it's missing an evaluation of the variable to get not the variable's name, but it's value: $($+(%,peak.,$chan) ,2)on *:text:!peak:#yourchan,#anotherchan,...: {
var %val = $($+(%,peak.,$chan),2)
msg $chan On $date($gettok(%val,2,32),mmm dd yyyy) $+ , there were $gettok(%val,1,32) users in $chan $+ !
} To format the output of the date/time, check: /help $asctime e.g: $asctime($gettok(%val,2,32) ,mmmm dd yyyy - hh:nn:ss tt) will return something like "July 07 2007 - 08:21:28 am" ... $date can be used as well, sure  Edit: And I wonder why you don't use Riamus2's nice hash based code...
Last edited by Horstl; 07/07/07 06:50 AM.
|
|
|
Re: !peak script?
[Re: LostShadow]
#180306
07/07/07 03:18 PM
|
Joined: Oct 2004
Posts: 8,327
Riamus2
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,327 |
Yes, there was a missing evaluation in the original code. Just use the latest version. As for $date(), that works just fine.
Invision Support #Invision on irc.irchighway.net
|
|
|
Re: !peak script?
[Re: Riamus2]
#180316
07/07/07 04:38 PM
|
Joined: Jan 2004
Posts: 509
LostShadow
Fjord artisan
|
Fjord artisan
Joined: Jan 2004
Posts: 509 |
Wait a minute, topics can be bumped now?
Truth is, I used both.
You'll noticed I added a ,.,$network after $chan.
In other words, I'm in several #mIRC or #lobby.
So the hash table one I kept for all channels undistinguished by network.
|
|
|
Re: !peak script?
[Re: Horstl]
#180317
07/07/07 04:42 PM
|
Joined: Jan 2004
Posts: 509
LostShadow
Fjord artisan
|
Fjord artisan
Joined: Jan 2004
Posts: 509 |
In the on text event, it's missing an evaluation of the variable to get not the variable's name, but it's value: $($+(%,peak.,$chan) ,2)on *:text:!peak:#yourchan,#anotherchan,...: {
var %val = $($+(%,peak.,$chan),2)
msg $chan On $date($gettok(%val,2,32),mmm dd yyyy) $+ , there were $gettok(%val,1,32) users in $chan $+ !
} To format the output of the date/time, check: /help $asctime Uh, any reason why $nick(#,0) or $ctime isn't included in your code?
|
|
|
Re: !peak script?
[Re: Vinniej]
#180324
07/07/07 06:12 PM
|
Joined: Nov 2006
Posts: 1,559
Horstl
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
I wanted to point to the missing evaluation, so I posted the on text event as illustration, of course you need the on join event. The on text is to msg the max peak, it's read only and returning absolute values (the peak record)... But you can calculate relative values - using read value and actual values $nick(#,0) / $ctime. Here's an example, I also added that network val you want to use: on *:join:#chan,#otherchan,...: {
if ($nick(#,0) > $($+(%,peak.,$chan,.,$network),2)) {
set $+(%,peak.,$chan,.,$network) $nick(#,0) $ctime
}
}
on *:text:!peak:#chan,#otherchan,...: {
var %val = $($+(%,peak.,$chan,.,$network),2)
if (%val) {
msg $chan On $+( $date($gettok(%val,2,32),mmm dd yyyy) $&
$chr(40), $duration($calc($ctime - $gettok(%val,2,32)),2) ago, $chr(41)) $&
there were $gettok(%val,1,32) users $&
(thats $round($calc(100 - $nick($chan,0) / $gettok(%val,1,32) * 100),0) $+ % more than now) $&
in $chan $+ !
}
} This will return something like: On Jul 07 2007 (12mins ago) there were 75 users (thats 3% more than now) in #test! Anyway, I'd prefer the code with hash tables...
|
|
|
Re: !peak script?
[Re: LostShadow]
#180327
07/07/07 06:35 PM
|
Joined: Oct 2004
Posts: 8,327
Riamus2
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,327 |
Wait a minute, topics can be bumped now? No. You'll noticed I added a ,.,$network after $chan.
In other words, I'm in several #mIRC or #lobby.
So the hash table one I kept for all channels undistinguished by network. Here's an update for multiple networks.
on *:join:#:{
if (!$hget(PeakStats)) {
hmake PeakStats 100
if ($isfile($scriptdir\PeakStats.hsh)) { hload PeakStats $scriptdir\PeakStats.hsh }
}
var %chan.net = $+( $chan ,., $network)
if ($nick(#,0) >= $hget(PeakStats,%chan.net) || !$hget(PeakStats,%chan.net)) {
hadd PeakStats %chan.net $nick(#,0) $ctime
hsave PeakStats $scriptdir\PeakStats.hsh
}
}
on *:text:!peak:#:{
var %peak.stat = $hget(PeakStats,$+( $chan ,., $network )
msg $chan On $date($gettok(%peak.stat,2,32),mmm dd yyyy) $+ , there were $gettok(%peak.stat,1,32) users in $chan $+ !
}
Invision Support #Invision on irc.irchighway.net
|
|
|
Re: !peak script?
[Re: Horstl]
#180360
08/07/07 07:29 AM
|
Joined: Jan 2004
Posts: 509
LostShadow
Fjord artisan
|
Fjord artisan
Joined: Jan 2004
Posts: 509 |
on *:join:#chan,#otherchan,...: {
if ($nick(#,0) > $($+(%,peak.,$chan,.,$network),2)) {
set $+(%,peak.,$chan,.,$network) $nick(#,0) $ctime
}
} No that didn't work. Second line works using: if ($nick(#,0) >= $+(%,peak.,$chan.,$network)) { Else it won't create the variable if it doesn't exist. Edit: Well, scratch that too, it'll say there's a new record when there isn't one.. So I've tried using.. on *:join:#: {
if ($+(%,peak.,$chan,.,$network) == $null) { /set $+(%,peak.,$chan,.,$network) $nick(#,0) $ctime }
if ($nick(#,0) >= $+(%,peak.,$chan,.,$network)) {
/set $+(%,peak.,$chan,.,$network) $nick(#,0) $ctime
var %value = $($+(%,peak.,$chan,.,$network),2)
if (%value) {
/echo $chan $+($date($gettok(%value,2,32),mmmm dd yyyy)), ( $+ $duration($calc($ctime - $gettok(%value,2,32)),2) ago), there is a channel record of $gettok(%value,1,32) users!
}
}
} No luck. Ever channel join is a record...
Last edited by LostShadow; 08/07/07 07:53 AM.
|
|
|
Re: !peak script?
[Re: LostShadow]
#180361
08/07/07 09:11 AM
|
Joined: Jun 2006
Posts: 508
deegee
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
on *:join:#chan,#otherchan:{
if ($nick(#,0) > $($+(%,peak.,#,.,$network),2)) || (!$($+(%,peak.,#,.,$network),2)) {
set $+(%,peak.,#,.,$network) $nick(#,0) $ctime
echo # There is now a new channel record of $nick(#,0) users!
}
}
on *:text:!peak:#chan,#otherchan:{
tokenize 32 $($+(%,peak.,#,.,$network),2)
if ($0) {
msg # On $date($2,mmmm dd yyyy) ( $+ $duration($calc($ctime - $2),2) ago $+ ) there were $1 $&
users (thats $round($calc(100 - $nick(#,0) / $1 * 100),0) $+ % more than now) in # $+ !
}
}
|
|
|
Re: !peak script?
[Re: LostShadow]
#180367
08/07/07 12:54 PM
|
Joined: Oct 2004
Posts: 8,327
Riamus2
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,327 |
Why don't you just use the updated hash table version? You're going to have a LOT of variables if you don't.
Invision Support #Invision on irc.irchighway.net
|
|
|
Re: !peak script?
[Re: LostShadow]
#180370
08/07/07 01:44 PM
|
Joined: Nov 2006
Posts: 1,559
Horstl
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
on *:join:#chan,#otherchan,...: {
if ($nick(#,0) > $($+(%,peak.,$chan,.,$network),2)) {
set $+(%,peak.,$chan,.,$network) $nick(#,0) $ctime
}
} No that didn't work. You're right, my mistake. It could be: if ($nick(#,0) > $iif($($+(%,peak.,$chan,.,$network),2),$gettok($v1,1,32),0)) { But $me still signs: Why don't you just use the updated hash table version? You're going to have a LOT of variables if you don't. 
|
|
|
Re: !peak script?
[Re: Riamus2]
#180385
08/07/07 05:49 PM
|
Joined: Apr 2006
Posts: 464
OrionsBelt
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 464 |
var %peak.stat = $hget(PeakStats,$+( $chan ,., $network ) )Bracket mismatch 
|
|
|
|
|