mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2010
Posts: 36
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: May 2010
Posts: 36

I'm trying to restrict the ability of a user to initiate or accept certain actions by trapping the "on" event, but have not been able to trigger any of my attempted script snippets.

In particular, I wish to trap all DCC requests from a remote user, as well as INVITEs and new QUERY windows.

I recognize that I may not quite correctly understand the access levels for DCC and OPEN events, and may have misinterpreted the functioning of these triggers, so bear with my mistakes.

Here are samples of the non-working script snippets:

;;-- triggered by incoming QUERY
on *:open:?:*:{
.echo on OPEN $1-
close -m $nick
halt
}

;;-- triggered by incoming DCC chat
on *:open:=:{
.echo on OPEN $1-
dcc reject
close -ic $nick
halt
}

;;-- triggered by incoming DCC SEND requests
ctcp *:send:?:{
.echo ctcp SEND $1-
dcc reject
close -is $nick
halt
}

In no case do the echos display, which is the basis for my question about how the events are triggered, when, and why.

thanks in advance

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You can use the Ignore list to block many different kinds of requests such as those you are talking about.

Alt-B > Control. Choose Ignore from the drop down menu and click Add. Select the items to ignore and put the address mask to ignore.

As far as just halting events like you were trying to do, you'll need to use ^ in the event line. Note that not all events can be halted this way. See /help halting default text for details.

Last edited by Riamus2; 24/05/10 05:43 PM.

Invision Support
#Invision on irc.irchighway.net
Joined: May 2010
Posts: 36
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: May 2010
Posts: 36
thanks, I clearly missed the use of the caret to suppress default text, but I'm still not seeing an event trigger... I'm pretty sure that no previous "on" events would stop the events from triggering, but I will rearrange and grep for others.

If that doesn't clear the issue, any other suggestions about what and how events are triggered?

Richard

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You cannot prevent events from triggering except by ignoring those events as I mentioned above. You can only hide the text, close any windows that open, etc. I believe it mentions that in the help file where I pointed you. So you're really left with either ignoring the events for various address masks which will prevent them from triggering. Or you can halt the default text, close any windows that open, etc. which will still trigger the event but will appear as though it wasn't triggered.


Invision Support
#Invision on irc.irchighway.net
Joined: May 2010
Posts: 36
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: May 2010
Posts: 36
I'm clearly missing something, as the first thing in every event process routine during debugging mode is an echo statement that identifies which routine was entered and displays the contents of $1- and these are NOT being executed. PLUS the default text is NOT being halted.

Richard

Last edited by Richard_B; 24/05/10 07:26 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Using . before a command (such as echo) will silence it. Therefore, you'd never see the echo. As far as halting the default text, use haltdef in combination with ^. Halt will just halt the script.


Invision Support
#Invision on irc.irchighway.net
Joined: May 2010
Posts: 36
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: May 2010
Posts: 36

interesting... removing the "." command prefix has no effect whatsoever on the result -- the following snippet does NOT work as expected:

;;-- triggered for incoming DCC chat requests
;;
on ^*:OPEN:=:{
echo on OPEN $1-
dcc reject
close -ic $nick
halt
}

...that is, NO echo of "on OPEN" no obvious result from "dcc reject" and the DCC chat window remains open.

Also, curiously, this snippet does work as I'd expected:

on *:INVITE:#:{
.echo on INVITE # $1
describe # has been invited to #
halt
}

...that is, on receiving an INVITE, the following is displayed:
-- in the client status window --
on INVITE <channel-name>
-- in the active channel window of the client and remote --
<nickname> has been invited to <channel-name>

and I'm using mIRC 6.35

Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
I may be all wet here, but aren't you supposed to have a place to echo TO (echo $active <sometext>) or (echo #channel <sometext>) ??
and .. dcc chat window should be =$nick


I refuse to engage in a battle of wits with an unarmed person. wink
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If you don't specify a location in the echo command, then the echo command sends to the status window by default.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
to the active window*


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Your snippet works as expected here.

It echoes "on OPEN" in the status window.

Then the /dcc reject command does nothing because of this: /help /dcc reject

Then the /close -ic $nick does nothing because the dcc window isn't inactive.

And there is nothing left to halt by the end of the script.

-genius_at_work

Joined: May 2010
Posts: 36
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: May 2010
Posts: 36
thanks for the comments... I finally discovered what may be the main reason that events were not being triggered: I misunderstood the sequence of events when receiving a DCC request, expecting that the event would be triggered when the window is actually opened, rather than [apparently] when the connection is established. I also have some connection issues with DCCs that are giving me fits (despite following all the advice given elsewhere.) This is curious to me, as if the window can't be closed using "-i" that implies it's not inactive, so the event should have been triggered already, no?

Clearly more experimentation is needed.

Thanks to all for the replies.

Richard


Joined: Apr 2003
Posts: 342
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
Originally Posted By: Riamus2
Using . before a command (such as echo) will silence it. Therefore, you'd never see the echo. As far as halting the default text, use haltdef in combination with ^. Halt will just halt the script.


Just to clarify... not all events need the ^ prefix. Some events (such as logon) treat ^ entirely differently.


Beware of MeStinkBAD! He knows more than he actually does!
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
For further clarification; a list of events that can /haltdef (or /halt) with a ^ prefix can be found at:

/help Halting Default Text

Any event that uses the ^ prefix but is not listed there (like ON LOGON, or ON HOTLINK) will use it for different purpose, as mentioned. In general, "^" means "triggers before" (before the regular non-prefixed event), but in some cases there is no "default text" to halt/haltdef.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Link Copied to Clipboard