mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2006
Posts: 5
C
CSC2YA Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Nov 2006
Posts: 5
I've got an mirc script for a helpdesk bot. The main function of this is to monitor how many people are in helpdesk vs how many poeple are voiced and how many people in there are server operators.

The bot will then give the user joining an approximate waiting time, and will also tell them which number they are in line.

However, I can't figure out how to stop it messaging server operators when they join the helpdesk.

The script that deals with this is as follows:

Code:
on !*:JOIN:%help.chan: {
  timer 1 5
  whois $nick
  if ($nick isop $chan) halt
  if ( $readini(uhelp.ini,config,stat) ) {
    writeini uhelp.ini $chan $_n1($nick) help
    .notice $nick Please wait for your turn as we are busy right now. You will be voiced automaticly when we finish with the current guests. You are number $ini(uhelp.ini,$chan,0) in line. Thank You
  }
}
 


I've tried it with isop and isoper, but neither of these are working correctly.

At the moment it messages everyone that joins, whether or not they are an operator.

Last edited by CSC2YA; 01/06/09 03:06 PM.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
The timers command isn't like a "sleep", you have to give a command to be executed when the timer trigger, like after an if statement and the script isn't waiting with a timer.
Also, when a user is joining a channel, usually, there is a little time before the server or a bot put the user with the right access, this means you don't know if the user is op during the on join event, so the condition is false, you need to use a correct timer to delay the 'check' :

Code:
on !*:JOIN:%help.chan:.timer 1 5 checking_nick $nick $chan
alias checking_nick {
whois $$1 $1
if ($1 !isop $$2) && ($readini(uhelp.ini,config,stat)) {
    writeini uhelp.ini $2 $_n1($1) help
    .notice $1 Please wait for your turn as we are busy right now. You will be voiced automaticly when we finish with the current guests. You are number $ini(uhelp.ini,$2,0) in line. Thank You
 }
}


Last edited by Wims; 01/06/09 03:48 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The problem is the fact that at the time of joining, all users are regular users. No one has ops, half-ops, voice, admin, etc. at the time of joining.

What you can do is to use a timer to delay the check if the person is opped or not. In fact, that appears to be what you have attempted to do, but your timer line is incomplete.

Code:
on !*:join:%help.chan:{
  .whois $nick
  .timer 1 5 check_ops $nick $chan
}
alias -l check_ops {
  if $1 !isop $2 {
    if ( $readini(uhelp.ini,config,stat) ) {
      writeini uhelp.ini $2 $_n1($1) help
      .notice $1 Please wait for your turn as we are busy right now. You will be voiced automaticly when we finish with the current guests. You are number $ini(uhelp.ini,$2,0) in line. Thank You
    }
  }
}


Joined: Nov 2006
Posts: 5
C
CSC2YA Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Nov 2006
Posts: 5
Thanks. That code worked exactly how I needed it to.

I haven't coded for mirc for a long time (I run linux as my main OS and only use windows to run my irc server and mirc based bots on)

I completely forgot how to do timers as a result.

Thanks again for the help.

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
You don't have to wait 5 seconds to check if the nick is an op. You can usually check that after a second.

I use a generic 3 second timer that makes sure the nick is still on the channel before performing any commands.


Link Copied to Clipboard