mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2005
Posts: 7
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2005
Posts: 7
Hello to everyone..
I`m a newbie here, and first of all i`d like to apologise if my problem was stated before..
The topic's title says it almost all.. I`d like to auto-voice active users in the chan.. i mean those who write a specified number of lines in the channel. Also.. i'd like to auto-devoice those who are idlers for more than .. let's say 60 minutes.
Anyone could help me out?

PS: if this problem was already stated around here, would you please be kind to direct me to that topic? thank you. blush

Joined: Dec 2004
Posts: 81
N
Babel fish
Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
This is for the idle time devoice.

Add this to the remotes section:

alias devoidlers {
if (($1 ischan) && ($me isop $1)) {
var %idx 0
while (%idx < $nick($1,0)) {
inc %idx
if ($nick($1,%idx).idle >= 3600) {
kick $1 $nick($1,%idx) [message here]
}
}
}
}

That's the basic code that accomplishes the de-voicing anyone who's been idle for 60 minutes or more. This will kick the user, you can add a ban line before the kick line if you feel like it.

You have some options on how to use this;
a) use a timer [ex; /timerildechk 0 30 devoidlers #channel]
b) type /devoidlers in the channel window
c) make it a popup
d) there's plenty of more options as well [like on join, on rawmode, on quit, on kick, on ban, etc..]

This can get to be a bit complex for a beginner, depending on how you want it. Some questions that influence this are;
1 Do you want this to scan the channel every so many seconds when YOU join the channel?
2 Do you want to scan the channel through a channel popup?

AND SO ON...

Reading the mIRC helpfile will advance your knowledge in mIRC scripting and mIRC itself. Also look at other peoples code and whatnot, and last but not least, trial-and-error smile

*sighs* make that a forth time editing this, lol. I've been plowing/shoveling snow since 8am this morning and really haven't had much sleep, hah.

Last edited by nycdiesel; 23/01/05 11:55 PM.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
;
; usage &gt;&gt;&gt; /automatic.devoicer #yourchannelname
;
alias automatic.devoicer {
  if (($1 ischan) &amp;&amp; ($me isop $1)) {
    .timer.auto.devoicer. [ $+ [$chan ] ] 0 60 devoice.on.idle $1
    ;^ 60 above cause this to go off once every 60 seconds, increase for a less intensive monitor
    ;
  }
}
;
alias -l devoice.on.idle {
  if (($1 ischan) &amp;&amp; ($me isop $1)) {
    var %i = $nick($1,0)
    while (%i) {
      if ($nick($1,%i).idle &gt;= 3600) {
        ;^ 3600 above is 60 seconds x 60 minutes, adjust idle time as needed.
        ;
        mode $1 -v $nick($1,%i)
        ;
        if ($hget(textcounter. [ $+ [ $chan ] ] ,$nick)) { hdel textcounter. [ $+ [ $chan ] ] $nick }
        ;
      }
      dec %i
    }
  }
}
;
; usage &gt;&gt;&gt; automaticly tracks number of messages to channel and +v's after 50
;
on *:TEXT:*:#yourchannelname:{
  hinc -m textcounter. [ $+ [ $chan ] ] $nick
  if (($me isop $chan) &amp;&amp; ($hget(textcounter. [ $+ [ $chan ] ] ,$nick) &gt; 50)) {
    ; ^ 50 above is the number of lines needed to voice, change as u like
    ;
    mode $chan +v $nick
  }
}

copy code above paste into wordpad, copy out of wordpad, in mirc press alt-r, if not blank window then select file/new, then paste code above into it.
(the wordpad stuff fixes soemthing the forum does to the text)

try that above ^^^, you well need to edit the following line in the above...
on *:TEXT:*:#yourchannelname:{
replace yourchannelname with well i think you can guess.
then in your channel when your oped type /automatic.devoicer #yourchannelname
(same again for that one, replace with your channel name smile )

you might want to try replacing the ON *:TEXT:*:etc etc part and below with the chunk below.
It counts the lines typed, but deprecieates them over time, Every 30 seconds a line typed no longer counts in your total lines counted.
The 30 seconds is adjustable as is the lines tell you get voiced.

Code:
;
; usage &gt;&gt;&gt; automaticly tracks number of messages to channel and +v's after %lines.to.voice is passed
;
on *:TEXT:*:#yourchannelname:{
  var %reduce.time = 30
  ;^ seconds before a line typed is not countered anymore
  ;
  var %lines.to.voice = 50
  ;^ lines you need to be voiced.
  ;
  hinc -mz textcounter. [ $+ [ $chan ] ] $nick %reduce.time
  if (($me isop $chan) &amp;&amp; ($hget(textcounter. [ $+ [ $chan ] ] ,$nick) &gt; $calc(%lines.to.voice * %reduce.rate))) {
    mode $chan +v $nick
  }
}

Joined: Jan 2005
Posts: 7
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2005
Posts: 7
I`ve gone with ur code DaveC (thanks for the trouble u`r putting up with me) but...big problem..
after about one minute after activating "/automatic.devoicer #yourchannelname" i got disconnected with "excess flood" frown
(maybe because i`ve changed the idle time from 3600 to 60 for testing it)
Also.. i give some thought into it ... and..
I guess it would be the best if the script would check for idle only the voiced users in the chan and not all users.
Hope i`ll get ur attention again..thank you again.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
A very good point indeed (this only checks the +v users)

Code:
alias -l devoice.on.idle {
  if (($1 ischan) &amp;&amp; ($me isop $1)) {
    var %i = $nick($1,0,v)
    while (%i) {
      if ($nick($1,%i,v).idle &gt;= 3600) {
        ;^ 3600 above is 60 seconds x 60 minutes, adjust idle time as needed.
        ;
        mode $1 -v $nick($1,%i,v)
        ;
        if ($hget(textcounter. [ $+ [ $chan ] ] ,$nick)) { hdel textcounter. [ $+ [ $chan ] ] $nick }
        ;
      }
      dec %i
    }
  }
}


try that modification. I didnt address the flood off event as really im pretty sure it occured becuase it was devoicing unvoiced users.

If u are really concerende then try this below (i think its over kill tho)

Code:
alias -l devoice.on.idle {
  if (($1 ischan) &amp;&amp; ($me isop $1)) {
    var %d = 0
    var %i = $nick($1,0,v)
    while (%i) {
      if ($nick($1,%i,v).idle &gt;= 3600) {
        ;^ 3600 above is 60 seconds x 60 minutes, adjust idle time as needed.
        ;
        .timer. [ $+ [ $nick($1,%i,v) ] ]  1 %d mode $1 -v $nick($1,%i,v)
        inc %d
        ;
        if ($hget(textcounter. [ $+ [ $chan ] ] ,$nick)) { hdel textcounter. [ $+ [ $chan ] ] $nick }
        ;
      }
      dec %i
    }
  }
}


Simply added a delay counter in so your devoicing one person per second (its a dirty method, but most times it well never be more than one user so wont make any difference)

Joined: Jan 2005
Posts: 7
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2005
Posts: 7
Thank you DaveC ...Almost perfect smile
The devoicing works just fine, But the voicing part is kinda weird confused
Either way you proposed here, i`ve tested it. And.. the things is.. if one gets voice from the script for writing the necessary lines, and later on gets devoiced for idleing, well... when that person writes a new line (after being devoiced) it gets voiced again before writing the necessary amount of lines laugh.
If i`m a pain in the ass you`re free to kick me grin

Aa! and antoher question.. the idle used in the code.. refers to the idle on the specified channel..? or the whole thing? i mean... some users are not chatting in the chan but maybe they're having prv conversations, or on other channels.. so which one is it? blush

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Thank you DaveC ...Almost perfect smile
The devoicing works just fine, But the voicing part is kinda weird confused
Either way you proposed here, i`ve tested it. And.. the things is.. if one gets voice from the script for writing the necessary lines, and later on gets devoiced for idleing, well... when that person writes a new line (after being devoiced) it gets voiced again before writing the necessary amount of lines laugh.
If i`m a pain in the ass you`re free to kick me grin

Aa! and antoher question.. the idle used in the code.. refers to the idle on the specified channel..? or the whole thing? i mean... some users are not chatting in the chan but maybe they're having prv conversations, or on other channels.. so which one is it? blush


Doh! I looked at it and looked at it and looked at it, and couldnt see it, sent it to a friend and he tells me the fault right off


Code:
alias -l devoice.on.idle {
  if (($1 ischan) &amp;&amp; ($me isop $1)) {
    var %i = $nick($1,0,v)
    while (%i) {
      if ($nick($1,%i,v).idle &gt;= 3600) {
        ;^ 3600 above is 60 seconds x 60 minutes, adjust idle time as needed.
        ;
        if ($hget(textcounter. [ $+ [ $1 ] ] ,$nick($1,%i,v))) { hdel textcounter. [ $+ [ $1 ] ] $nick($1,%i,v) }
        ;
        mode $1 -v $nick($1,%i,v)
        ;
      }
      dec %i
    }
  }
}


I had the code in there, but it was using $nick, becuase I copied it out of the event code that used $nick and not $nick($1,%i,v) like this needs. Also $chan instead of $1, oh my oh my error city.
I also moved it infront of the devoice as Im not sure if the internal list of voiced users is updated when the devoice command is issued or when the user is devoiced by the server, i think it would be the serbver, but why take the risk.

$nick($1,%i,v).idle referes to the channel held in $1 which is the channel you specified when triggering the timer alias that calls this one.
So yes its only relevent to your channel.

Joined: Jan 2005
Posts: 7
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2005
Posts: 7
Thank you very much DaveC for your time and effort. It works smile
I got new ideas about it thou` laugh ..
Can it be possible to take into account the devoices that appear after kick or some other possible events.. other than idle devoice ? I mean.. to start the line counting again from nothing cos after a kick.. a voiced user gets his voice again by writing one line laugh
also It would be cool to have some black list that would make the script not to count the lines of certain users. That would be resolved by a small ignore.. but this script its on a channel protection bot... so.. i better dont give some users the chance to do 'illegal' stuff on the chan without penalty laugh

If its too much what i just asked dont bother workin on it :tongue:
Cheers. and thanks again

Joined: Jan 2005
Posts: 7
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2005
Posts: 7
well any one could help make it delete the voiced user from the script memory on kick, quit or part?
this is the code..
Code:
 
on *:TEXT:*:#Rockul:{
  hinc -m textcounter. [ $+ [ $chan ] ] $nick
  if (($me isop $chan) &amp;&amp; ($hget(textcounter. [ $+ [ $chan ] ] ,$nick) &gt; 50)) {
    ; ^ 50 above is the number of lines needed to voice, change as u like

    mode $chan +v $nick
  }
}
 

i thought smth like that would do..
Code:
  
on 1:kick:#:{ 
  if ($knick = $nick($1,%i,v)) { hdel textcounter. [ $+ [ $1 ] ] $nick($1,%i,v) }
}

but oviously i`m not a scripter..so that wouldnt work

any ideas, pls ? crazy

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Try this
Code:
on *:kick:#:{ 
  if $hget(textcounter. $+ #) { hdel $v1 $knick }
}

Joined: Jan 2005
Posts: 7
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2005
Posts: 7
Hey ..that worked.. thanks a bunch! smile

Now i only have the on Quit and On Part.. to do the same thing..
I tried something but oviously..again FAILURE frown
anybody.. ? blush

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Part is the same except using $nick and not $knick smile
Code:
on *:part:#:{ 
  if $hget(textcounter. $+ #) { hdel $v1 $nick }
}


For quits, you have to loop through $comchan() because there is no specific channel associated with a quit.
Code:
on *:quit:{
  var %i = 1
  while $comchan($nick,%i) {
    if $hget(textcounter. $+ $v1) { hdel $v1 $nick }
    inc %i
  }
}

Joined: Jan 2005
Posts: 7
F
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Jan 2005
Posts: 7
it works fine..
Thank you a lot..


Link Copied to Clipboard