Returning a Greet Message

By SgtSocom on Sep 20, 2014

How can I make it to where the the 3rd line returns one of the 5 random messages?

As this code stands right now, it will greet the new viewer 2 times, once by the timer on line 12 and once for line 5. I only want them to get greeted one time. I would like to keep the random messaging and I would like to keep the timer. So to ask my question again, how can I make it to where the 3rd line returns one of the random 5 messages instead of "Welcome to the stream $nick $+ !"

alias -l bad { return sgtsocom cadetbot nightbot }
alias -l cbad { return #chan1 #chan2 #chan3 }
alias -l greet { return Welcome to the stream $nick $+ ! }
on !*:JOIN:#:{
  if (!$istok($bad,$nick,32)) && (!$istok($cbad,$chan,32)) {
    set %rand $r(1,5) {
      if (%rand == 1) { msg $chan $nick, Hey $nick }
      if (%rand == 2) { msg $chan $nick, Hello $nick }
      if (%rand == 3) { msg $chan $nick, Hey $nick How are you today? }
      if (%rand == 4) { msg $chan $nick, Whatsup $nick ? }
      if (%rand == 5) { msg $chan $nick, Hi $nick }
      .timer $+ $nick 1 3 msg $chan $greet
    }
  }
}

Comments

Sign in to comment.
Herc08   -  Sep 20, 2014

EDIT: Re-reading your question, you are still asking it to greet twice. You want to complete the random greet, but also use timer in the greet. So, either way, it looks as if you want to greet twice, anyways.

Well first off, you have nothing to compare it too, so even if one of the channels or nicks were bad...it would still trigger. To answer you question, you have a /msg set by the random picking, then you created a timer to message out $greet. If you only want one greeting, you may want to consider getting rid of the timer

SgtSocom  -  Sep 21, 2014

Thank you for your response, I don't want it to greet 2 times, sorry for not writing very clear about what I was looking for. I have edited my post, hopefully now its a bit clearer. Thank you!! :D

Herc08  -  Sep 21, 2014

I think I understnad now...you want to add an extra check to see if the message has been set..if so, then don't send the message...so your best bet is to do something like this

/set -u4 %msgCheck yes

You can put that about the timer. and then change your greet alias to this

alias -l greet msg $chan Weclome to the stream $nick $+ !

And then change your timer to just perfrom the greet alias instead of using it as an identifier.

Finally, change that last line to this

if (%msgCheck) .timer $+ $nick 1 3 greet

Again, this is just a rough start of what I think you want to do.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.