mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2015
Posts: 3
B
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Nov 2015
Posts: 3
I can't figure out how to add this particular function to my mirc script.

I have a lot of commands that people can activate by saying something in the channel and the mirc bot will say something in response.

I am looking for soemthing that starts with on *:text:*!everybody*:*:{

but don't know where to start. I got names $$1 in there but not really sure what to do with it.

Ideally, the bot would say in the channel it's in a list of all the users in the room, so like

<MyTerribleBot> coolguy1, coolguy2, coolguy3, user4

Joined: Jul 2007
Posts: 6
K
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
K
Joined: Jul 2007
Posts: 6
I think this should work. It'll echo out the nicks on the channel it's said in. Change /echo with /msg $chan. Be careful with spamming the server if there are a lot of nicks, though. Also, this version only works with the message !everybody, nothing before or after it.
Code:
on *:TEXT:!everybody:#:{

  var %strThisChannel = $chan
  ; Set the channel to a local variable, probably quicker than calling $chan
  ; 400 times

  var %intTotalNicks = $nick(%strThisChannel,0,a)
  ; Set the amount of nicks on the current channel

  var %strMyNick = $me
  ; Also probably quicker than checking $me 400 times

  var %intNickCounter = 1

  while (%intNickCounter <= %intTotalNicks) {
    var %strCurrentNick = $nick(%strThisChannel,%intNickCounter)

    /echo 4 -a %strCurrentNick
    
    inc %intNickCounter
    ; Increase by 1
  }
}

Joined: Nov 2009
Posts: 295
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
Here is another method which would message all the nicks in a single message. So if there are a lot of people in the chan the message could get cut off or split into multiple lines if you have a client set to do that.

Code:
on *:TEXT:!everybody:#:msg $chan $regsubex($str(@, $nick($chan, 0)), /./g, $nick($chan, \n) $chr(32))


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Nov 2015
Posts: 3
B
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Nov 2015
Posts: 3
Originally Posted By: pball
Here is another method which would message all the nicks in a single message. So if there are a lot of people in the chan the message could get cut off or split into multiple lines if you have a client set to do that.

Code:
on *:TEXT:!everybody:#:msg $chan $regsubex($str(@, $nick($chan, 0)), /./g, $nick($chan, \n) $chr(32))


this is some very inspiring code!!!
i will try both your solutions and if nothing else use them to learn msl better.


Link Copied to Clipboard