mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 2
C
Bowl of petunias
OP Offline
Bowl of petunias
C
Joined: Jan 2014
Posts: 2
Hello!~ Thanks for checking this out.

I'm currently working on a twitch tv bot that is constantly plagued by buggy joins/leaves, and people disconnecting from the chat.

http://pastebin.com/hbEBkvLb

What I want to do is add a timer, specifically an hour long, to each name. Not just the names already on the list. Every single name that is announced I want to have an individual timer for, so that the same name doesn't get re-announced until x amount of time has passed.

This is all really beyond me, the only idea I had was having every name that's ever appeared in the chat to have it's own elseif line with separate timers for each one, but that is very cumbersome and I'd have to add a new name to the command each time. (I also don't even know how to do that)

Any help would be hugely appreciated!

Thanks so much~

Joined: Dec 2002
Posts: 87
Babel fish
Offline
Babel fish
Joined: Dec 2002
Posts: 87
I have not yet tested this code, but this should get you on track where you want to go:

Code:
; The %1 variable holds the username
; The %rq is the 'random quote' generator. Add any of them  you want within the $+() and separate each quote by a comma, a > and another comma.
; For example: If you wanted to add a new random-quote, you would change the variable to: $+(has not joined the channel.,>,has joined the channel,>,has joined and is the only hope for our world!,>,this is a new random quote)

alias -l checkUserTimer {
var %1 = $1, %rq = $+(has not joined the channel.,>,has joined the channel,>,has joined and is the only hope for our world!)

; Make sure that a timer for this person does not already exist.
; If it does not, then set a timer for an hour and then msg the channel with a random quote for that user
  if (!$timer(%1)) {
    .timer [ $+ [ %1 ] ] 1 3600 noop
    msg $2 ( ͡° ͜ʖ ͡°) %1 $gettok(%rq,$rand(1,$gettok(%rq,0,62)),62)
  }
  else{
    ; In here you would add what you want the script to do if the user's name has a timer already
    }
  }
}
#group1 on
ON *:JOIN:#cutenaomi,#abraham_linksys,#chivalrouscthulu: {
  checkUserTimers $nick #
}
#group1 end


-Zmodem
Joined: Jan 2014
Posts: 2
C
Bowl of petunias
OP Offline
Bowl of petunias
C
Joined: Jan 2014
Posts: 2
Thanks for responding so fast!

Is there a way to have some nicks with their own custom message instead of the random quote?

The idea is that there's a default message for everyone except for a select few who have a set custom message.


Link Copied to Clipboard