mIRC Homepage

on:quit question

Posted By: orcsoul

on:quit question - 03/01/10 11:36 PM

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.
Posted By: genius_at_work

Re: on:quit question - 03/01/10 11:45 PM

It may be easier to just do a quick check at the beginning of your script's events/commands. Something like this:


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.

Posted By: orcsoul

Re: on:quit question - 03/01/10 11:54 PM

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.


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.
Posted By: Darwin_Koala

Re: on:quit question - 04/01/10 06:33 AM

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.


Posted By: Riamus2

Re: on:quit question - 04/01/10 03:31 PM

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:
on bot:quit: { .notice backup_bot_nick join #yourchan }
on bot:join:#yourchan { .notice backup_bot_nick part #yourchan }

On backup:
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.
Posted By: orcsoul

Re: on:quit question - 12/01/10 01:45 AM

in your examples.. is bot/watcher going to be channel nick?

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

Re: on:quit question - 12/01/10 03:03 AM

Actually, if the bot's nick was tempbot, then the op would be wanting
on *:quit:{
  if ($nick == tempbot) {
    ;script if tempbot quits
  else {
    ;script if someone other than tempbot quits

The only way
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.
Posted By: orcsoul

Re: on:quit question - 12/01/10 03:47 AM

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.
Posted By: RusselB

Re: on:quit question - 12/01/10 05:45 AM

see /help user levels
Posted By: Riamus2

Re: on:quit question - 12/01/10 02:40 PM

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).
© 2022 mIRC Discussion Forums