mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I was thinking of the script editor, mirc often show you the error, and also the line where the error occurred, how about open up the script editor, and at the same time highlight the line?

* /did: 'test' invalid id '2' (line 3, test.mrc)

and this would open up the script editor, and show me the line 3 in the dialog (just as an example i used a dialog), and make a option in the options dialog to enable/disable this feature? would save us some time to browse in the script editor to find the line you looking for. Just an idea i got. smile and yes, i know you can type in the line and jump down to it, but if it doing this itself it would go much faster.. smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Mar 2006
Posts: 395
T
Pan-dimensional mouse
Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Not really a good idea, unless it was optioned.
Many mIRC users would be confused if they were using a downloaded script and the script editor is popping up every 5 minutes.


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
As i wrote "and make a option in the options dialog to enable/disable this feature", and have it Disabled as default after install of mirc. And since mirc show you the line that feature already is there all that is needed is a call for the dialog, and that it show the right line, no need to highlight the line, just that it brows down to lets say 100 if the error is in line 110, then you are at the area of the problem from start. smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Even with the ability to disable it, it's still a pretty bad idea. This is equally annoying even for the script author. Imagine having broken code inside a fast timer. How would you disable it if you keep losing focus? Or something that triggers ON TEXT (potential social engineered DoS). Or maybe imagine that you're happily typing text while the script editor pops up and then you end up typing bogus crap into your script editor without noticing, adding *more* bugs to your already broken script. Popping up dialogs in your face without asking for it is something that's already been phased out of UI design for good reason, because it's annoying as sin.

The better idea would be to have HOTLINK behaviour and open the editor if you double clicked the filename, though that would require special hotlink support to differentiate a real filename from any "word.word".


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
* /did: 'test' invalid id '2' (line 3, test.mrc) <- How often do you type anything like that while scripting? and why type something sent to the status window while scripting? and if you can disable it, then you wont be dealing with that function in mirc. smile and as i said, it's just a idea..

And it should only trigger on error, nothing else..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
What do you mean, "how often"? It could happen extremely often.

It doesn't even need to happen "while scripting". Bugs, as you probably know, don't stop occurring when you decide to stop scripting. If you have various bugs in your script you could end up with such errors all over the place at any moment in time. You make the naive assumption that errors can only occur by direct input from the user-- this is wrong.

Anyhow, here's an idea for you. I fleshed out the HOTLINK script in the above post:

Code:
alias sendkeys { .comopen a WScript.Shell | .comclose a $com(a,SendKeys,3,*bstr,$$1-) }
on $^*:HOTLINK:/(\S+\.(mrc|ini))/:*: { 
  if (!$regex($hotline,\(line (\d+)\x2C $regml(1) $+ \)$)) halt
}
on $*:HOTLINK:/(\S+\.(mrc|ini))/:*:{ 
  var %filename = $regml(1)
  if ($regex($hotline,\(line (\d+)\x2C %filename $+ \)$)) {
    var %valid = $true, %index = 1, %type = R
    while ($script(%index)) { if ($v1 == $script(%filename)) goto open | inc %index }
    var %index = 1, %type = A
    while ($alias(%index)) { if ($v1 == $alias(%filename)) goto open | inc %index }
    %valid = $false
    :open
    dec %index
    sendkeys $+(%,R%,%type) 
    if (%valid) {
      .timer -m 1 100 sendkeys % $!+ V{DOWN %index $+ }~
      .timer -m 1 200 sendkeys ^G $+ $regml(1) $+ ~+{END}
    }
  }
}


Assuming the error is in a Remote script or Aliases but not Popups section, this should allow you to click the filename and load up the line, all highlighted and everything.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
While I don't regard the feature itself very useful, I tried that nice script instantly - but it failed for me:
having more remote scripts loaded than the "view" menu can show, it will open a wrong file. And I don't know how to access the "more..." option of the view menu with sendkeys (as it will have a variable no. of lines), to enter the script's name in the editbox of "more" and open the right file. smile

Edit: maybe a if ($script(0) > 25) { 26x DOWN = 1x UP in "view" } will do the trick.

Last edited by Horstl; 10/05/09 09:13 PM.
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It would indeed help for mIRC to have a /command to load the script editor, possibly with an optional filename that could load that file (maybe even having line-number semantics, though it should not highlight the line), eg. /script -l28 file.mrc

If any feature is added from this suggestion, maybe it should be that. It would turn the above hotlink script into:

Code:
on $^*:HOTLINK:/(\S+\.(mrc|ini))/:*: { 
  if (!$regex($hotline,\(line (\d+)\x2C $regml(1) $+ \)$)) halt
}
on $*:HOTLINK:/(\S+\.(mrc|ini))/:*:{ 
  var %filename = $regml(1)
  if ($regex($hotline,\(line (\d+)\x2C %filename $+ \)$)) {
    script -l $+ $regml(1) %filename
  }
}


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Only for those who are both interested and as disorganised as I am (with more than 25 remotes and/or aliases loaded):
Here's a modification of argv0's script (from the 2nd hotlink event onwards). It uses the "more" dialog to open the "right" file for more than 25 files, and loops only aliases OR remotes.
Code:
on $*:HOTLINK:/(\S+\.(mrc|ini))/:*:{ 
  var %filename = $regml(1)
  if ($regex(line,$hotline,\(line (\d+)\x2C %filename $+ \)$)) {
    var %index = 1, %type = $iif($script(%filename),R,$iif($alias(%filename),A)), %more 
    if (%type == A) { 
      if ($alias(0) > 25) { var %more = $true }
      else {
        while ($alias(%index)) { if ($v1 == $alias(%filename)) goto open | inc %index }
      }
    }
    elseif (%type == R) { 
      if ($script(0) > 25) { var %more = $true }
      else {      
        while ($script(%index)) { if ($v1 == $script(%filename)) goto open | inc %index }
      }
    }
    else { return }
  }
  :open
  dec %index
  sendkeys $+(%,R%,%type)
  .timer -m 1 100 sendkeys % $!+ V $+($chr(123),$iif(%more,UP,DOWN %index),$chr(125),~)
  if (%more) { .timer -m 1 200 sendkeys $sendsafe(%filename) $+ ~ }
  .timer -m 1 300 sendkeys ^G $+ $regml(line,1) $+ ~+{END}
}

alias -l sendsafe { return $regsubex($1-,/(.)/g,$+($chr(123),\t,$chr(125))) }

Joined: May 2009
Posts: 139
E
Vogon poet
Offline
Vogon poet
E
Joined: May 2009
Posts: 139
What is this supposed to trigger?
It doesn't trigger anything in these examples:
* /mode: not connected to server (line 1, saliases.ini)
-
* /dialog: invalid parameters (line 275, aliases.mrc)
-
* /did: 'test' invalid id '2' (line 3, test.mrc)


- Excalibur
- Good and Evil, there never is one without the other.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Originally Posted By: Horstl
Here's a modification of argv0's script (from the 2nd hotlink event onwards).
I provided only the code parts I altered/added, it won't work without this part (sendkey alias and first hotlink event):
Code:
alias sendkeys { .comopen a WScript.Shell | .comclose a $com(a,SendKeys,3,*bstr,$$1-) }
on $^*:HOTLINK:/(\S+\.(mrc|ini))/:*: { 
  if (!$regex($hotline,\(line (\d+)\x2C $regml(1) $+ \)$)) halt
}

Also note that both scripts won't attempt to open the editor until you double-click the filename (something.mrc/-.ini) in the error message. You should see a different cursor icon if hovering over that part of that a line.

Joined: May 2009
Posts: 139
E
Vogon poet
Offline
Vogon poet
E
Joined: May 2009
Posts: 139
*faceplam* heh sorry, didn't see this part


- Excalibur
- Good and Evil, there never is one without the other.

Link Copied to Clipboard