mIRC Home    About    Download    Register    News    Help

Print Thread
#260479 27/04/17 05:25 PM
Joined: Apr 2017
Posts: 5
N
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Apr 2017
Posts: 5
I'm on a channel where users can ask to enter. If no one responds, I'd like the bot to give permission. So I tried a script with an idle after entering of one minute. That worked but it responded to the keyword "enter" anytime someone else said it. I used on join... I'm lost. Any ideas?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I'm not clear exactly what you're asking. It seems what you're saying is that when someone enters a channel that someone's supposed to give them +v permissions, and if nobody does that within 60 seconds, then the bot should go ahead and give it to them. If that's the case, you could have a timer set during on-join like:

on *:JOIN:#channelname:{ .timer 1 60 mode $chan +v $nick }

If someone's already given +v by the time the timer executes, most networks will just ignore the attempt. If your network spams you with an error message, you could instead have the identifier pass the channel name and nick on the command line since the command run by the timer doesn't know what $chan and $nick are:

on *:JOIN:#channelname:{ .timer 1 60 permission check $chan $nick }

alias permissioncheck {
if (!$nick($1,$2,v)) mode $1 +v $2
}

note that this is defeated if someone changes nick soon after entering, so you might need to intercept the ON NICK event, where $nick is the old nick and $newnick is the one being changed to.

If everyone should be given permission, I'm not sure why they need to ask for it, and not just have someone put the give-voice command inside the ON JOIN event.

If you need to knock who in a channel doesn't have +v permissions:

var %total $nick(#channel,0,a,v)

while (%total) {
echo -a $nick(#channel,%total,a,v) doesn't have +v
dec %i
}

Joined: Apr 2017
Posts: 5
N
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Apr 2017
Posts: 5
You are right. I wasn't clear. Sounded good as I was typing it lol

So all lowercase nicks come in and ask permission to enter. Capped up nicks give verbal permission but sometimes the Capped nicks are busy/afk/etc. So, if it goes for 2 minutes and no one has answered, I want my bot to give verbal permission.

Does that make more sense? Here's what I had but it was doing it to everyone that said the word 'enter'.

on *:text:*remain?*:#: { .timerINACTIVITY 1 100 msg $chan You may enter, $nick }

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I'm even more confused now, with extra terms that don't seem to make sense. I've never been at a network where a nick in capitals or lowercase meant anything. It depends whether you changed nick with /nick nerdycritter or /nick NERDYCRITTER

But from what I see in your reply:

1. 100 is 100 seconds
2. I don't understand the purpose of your timer, because it displays the message regardless whether $nick has entered or not during that 100 seconds.
3. The way I'm now reading this is that your ON TEXT event is triggered by everyone saying the keyword in every channel the bot has open. If people are only saying the text in a single channel, then the ":#:" should change to ":#channelname:" so it only responds to the keyword typed in that channel.

If the bot has a way of determining the user doesn't need to be responded to, the timer should call a gatekeeper alias instead of sending out a msg after 100 seconds. Something like

gatekeeper $chan $nick

that I mentioned before. If the permission is to enter #channel2 and the bot is also in channel 2, it can skip responding to them:

if ($nick(#channel2,$2)) return

If the permission is receiving +v in the original channel, it can skip replying if they've already been given voice:

if ($nick($1,$2,v)) return

4. The ON TEXT even can also apply a decision whether to fire up the timer. If the bot can determine that the permission has already been given to $nick then it doesn't need to reply to them.

5. By giving your timer a fixed name, if person-2 speaks the keyword within 100 seconds following person-1 speaking the keyword, the existing timer gets replaced by the new timer. You can just skip the name and mIRC will give it a unique number. Or you can use

.timerINACTIVITY $+ $nick 1 100 msg $chan You may enter, $nick


on *:text:*remain?*:#channelname: {

if ( (code to check if $nick already has permission ) == $true) return

.timerINACTIVITY $+ nick 1 100 gatekeeper $chan $nick
}

alias gatekeeper {
if ( (code to check if $2 already has permission ) == $true) return
msg $1 You may enter, $2
}


Link Copied to Clipboard