mIRC Home    About    Download    Register    News    Help

Print Thread
on:quit question #217174 03/01/10 11:36 PM
Joined: Jan 2007
Posts: 9
O
orcsoul Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jan 2007
Posts: 9
Having some difficulty finding the right syntax for a problem I'm trying to address.

Looking to have an action occur when a specific user, in a specific channel quits, and again when the same user in the same channel re-joins.

So far I'm guessing this needs to be handled by an on:quit and on:join. But I've got no idea how to set this up to be user and/or channel specific.

The goal is to automatically run a bot script as backup when this user is disconnected.

Re: on:quit question [Re: orcsoul] #217175 03/01/10 11:45 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
It may be easier to just do a quick check at the beginning of your script's events/commands. Something like this:


Code:

alias stopevents {
  if (Frank isop $chan) return 1
  return 0
}

on *:EVENT:*:{
  if ($stopevents) return

  ; Your regular script goes here

}



Adjust the /stopevents alias to perform whatever checks you need. Make it return 1 to stop your events from occurring, and return 0 to allow your events to occur.

-genius_at_work

Re: on:quit question [Re: genius_at_work] #217177 03/01/10 11:54 PM
Joined: Jan 2007
Posts: 9
O
orcsoul Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jan 2007
Posts: 9
Actually I just rethought my problem, and it's been revised slightly. Here's the gist of it now:

mirc1 is connected 24/7 to a static set of channels and servers.
mirc2 is dedicated bot client that is connected to the same channels on only one server.

ServerA is the server in common between mirc1 and mirc2. All channels are assumed to be hosted on ServerA. ChannelA will always be connected to by mirc2. ChannelB will contain userA that the mirc2 bot will join/part on UserA's quit/join message.

So..

mirc1 sees UserA quit (disconnect, netsplit, etc).
mirc1 fires trigger telling mirc2 to join ChannelB
mirc2 takes over bot functions in ChannelB until UserA re-joins.
UserA re-joins ChannelB and mirc2 fires trigger to part ChannelB.

I hope this makes some semblance of sense.

Re: on:quit question [Re: orcsoul] #217183 04/01/10 06:33 AM
Joined: Feb 2004
Posts: 206
D
Darwin_Koala Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
I don't have mirc up and running at the moment but:

- check USERLEVEL and the associated scripting
- set your nominated user as a named user level
- set your event to run on anyone but that user level (can't remember off the top of my head how this goes).

this gives an easy mechanism for a seperate response for that user.

Cheers,

DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
Re: on:quit question [Re: orcsoul] #217194 04/01/10 03:31 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
I've done similar with a bot of my own, letting other ops run a backup that will join automatically if mine disconnects and then part when mine returns, though it's not enabled atm.

Here's one way to do it:

On person watching for bot getting disconnected:
Code:
on bot:quit: { .notice backup_bot_nick join #yourchan }
on bot:join:#yourchan { .notice backup_bot_nick part #yourchan }


On backup:
Code:
on watcher:text:join &:?: { join $2 }
on watcher:text:part &:?: { part $2 }


You can adjust how you want the command sent. I just did /notice to make it easy, but you can do a similar thing using /msg or /ctcp. You will want to add the hostmask of the bot to the "watcher's" user list with a user level of BOT. Then add the hostmask of the "watcher" to the backup bot's userlist with user level WATCHER. As long as the $address() of the watcher/bot match what you out into your Users list, the events will trigger. Make sure to use a mask that works best for your situation. For example, if the host changes often, you might want to use wildcards.


Invision Support
#Invision on irc.irchighway.net
Re: on:quit question [Re: Riamus2] #217440 12/01/10 01:45 AM
Joined: Jan 2007
Posts: 9
O
orcsoul Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jan 2007
Posts: 9
in your examples.. is bot/watcher going to be channel nick?

so if bot was called tempbot would it be on tempbot:quit: ...?

Re: on:quit question [Re: orcsoul] #217441 12/01/10 03:03 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Actually, if the bot's nick was tempbot, then the op would be wanting
Code:
on *:quit:{
  if ($nick == tempbot) {
    ;script if tempbot quits
  }
  else {
    ;script if someone other than tempbot quits
  }
}


The only way
Code:
on tempbot:quit:{
would work is if the client running the code had a userlevel of tempbot assigned to the nick or address of tempbot.

Re: on:quit question [Re: RusselB] #217442 12/01/10 03:47 AM
Joined: Jan 2007
Posts: 9
O
orcsoul Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
O
Joined: Jan 2007
Posts: 9
Okies.. how do I set user level then to differentiate bot client from user client? I'm sure I've seen it somewhere, but at present my brain is fried and my search fu is non existent.

Re: on:quit question [Re: orcsoul] #217443 12/01/10 05:45 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
see /help user levels

Re: on:quit question [Re: orcsoul] #217453 12/01/10 02:40 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Yes, like RussellB stated, you wouldn't be changing the bot/watcher on those events. You'll instead put in user levels NAMED bot and watcher on the clients that have these events (one of which will be the temp bot).


Invision Support
#Invision on irc.irchighway.net