mIRC Home    About    Download    Register    News    Help

Print Thread
#144457 10/03/06 04:25 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
This is the code i have:
Code:
alias highlight {
  var %n = 1 | while (%n <= $lines($mircdirfiles/highlight.txt)) { if ($read($mircdirgxfiles/highlight.txt,%n) isin %matchtxt) { 
      if (%hwinow == on) { window - $+ %winstil @Highlight 200 200 600 200 fixedsys | settime1 | check.hlsound | echo @Highlight %_tstmp $chr(3) $+ $color(highlight) $+ $chr(2) $+ Highlight $+ $chr(3) $+ $chr(2) in %matchchan > %matchnick saying $+ $chr(58) %matchtxt | inc %n | goto end }
    else if (%hwinow == off) { settime1 | check.hlsound | echo %_tstmp $chr(3) $+ $color(highlight) $+ $chr(2) $+ Highlight $+ $chr(3) $+ $chr(2) in %matchchan > %matchnick saying $+ $chr(58) %matchtxt } | inc %n }
  }
  :end
}

it make mirc hang when someone say something in a channel. but if i remove all the code and only use the:

if (%hwinow == on) { echo -a do stuff }
else if (%hwinow == off) { echo -a do other stuff }

then it working perfect, what am i missing in the code? :P


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#144458 10/03/06 05:08 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
try it like ELSEIF not else if

#144459 10/03/06 05:20 PM
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
You do somthing you sould not do normali smirk
please Notice thet $highlight is an mirc Identify

also /alias highlight, would Modify this Identify

#144460 10/03/06 09:12 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Your problem was you had both the INC %n's inside the IF condition if ($read($mircdirgxfiles/highlight.txt,%n) isin %matchtxt) thus is that condition was false, then %n was not increased, and you looped around and checked the same line again, again producing a false condition, akak endless loop.

This code should work... NB: i used a BREAK command to exit the while loop, rather than a goto, this is the preferred method of imediatly exiting a loop.
Code:
alias highlight {
  var %n = 1
  while (%n <= $lines($mircdirfiles/highlight.txt)) {
    if ($read($mircdirgxfiles/highlight.txt,%n) isin %matchtxt) {
      if (%hwinow == on) {
        window - $+ %winstil @Highlight 200 200 600 200 fixedsys
        settime1
        check.hlsound
        echo @Highlight %_tstmp $chr(3) $+ $color(highlight) $+ $chr(2) $+ Highlight $+ $chr(3) $+ $chr(2) in %matchchan > %matchnick saying $+ $chr(58) %matchtxt
        BREAK
      }
      else {
        settime1
        check.hlsound
        echo %_tstmp $chr(3) $+ $color(highlight) $+ $chr(2) $+ Highlight $+ $chr(3) $+ $chr(2) in %matchchan > %matchnick saying $+ $chr(58) %matchtxt
      }
    }
    inc %n
  }
}

#144461 10/03/06 09:16 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
You do somthing you sould not do normali smirk


I agree with you on this, it isnt the best practice to use already used words.

Quote:

please Notice thet $highlight is an mirc Identify
also /alias highlight, would Modify this Identify


I disagree with this, his alias in NO WAY well alter the highlight identifier returned values, mircs internal identifiers well be used, any alias by the same name is ignored. (this is not the case for commands however)

#144462 10/03/06 09:36 PM
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
well actualli i was talking general of alias identify, and not specify identify only becuse some identify can be used as a command line with-out the $ i was not sure if $highlight was suppoted as a command /highlight if it was so then it would be modify

see a live exampel Below:

Code:
  
alias nick {
 echo -a lol
}
now if you use in a event $nick it works fine 

but now try to change your nick using /nick newnick 

thes why i posted don't alias general mirc identify 

Last edited by tso29; 10/03/06 09:38 PM.
#144463 10/03/06 09:48 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
You just said what I said to you.
My post was in refrence to you saying the $highlight identifier would be altered, which was incorrect. I even mentioned that a command would be overridden, such as your /nick example. This of course you didnt say originally.

#144464 10/03/06 09:51 PM
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
and fineli what sould user do alias mirc Identify or not what dou think>?,(when i post somthin i already have ben think about it) even if i miss to point thinks out.

#144465 10/03/06 09:59 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
didnt reply anyone special, the reason i want my own "highlight" is cos i dont think mirc's default fill the needs i want from the highlight, like open it in a @window, and this way i can controll the colors of the highlighted text, and i also made it easy to access true a dialog, this means that "new" users have a easyer way to find the highlight system.. smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard