dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.1.0
jackdempsey has quit [Ping timeout: 255 seconds]
djbkd has quit [Remote host closed the connection]
jackdempsey has joined #cinch
jackdempsey has quit [Ping timeout: 250 seconds]
jackdempsey has joined #cinch
djbkd has joined #cinch
jackdempsey has quit [Ping timeout: 240 seconds]
djbkd has quit [Remote host closed the connection]
djbkd has joined #cinch
postmodern has quit [Quit: Leaving]
_whitelogger has joined #cinch
jackdempsey has joined #cinch
aptyget has joined #cinch
<aptyget> hi
<aptyget> I want to make a small trigger that displays a message when someone enters "!no"
<aptyget> and then has a 15 second timer
<aptyget> when the timer's over, it displays another message
<aptyget> however, if a message is entered during those 15 seconds, it should stop the timer and immediatly respond with a third message
<aptyget> here's my code. However, it doesn't seem to be working.
<aptyget> Any ideas?
jackdempsey has quit [Ping timeout: 255 seconds]
<onewheelskyward> aptyget What Timer class are you using?
<aptyget> onewheelskyward: cinch's, I think
<aptyget> the example in the docs:
<aptyget> on :message, "start timer" do
<aptyget> Timer(5) { puts "timer fired" }
<aptyget> end
<onewheelskyward> Ah I think I see the problem
<onewheelskyward> Are you expecting the second on :message block to respond to the bots reply?
<aptyget> basically, I want that block to activate only if the first on :message block activates
<onewheelskyward> ok
<onewheelskyward> You're going to need some sort of persistence.
<onewheelskyward> A variable that lasts between threads.
<aptyget> something like
<aptyget> oh I know onewheelskyward
<aptyget> notimer = Timer(15) {m.reply("... pff") if nomessage == true}
<aptyget> or something
<onewheelskyward> Sort of. I was thinking you should check if notimer.stopped? to figure out if it's active.
<aptyget> hmm
<aptyget> maybe I should put the notimer at the top of my file
<onewheelskyward> If you're not going to use something like sqlite, you'll have to use a class var, not an instance var.
<onewheelskyward> Each thread instantiates the class.
<aptyget> oh
<catepillar> onewheelskyward: there is shared[]
<onewheelskyward> Oh hey, that should work.
<onewheelskyward> Is there a doc for that? I can't seem to find it.
<catepillar> uh, just a sec
<catepillar> has a "shared" variable
<catepillar> plugins have a "shared" variable that can be just accessed
<catepillar> shared[:key] in the plugin
<catepillar> i might also not use cinch's timer in this situation, the timer is just a wrapper for Thread
<catepillar> and you can control more with Thread, like changing the fire interval and stopping outstanding threads and restarting them with the new interval
<onewheelskyward> nice, thanks!
postmodern has joined #cinch
djbkd has joined #cinch
djbkd has quit [Remote host closed the connection]
djbkd has joined #cinch
djbkd has quit [Quit: My people need me...]
djbkd has joined #cinch
djbkd has quit [Client Quit]
djbkd has joined #cinch
djbkd has quit [Remote host closed the connection]
Rylee has quit [Quit: WeeChat 1.0-rc2]
Rylee has joined #cinch
djbkd has joined #cinch
jackdempsey has joined #cinch
Azure has quit [Quit: My MBP went to sleep.]
djbkd has quit [Remote host closed the connection]
djbkd has joined #cinch
Azure has joined #cinch