Posted By: Maelish
IF NOT Good Morning - 28/05/19 12:20 PM
I have a Good Morning script that triggers during certain situations. For example, it's limited to a specific channel and only during a limited timeframe.
But I'd like for the script to ignore the trigger if I've said anything within the channel during the last hour.
Is there a way to phrase an IF Statement that only triggers if you've not sent text in that channel within a time-frame?
Posted By: maroon
Re: IF NOT Good Morning - 28/05/19 01:03 PM
$nick($chan,$me).idle being less than 3600 is close to what you want, though I'm pretty sure it gets reset to zero from nick changes and possibly mode changes.
To have it only trap your messages, you'd need to have an ON INPUT event that would need to check if $chan == #channelname, and ignore text beginning with $comchar / unless it's /say /me //say //me. You could then add something to a hashtable with a shelf life of 3600 seconds, then later you could just check if the item exists.
hadd -m saying $chan
You'd probably want to do the same thing as you join the channel, and clear the item during ON DISCONNECT
Posted By: Blas
Re: IF NOT Good Morning - 29/05/19 11:52 PM
I assume that you already have a part of your script that is capturing all text based on what you've explained. Try something like this when capturing all text from everyone:
IF (!$hget(activeusers, $nick)) MSG $chan Good Morning, $nick $+ .
HADD -mz activeusers $nick 3600
It will sent a message to the channel if the person hasn't said anything in the last hour.