mIRC Home    About    Download    Register    News    Help

Print Thread
#243251 02/11/13 11:16 AM
Joined: Nov 2013
Posts: 7
G
Golden Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2013
Posts: 7
So I need assistance with a bit of code. I am not even sure if it is possible.
I am coding for a server that will only display user joins every 10 seconds. so if 10 people joined within 10 seconds it will display them all at once.
What I need to do is be able to welcome them to the chat-room without flooding the chat.
So using:
on ^*:join:#:{
if ($nick == $me) { msg $chan Have no fear Ike_Bot is here. | halt | goto end }
if ($me isop $chan) && ($nick != $me) && (%welcome == on) { msg $chan Hey everyone $nick has joined the stream. }
:end
}
This method would flood the chat.
Is there a way to collect multiple nicknames and display them all in 1 welcome message? So like make it pause for 5 seconds or something to collect names before it sends the welcome msg.
ie: Hey everyone, $nick1 $+ , $nick2 $+ , ect... has joined the stream

The server I am coding this for is irc.twitch.tv

Thank you in advance for anyone who helps with this.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Here's a nice ugly solution for you, it waits 3 seconds after the last join to send the message.

Code:
on *:join:#<3:{ 
  if ($nick == $me) { msg # Have no fear Ike_Bot is here. }
  elseif ($me isop #) && (%welcome) {
    set -e %welcome.nicks [ $+ [ # ] ] $addtok(%welcome.nicks [ $+ [ # ] ],$nick,32)
    var %msg = Hey everyone $list(%welcome.nicks [ $+ [ # ] ]) $iif($numtok(%welcome.nicks [ $+ [ # ] ],32) > 1,have,has) joined the stream.
    .timer.welcome [ $+ [ # ] ] 1 3 msg $safe(#) %msg $(|,0) unset %welcome.nicks [ $+ [ # ] ]
  }
}

alias -l list {
  tokenize 32 $1
  var %items = $1-, %list = %items
  if ($0 > 2) {
    %list = $regsubex(%items,/(\x20)/g,$iif(\n == \0,$chr(44) and $chr(32),$chr(44) $chr(32)))
  }
  elseif ($0 > 1) {
    %list = $1 and $2
  }

  return %list
}

alias safe return $!decode( $encode($1,m) ,m)

Joined: Nov 2013
Posts: 7
G
Golden Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2013
Posts: 7
Thank you very much. i could not figure out adding multiple nicknames to a var and then separating them. I really appreciate this.

Joined: Nov 2013
Posts: 7
G
Golden Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2013
Posts: 7
Is there a way to make that work for multiple channels? or will it automatically?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Replace the #<3 (which I left by accident) with a list of channels: #chan1,#chan2,#chan3

The script takes care of welcoming the correct people in each channel.

Joined: Nov 2013
Posts: 7
G
Golden Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Nov 2013
Posts: 7
Yea i noticed the #<3 right away.
Thanks so much in advance for your help with this. It made some people happy to have it working correctly laugh


Link Copied to Clipboard