mIRC Home    About    Download    Register    News    Help

Topic Options
#263920 - 11/10/18 06:51 AM simple text script help
kaceysparkles Offline
Mostly harmless

Registered: 11/10/18
Posts: 1
hey guys ive been digging around for weeks now and cant find/get to work what im looking for (bit of a overwhelmed newbie). i need two things added to this.

first: i need the !command to only trigger after the keywords been typed in the chat xx amount of times.

second: when the channel is idle/no messages after xx amount of time leave channel and or unload the script.

seems simple but i suck so thanx in advance for any help or insight its much appreciated.


Code:
ON *:TEXT:!command:#kaceysparkles: {
  if (%flood.#kaceysparkles) { return }
  set -u20 %flood.#kaceysparkles On
  msg $chan commands message
}




Edited by kaceysparkles (11/10/18 08:30 AM)

Top
#263921 - 11/10/18 08:32 AM Re: simple text script help [Re: kaceysparkles]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 869
The first event handler creates a hashtable item that lives for 20 seconds, then dies. Then it finds how many hashtable items begin with flood, then does nothing if there's less than 5 of them.

As for monitoring if the channel is idle enough:

//echo -a $chan(#kaceysparkles).idle

shows how many seconds the channel has been idle. It doesn't count JOIN and QUIT and various other events, so if you want those to reset the idle back to zero, you'll have to trap those other events beyond :TEXT: and :ACTION: then do like I did below, where each time the :TEXT: event happens in channel, it updates the hashtable item to contain the newest $ctime value. Then you can have a timer that compares the current $ctime against $hget(kaceysparkles,idle) to see if it's been long enough.

Code:
ON *:TEXT:!command:#kaceysparkles:{
  var %unique $hget(kaceysparkles,unique) | inc %unique | hadd -m kaceysparkles unique %unique | hadd -m kaceysparkles idle $ctime
  hadd -u20 kaceysparkles flood $+ %unique $nick
  if ($hfind(kaceysparkles,flood*,0,w) < 5) return
  msg $chan commands msg 
}

ON *:TEXT:*:#kaceysparkles:{ hadd -m kaceysparkles idle $ctime }


Top