mIRC Home    About    Download    Register    News    Help

Print Thread
#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.

Joined: Oct 2005
Posts: 1,741
G
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

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.

Joined: Feb 2004
Posts: 206
D
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!
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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
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: ...?

Joined: Aug 2004
Posts: 7,252
R
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.

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.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
see /help user levels

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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

Link Copied to Clipboard