mIRC Home    About    Download    Register    News    Help

Print Thread
#138874 08/01/06 07:33 AM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
Code:
alias autovoice {
  var %x = $nick($1,0)
  while (%x) {
    if (($nick($1,%x).idle >= 1200) && ($nick($1,%x) != $me)) {
      if ($me isop $1) timer 1 2 mode $v2 -v $nick($1,%x)
        [color:red]msg # $nick You've been devoiced because you haven't been saying nothing for over 20 minutes now[/color]
    }
    dec %x
  }
}


that's a part of voice checker i think it's Slade's it checks nick's idle time at a certain time and devoices nick if that nick don't speak in channel for that certain time...

the highlighted part is what i want to add but it gets annoying when i did add that msg to it cause it repeats the hightlighted msg every 10 seconds

how do i fix that?

#138875 08/01/06 08:18 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Part of the problem is where you had the line. You set a timer in the line before, but timers don't take mutliple line commands, so to get around that, I created a small alias that is called from the timer.

The other part, that I can think of, is controlled by the code that calls the autovoice alias

Code:
 alias autovoice {
  var %x = $nick($1,0)
  while (%x) {
    if ($nick($1,%x).idle >= 1200) && ($nick($1,%x) != $me) && ($me isop $1) timer 1 2 idle.voice $1 $nick($1,%x)
    dec %x 
  }
}

alias idle.voice {
  .mode $1 -v $2
  .msg $1 $2 You've been devoiced because you haven't been saying nothing for over 20 minutes now
}
 

#138876 08/01/06 08:35 AM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
ok here is the full
Code:
On *:Join:#: { 
  if ($nick == $me) {
    .timerAV 0 10 autovoice $chan
  }
  else {
    mode $chan +v $nick
  }
}

On me:*:Part:#: { .timerAV off }
On @*:Text:*:#: { 
  if ($nick isreg $chan) mode $chan +v $nick  
}

alias autovoice {
  var %x = $nick($1,0)
  while (%x) {
    if (($nick($1,%x).idle >= 1200) && ($nick($1,%x) != $me)) {
      if ($me isop $1) timer 1 2 mode $v2 -v $nick($1,%x)
    }
    dec %x
  }
}


how do i use that one to that code you added since you said timers don't take multiple commands? how do i use it with those or how do i make it go on the run with that full code?

#138877 08/01/06 10:32 AM
Joined: Oct 2004
Posts: 72
C
Babel fish
Offline
Babel fish
C
Joined: Oct 2004
Posts: 72
It lookes quite good to me. as soon as you join the channel you start a repeating timer to check idle times. I just don't see why you should start another timer that devoices 2 secondes after the check. I would do it like this:
Code:
  
On *:Join:#: { 
  if ($nick == $me) {
    .timerAV 0 10 autovoice $chan
  }
  else {
    mode $chan +v $nick
  }
}

On me:*:Part:#: { .timerAV off }
On @*:Text:*:#: { 
  if ($nick isreg $chan) mode $chan +v $nick  
}

alias autovoice {
  var %x = $nick($1,0)
  while (%x) && ($me isop $1) {
    if (($nick($1,%x).idle >= 1200) && ($nick($1,%x) != $me)) {
      mode $1 -v $nick($1,%x)
      msg $1 $nick($1,%x) You've been devoiced because you haven't been saying nothing for over 20 minutes now

    }
    dec %x
  }
}

#138878 08/01/06 01:06 PM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
thank you, yours seems to work fine thanks much

#138879 10/01/06 09:20 AM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
nevermind, it's still doing the same thing after that 20 minutes, so i guess it's not working still it kept on repeating the msg after that 20 minutes it started repeating the msg every 10 seconds

Last edited by Confuzzled; 10/01/06 09:22 AM.
#138880 10/01/06 11:34 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 On *:Join:#: {
  if ($nick == $me) {    .timerAV 0 10 autovoice $chan  }
  else {    mode $chan +v $nick  }
}
On me:*:Part:#: { .timerAV off }
on *:quit: { .timerAV off }
on me:*:kick:3:{ .timerAV off }
on *:exit: { .timerAV off }
on @*:action:*:#:{
  if ($nick isreg $chan) mode $chan +v $nick 
}
On @*:Text:*:#: {
  if ($nick isreg $chan) mode $chan +v $nick 
}
alias autovoice {
  var %x = $nick($1,0,v)
  while (%x) && ($me isop $1) {
    if (($nick($1,%x,v).idle >= 1200) && ($nick($1,%x,v) != $me)) {
      msg $1 $nick($1,%x,v) You've been devoiced because you haven't been saying nothing for over 20 minutes now
      mode $1 -v $nick($1,%x,v)
    }
    dec %x
  }
}
 


Try this instead. It's close, but it only checks the nicks that are currently voiced, rather than all of the nicks.

#138881 13/01/06 10:01 AM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
excellent!, works perfect now thank you greatly

#138882 23/01/06 08:24 AM
Joined: Mar 2004
Posts: 21
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2004
Posts: 21
Some propositions, face to a lot of errors, i think. Look at that!

[code]
On *:Join:#: {
if ($nick == $me) { .timerAV 0 10 autovoice $chan }
; On join, everybody is a regular user, so you should wait to see
; if a mode will be given to the user, some seconds later.

else { mode $chan +v $nick }
}
;
On me:*:Part:#: { .timerAV off }
;
; timer will be stopped if someone (not you) leaves IRC, useless.
on *:quit: { .timerAV off }
;
; timer will be stopped if you kick a user (and not if you are kicked), useless.
on me:*:kick:3:{ .timerAV off }
;
; timer won't be stopped if you just disconnect, so useless too.
on *:exit: { .timerAV off }
;
on @*:action:*:#:{
if ($nick isreg $chan) mode $chan +v $nick
}

On @*:Text:*:#: {
if ($nick isreg $chan) mode $chan +v $nick
}
;
alias autovoice {
var %x = $nick($1,0,v)
; why not stop the perform if you are not opped before the while ? (more efficient, faster)
while (%x) && ($me isop $1) {
; why checking if you are one of the voiced nick, where as you already checked
: if you are Opped on the channel ?

if (($nick($1,%x,v).idle >= 1200) && ($nick($1,%x,v) != $me)) {
; you are using 3 times $nick($1,%x,v), why not put it in a variable ?
msg $1 $nick($1,%x,v) You've been devoiced because you haven't $&
been saying nothing for over 20 minutes now
mode $1 -v $nick($1,%x,v)
}
dec %x
}
}
[code]




So, i propose you this code, just an idea, but better I think:

[code]
; >> LAUNCH TIMER:
; When you join, we launch the timer (60 seconds here,
; previous 10 seconds seems not more efficient)
On me:*:Join:#:timerAV 0 60 autovoice $chan
;
; >> CHECK IF USER IS REGULAR, AND VOICED HIM
; When a user joins, if you are opped you launch a timer, which will check if the
; user is regular some seconds later (a bot can give him a mode while)
On @!*:Join:#:timer 1 2 givevoice $chan $nick
;
On @*:action:*:#:givevoice $chan $nick
On @*:Text:*:#:givevoice $chan $nick
;
; >> CLOSE TIMER
; when you are kicked, when you leave a channel, when you disconnect.
On *:Kick:#:if ($knick == $me) timerAV off
On me:*:Part:#:timerAV off
On *:Disconnect:timerAV off
;
;
;
; >> ALIASES
; Check if the user is regular, and voice him, if it is the case.
alias givevoice {
if ($2 isreg $1) mode $v2 +v $v1
}
;
;
;
alias autovoice {
; if i am not opped, we stop this checking alias
if ($me !isop $1) return
; we put the channel name in %chan, for later
%chan = $1
; we send all voiced nick to the checkvoice alias
; (all words in the nicklist with a + prefix)
; ( interesting to see how that works, instead of a while
; (although /while is interesting too in this case) )
filter -wwlk $1 checkvoice +*
}
;
;
;
alias checkvoice {
; we put the nick in %nick, without the + prefix
var %nick $right($1,-1)
; if his idle is >= 1200, we send message and voiced the user.
if ($nick(%chan,%nick).idle >= 1200) {
msg %chan %nick You've been devoiced because you haven't been $&
saying nothing for over 20 minutes now
mode %chan -v %nick
}
}
[code]

.. so just an idea, as i said.

Last edited by CoolWave; 23/01/06 08:29 AM.

-Be cool with my English-
irc.EpiKnet.org:#scripts
#138883 02/02/06 12:28 PM
Joined: Oct 2005
Posts: 75
C
Babel fish
OP Offline
Babel fish
C
Joined: Oct 2005
Posts: 75
hmmm, nice
now that makes more sense i will try yours. thank you kindly


Link Copied to Clipboard