mIRC Home    About    Download    Register    News    Help

Print Thread
#216869 05/12/09 04:04 AM
Joined: Jul 2008
Posts: 236
S
s00p Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
I'm not sure where to ask this. According to the mIRC help docs, haltdef shouldn't halt any processing, but I can't seem to get highlight working properly when using /haltdef in an on TEXT event. A testcase should be sufficient to demonstrate this.

Many of you will already know how to add a highlight. If you do, add one that you can easily trigger and skip this, but make sure you add a tooltip message and check the tip message checkbox.
1. Type /abook -h to get to the highlight window.
2. Check the "Enable highlight" checkbox, if it isn't already.
3. Click the "Add" button to get to the Add Highlight window.
4. Enter $me in the "Highlight lines that contain these words:" textbox.
5. Check the "Tip message:" checkbox and add this text to the "Message:" textbox down the bottom of the dialog: ring... ring...
6. Click "OK" back to the main mIRC screen.

Enter the following code into a new script and save it:
Code:
on ^1:TEXT:*:#: {
  echo # $+(<,$nick,>) $1-
  haltdef
}

You'll need 2 connections to trigger this, so open a new connection to the same server and join a common channel. Assuming the nickname for your first connection is foo and the nickname for your second connection is bar, activate the common channel window for bar and type /timer 1 5 say hi, foo! Switch to a different task, and wait 5 seconds.

I know mIRC help states "Note: Halting the default text for an event affects how mIRC displays the most basic information about IRC events to a user, so it should be used carefully.", but if I can't write a script that uses haltdef (or some alternative) and allows highlighting to function properly... well I see that as a significant loss of control and flexibility.

Granted, being able to halt the highlighting is great. It's what I was looking for earlier (to stop people from repeatedly highlighting me, which is very annoying) and I'm greatful that I've found this out. Is it possible to halt the default text, while allowing highlights to work properly?

Last edited by s00p; 05/12/09 04:06 AM.
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Ok, it's way too early to test this out myself, but my only thought at this time is that perhaps the problem lies in the echo.
Try using the -m switch in the echo command and see if your behaviour still occurs.

*goes back to bed*

Joined: Jul 2008
Posts: 236
S
s00p Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
The problem lies within the haltdef. My testcase will prove this: if you comment out haltdef, the tip shows up like it should. I tried your suggestion. I even tried commenting out the echo altogether. The problem lies within the haltdef.

Last edited by s00p; 05/12/09 04:24 AM.
Joined: Mar 2004
Posts: 54
Z
Zed Offline
Babel fish
Offline
Babel fish
Z
Joined: Mar 2004
Posts: 54
It works perfectly with -l :

Code:
on ^1:TEXT:*:#: {
  echo -l # $+(<,$nick,>) $1-
  haltdef
}


Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Originally Posted By: Zed
It works perfectly with -l

Of course. -.- Close but no cigar.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Quote:
The problem lies within the haltdef. My testcase will prove this: if you comment out haltdef, the tip shows up like it should.
Is this a joke ?
Ok you know that haltdef is halting the mirc default behavior. You're setting some highlight in mirc option (that affect the mirc default behavior)
You're using an on text event with haltdef so mirc won't do anything and complaining that mirc should do something ?

edit :
Quote:
but if I can't write a script that uses haltdef (or some alternative) and allows highlighting to function properly... well I see that as a significant loss of control and flexibility.
That's the problem, why would you want to use haltdef if you want mirc to execute his option, you can't have both, that's why /echo have some switch (-l here)

Last edited by Wims; 05/12/09 07:38 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2010
Posts: 1
D
Mostly harmless
Offline
Mostly harmless
D
Joined: Jan 2010
Posts: 1
I was recently trying to script something similar to this and came up with a solution like this. If I get the jist of what you're trying to do I hope this helps
Code:
 
on ^*:TEXT:*:#:{
  if ($highlight) && ($highlight($1-) != $null) {
    echo -tml $chan $+(<,$nick,>)  $+ $highlight(color) $+ $1-
  } 
  else {
    echo -tm $chan $+(<,$nick,>) $1-
  }
  haltdef
}
 


The if statement checks if highlighting is enabled then checks if the string $1- matches the highlighted words. If it does it will echo with the highlight function and highlight it in the specified colour.
If not it will echo normally.

Last edited by defunct; 07/01/10 01:17 PM.
Joined: Jul 2008
Posts: 236
S
s00p Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Originally Posted By: Zed
It works perfectly with -l :

Thankyou!

Originally Posted By: Wims
Ok you know that haltdef is halting the mirc default behavior.

I believe your analysis of haltdef may be flawed. You claim it halts 'default behaviour'. I guess further processing (of remote scripts) fits quite nicely within this term 'default behaviour', so haltdef should be a wrapper for /halt by your (incorrect) definition. Lets take a quote from the mIRC help files:
Quote:
If you only want to halt the default text without /halting the entire script, you can use the /haltdef command.

Thus, your terminology is incorrect in the first place. I was asking if it's possible, and moving towards the "request feature" if it wasn't, because it's so unobvious that you don't even know what I'm talking about. Asking me "Is this a joke?" in this circumstance is extremely disrespectful. It implies that I am some form of intellectually inferior being, that my requests are not to be taken seriously. Yes, I was being fucking serious. I was trying to point out useful functionality that appeared to be lost, and request any possible solutions. Stop being a douche.

defunkt, thanks to you too smile

Last edited by s00p; 08/01/10 03:45 AM.
Joined: Jul 2008
Posts: 236
S
s00p Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
On a slightly related topic, what does -m do:
The -m switch indicates that the line should be treated as a user message, not an event.

This isn't very clear to me, because 'user message' and 'event' aren't very well defined in terms of /echo (eg. it doesn't trigger any events). Does this mean it wouldn't log the message?

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
I have long been wondering about that myself, and I see the -m switch applies quite often to custom text events. I have yet to find out what it functions in terms of its relevant purpose.

Joined: Nov 2009
Posts: 117
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
The -m affects how the switchbar buttons higlight
according to settings in options/display.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Originally Posted By: "gooshie"
The -m affects how the switchbar buttons higlight
according to settings in options/display.
I think you mistook the -m for -n switch.

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Originally Posted By: Tomao
I think you mistook the -m for -n switch.

No he didn't.
The -n switch prevents the switchbar button from receiving *any* highlighting.
The -m switch makes it look, highlight-wise, as if a user sent a message to that window (handy when editing incoming user messages).

So -n is no highlight, -m is user message highlight, no switch is event highlight.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Quote:
I believe your analysis of haltdef may be flawed. You claim it halts 'default behaviour'. I guess further processing (of remote scripts) fits quite nicely within this term 'default behaviour',
Yes I'm claiming it halts default behavior, but I didn't say it was halting further processing, wouldn't make sense since /halt is here.
And Yes the help file is talking about the default text but that would not be the first time there's an error.
Quote:
because it's so unobvious that you don't even know what I'm talking about
I think I do.
The "is this a joke" part was because you seems to have pretty good knowledge in msl and not beeing able to figure this out is weird.
I still think that haltdef halts more than text, and that's why /echo has some switch to apply highlighting, beep/flash etc but if this is wrong, it's a bug then.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Ok, thanks much 5618, could you please give me an example of illustrating how these two switches come about?

Joined: Mar 2004
Posts: 54
Z
Zed Offline
Babel fish
Offline
Babel fish
Z
Joined: Mar 2004
Posts: 54
Originally Posted By: s00p
On a slightly related topic, what does -m do:
The -m switch indicates that the line should be treated as a user message, not an event.

This isn't very clear to me, because 'user message' and 'event' aren't very well defined in terms of /echo (eg. it doesn't trigger any events). Does this mean it wouldn't log the message?


Say you have @test opened and minimized (button visible).

/echo @test text
will highlight the text of the button in dark blue (like events do)

/echo -m @test text
will highlight the button (in red ) as if user text came in (on a channel for example)

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Very nice. Thank you.

Joined: Jul 2008
Posts: 236
S
s00p Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Wims, you know as well as I do how unorganised the mIRC help files are. The problem and solution would be far more easily identified if they were defined within documentation for /haltdef. I still think this is more relevant to haltdef -- haltdef should have the switches, not just echo. What if someone wants to write the message to a dialog using /did and echo 'you were highlighted, see the highlights window for more information'? ... not that I'm saying that would be a good idea...

Last edited by s00p; 09/01/10 05:15 AM.

Link Copied to Clipboard