mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2015
Posts: 10
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 10
Hello,
I wanted to implement a command that makes the bot say how many people are only at the moment.
The way I was thinking of doing it was to make the bot check the /names list, set the number of names to %variable and then say the %variable.

Is there a better way of doing this? How do I make it count the names?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
$nick(#,0)

Joined: Oct 2014
Posts: 42
K
Ameglian cow
Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
Is there an actual code snippet to go along with doing this? I also haven't figured it out yet.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
on *:text:!count:#:msg # $nick(#,0)

Joined: Oct 2014
Posts: 42
K
Ameglian cow
Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
Code:
on *:TEXT:*!Count*:#MyRoom: {
msg $nick There are # $nick(#,0) users in this channel. } 
}
}


I think that should work with !count in a #channel
But it doesn't.

I'd like to get it so I could /msg BotName !count
and the bot would tell me the count of 8 users in #MyRoom1 2 users in #MyRoom2
Showing how many people are in each room that the bot is in.

Any help would be appreciated. Hopefully it helps the one who created the thread too.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on *:text:!count*:?: { 
if ($nick != YOURNICK) return
var %channel $iif($2,$2,#DEFAULTCHANNEL)
var %users $nick(%channel,0)
msg $nick There are %users users in %channel $+ .
}
Replace #DEFAULTCHANNEL with the channel you'll be using the most, and replace YOURNICK with your nick. Then message the bot !count or !count #channel.

!count returns the default channel's users, and !count #channel returns that #channel's users.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Originally Posted By: Kooky

I think that should work with !count in a #channel
But it doesn't.

I'd like to get it so I could /msg BotName !count
and the bot would tell me the count of 8 users in #MyRoom1 2 users in #MyRoom2
Showing how many people are in each room that the bot is in.

Code:
on *:text:*:?: {
if ($strip($1) == !count) {
var %x = 1 
while (%x <= $comchan($me,0)) {
.timer 1 $calc(%x + 1) msg $nick There Are $nick($comchan($me,%x),0) In $comchan($me,%x) .
inc %x
}
}
}

Try this code smile Put it in an empty remote file. I Have tested it and works just like you wanted it smile


((( I think that i replied to the wrong person LOL )))

Last edited by OrFeAsGr; 03/04/15 02:40 PM.
Joined: Oct 2014
Posts: 42
K
Ameglian cow
Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
Originally Posted By: Nillen
Code:
on *:text:!count*:?: { 
if ($nick != YOURNICK) return
var %channel $iif($2,$2,#DEFAULTCHANNEL)
var %users $nick(%channel,0)
msg $nick There are %users users in %channel $+ .
}
Replace #DEFAULTCHANNEL with the channel you'll be using the most, and replace YOURNICK with your nick. Then message the bot !count or !count #channel.

!count returns the default channel's users, and !count #channel returns that #channel's users.



I did that and it worked great. I like this one more than the snip posted below it, no offense.. It's easier for me to follow and modify. But I did find an issue. I tried to make a room list that the bot is in, and -1 for the count so it doesn't count the bot as a user. So far it's not working though... Where'd I go wrong?

Code:
on *:text:!count*:?: { 
if ($nick != YOURNICK) return
var %channel $iif($2,$2,#DEFAULTCHANNEL,#OTHERCHANNEL,#ANOTHER)
var %users $nick(%channel,0, -1)
msg $nick There are %users users in %channel $+ .
}


Any advice?

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
var %users $nick(%channel,0, -1)

This is wrong.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
var %channel $iif($2,$2,#DEFAULTCHANNEL,#OTHERCHANNEL,#ANOTHER)
var %users $nick(%channel,0, -1)
Both of these lines are wrong. I don't know how #OTHERCHANNEL would ever work in an $iif.

Code:
var %channel $iif($2,$2,#DEFAULTCHANNEL)
var %users $calc($nick(%channel,0) - 1)


Regarding the script OrFeAsGr posted, it will return the amount of users on all channels your bot is currently on, looping through $comchan - which returns how many channels and channelnames the bot is currently on.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Oct 2014
Posts: 42
K
Ameglian cow
Offline
Ameglian cow
K
Joined: Oct 2014
Posts: 42
Thanks a ton to everyone, and especially you. I'm finally getting on track with it doing what I need it to, and it's a huge HUGE help. This works until I can figure out how to get it to do the other things regarding the same command. Yay for tweaking! I really appreciate the start. And moreso, the work put into doing this for me and helping me along. <3

Loki thanks for the code to get me started!
OrFeAsGr thanks!! You did soooo much for me with that snippet!

And thank you too Nillen as you've helped and responded to most of my posts, and I've been learning a great deal from you especially.

Everyone keep up the great work!

Joined: Feb 2015
Posts: 16
L
Pikka bird
Offline
Pikka bird
L
Joined: Feb 2015
Posts: 16
this wont look very different from what you've already seen but I felt it Needed some very minor changes

on *:text:!count*:#: {
if ((%floodcount) || ($($+(%,floodcount.,$nick),2))) { return }
set -u10 %floodcount On
set -u30 %floodcount. $+ $nick On
if ($nick isop #DEFULTCHANNEL) return
var %channel $iif($2,$2,#DEFULTCHANNEL)
var %users $calc($nick(%channel,0) - 1)
msg $chan $nick There are %users users in %channel $+ .
}

If you have people modding for you, only you and those people that you /mod can use this command.

The Flood thingy (I'm so technical) will prevent anyone spamming the command.

It shouldn't count, you the mods, or your bot.

Hope you enjoy smile


Link Copied to Clipboard