mIRC Home    About    Download    Register    News    Help

Print Thread
Echo variable, counting viewers #252372 06/04/15 09:08 PM
Joined: Apr 2015
Posts: 1
A
AmBassdor Offline OP
Mostly harmless
OP Offline
Mostly harmless
A
Joined: Apr 2015
Posts: 1
Hello!

I want to greet random guest but to avoid spam I wanna greet every x join. How to make this?

And how to print some global variable and /inc -rease it?
Becouse

set %joined 0
on *:JOIN:#: { /inc %joins }
on *:JOIN:#: { /splay d:/a.wav } (just for tests)
on *:JOIN:#: { .msg $chan hello $nick u are %joins on channel}

do not work as I thought

Last edited by AmBassdor; 06/04/15 09:09 PM.
Re: Echo variable, counting viewers [Re: AmBassdor] #252375 06/04/15 10:56 PM
Joined: Nov 2014
Posts: 79
N
Newbie Offline
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
I don't know what you mean by increasing a global variable. Do you mean increasing it once you get a viewer but decreasing it once they leave? Or do you want a total view counter for the day? Or a total view counter of all times?

I'll write this script assuming you want it a total view counter for that day.

Code:

on *:JOIN:#: {
 if (!%views) {
   hadd -m Viewers $nick 1
   msg # Hello $nick you are viewer number $hget(Viewers,0) on   this channel.
 }
 if (%views > 0) {
   if ($hget(Viewers,$nick) == 1) {
     return
   }
   else {
     hadd Viewers $nick 1
     msg # Hello $nick you are viewer number $hget(Viewers,0) on   this channel.
   }
 }
}


Haven't tested this out so hopefully it works first try. When a person joins they are added to a hash table, which gets deleted when you close the program. Please tell me if it works because I can't test it out at the moment.

Last edited by Newbie; 06/04/15 10:58 PM.