mIRC Home    About    Download    Register    News    Help

Print Thread
#208300 18/01/09 09:55 AM
Joined: Jan 2009
Posts: 2
L
Bowl of petunias
OP Offline
Bowl of petunias
L
Joined: Jan 2009
Posts: 2
I was wondering how to make a !peak script.

I saw some on hawkee but it uses hash tables. I want a peak script that uses ini files.

Help please.

Lovely3000 #208301 18/01/09 10:49 AM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
One of your most basic scripts...
Code:
on *:JOIN:*:{
  if (!$readini(peak.ini,$network,$chan)) { writeini peak.ini $network $chan $nick($chan,0) }
  elseif ($readini(peak.ini,$network,$chan) < $nick($chan,0)) {
    writeini peak.ini $network $chan $v2
    ;rest of your code to respond to a new peak goes here
  }
}

If you want to just monitor certain channels you can simply use them in the on JOIN event, like...
Code:
on *:JOIN:#mIRC,#scripting,#chat101:{

And of course you can use a !peak trigger like, for instance, this:
Code:
on *:TEXT:!peak:*:{
  if ($readini(peak.ini,$network,$chan)) { msg $chan Channel peak for $chan is $v1 }
}

Just be careful in what channels you run this script, since often channel ops don't like random people running (duplicate) scripts.

Last edited by 5618; 18/01/09 10:58 AM.
Lovely3000 #208509 22/01/09 05:28 AM
Joined: Jan 2009
Posts: 2
L
Bowl of petunias
OP Offline
Bowl of petunias
L
Joined: Jan 2009
Posts: 2
tysm, I'll give it a try.

hmm, what if i want to add time to it?

Code:
($readini(peak.ini,$network,$chan) < $nick($chan,0))
wouldn't work.

Last edited by Lovely3000; 22/01/09 05:39 AM.
Lovely3000 #208524 22/01/09 04:02 PM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Try this:
Code:
on *:JOIN:*:{
  if (!$readini(peak.ini,$network,$chan)) { writeini peak.ini $network $chan $nick($chan,0) $ctime }
  elseif ($gettok($readini(peak.ini,$network,$chan),1,32) < $nick($chan,0)) {
    writeini peak.ini $network $chan $v2 $ctime
    ;rest of your code to respond to a new peak goes here
  }
}
on *:TEXT:!peak:*:{
  if ($readini(peak.ini,$network,$chan)) { msg $chan Channel peak for $chan is $gettok($v1,1,32) $+ , set on $asctime($gettok($v1,2,32)) }
}


Link Copied to Clipboard