mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2005
Posts: 8
H
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Dec 2005
Posts: 8
My peak script actually works. There is only 1 problem. When bot joins a channel and it have no variable peak for current channel it should auto set a variable with peak, but it doesnt :S whats wrong in the script?

on *:join:#: {

if (!%peak. [ $+ [ $chan ] ]) {
set %peak. $+ $chan 0
}
if ($nick($chan,0) > %peak. [ $+ [ $chan ] ]) {
set %peak. $+ $chan $ifmatch
}
}
on *:text:.peak:#: {

if (!%peakspam. [ $+ [ $chan ] ]) {
set -u10 %peakspam. $+ $chan 1
msg $chan User peak for $chan is: %peak. [ $+ [ $chan ] ]
}
}

Joined: Aug 2005
Posts: 6
D
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
D
Joined: Aug 2005
Posts: 6
Code:
set %peak. $+ $chan 0


should be:

Code:
set %peak. [ $+ [ $chan ] ] 0


EDIT: same goes for the other /set's

Last edited by draven24; 22/12/05 11:32 PM.

Hope is an illusion. Fate is a lie.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
No it shouldn't.

[ ] are never required when setting a variable, only in certain cases with /unset, and when looking up the value of a dynamic variable (that is if you don't use $eval instead).


Gone.
Joined: Aug 2005
Posts: 6
D
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
D
Joined: Aug 2005
Posts: 6
Oh, i knew you had to use the brackets when getting the value of the variable, i just assumed you needed them to set it aswell. My bad.

Learn something new every day huh?


Hope is an illusion. Fate is a lie.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Code:
on *:text:.peak:#:{
  var %net = $iif($network,$network,$server)
  var %flood = $+(%,peakflood,%net,#)
  if ($(,%flood)) return
  inc -z $(%flood) 5
  var %peak = $+(%,peak,%net,#)
  if (!$(,%peak)) set $(%peak) $nick(#,0)
  msg # User peak for # is: $(,%peak)
}
 [color:red]  [/color] 
on !*:join:#:{
  var %peak = $+(%,peak,$iif($network,$network,$server),#)
  if ($nick(#,0) > $calc($(,%peak))) set $(%peak) $ifmatch
}

For those wondering, the $calc is there so you can use this code without having to rejoin all channels you are currently in, because if (5 > $null) is no valid if comparision, but if (5 > $calc($null)) is, since $calc($null) returns 0.

I've added a simplistic flood protection so that people can only use the .peak command once per 5 seconds on a certain channel from a certain network.

The script is network specific, so the peak for channel #mirc on network DALnet, will be different from #mirc on network Undernet. If $network isn't filled, it uses the $server name as reference.


Gone.
Joined: Jan 2007
Posts: 16
C
Pikka bird
Offline
Pikka bird
C
Joined: Jan 2007
Posts: 16
and to also show the date?


Link Copied to Clipboard