mIRC Home    About    Download    Register    News    Help

Print Thread
#131874 05/10/05 07:14 PM
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
Hello,

I have been working on a filter script which has the aim of filtering Global operator and Chat operator notices. The main section is working correctly, however, I continue to get an "internal" type error message saying:

* /window: invalid parameters (line X, scriptname.mrc)

I am unsure of what the problem is after trying several things. Here is the line in question:

if ($window(@ $+ %Go.Rep) == $null) { /window -bne @ $+ %Go.Rep $lower(/ $+ %Go.Rep) | /titlebar @ $+ %Go.Rep Filter }

Does anyone have any ideas? Any help is greatly appreciated.

Many thanks,
Leroy


"... I prefer to call it an undocumented feature."
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Most likely, you have no value in %Go.Rep. Check your script for where it's being set and see if it is really being set. You could echo out the variable as well, if you want to see if it is set.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
Thanks for the speedy reply.

I hope you don't mind, but as the script isn't a large one, I have included it below incase I am missing something that someone else may pick up on as being the error. If anyone can catch the "bug" please let me know:

on ^1:SNOTICE:*:{
if (($2 != Global) && ($2 != ChatOps)) { Return }
if ( ( $2 == ChatOps ) && ( . !isin $5 )) /Set %Go.Rep ChatOps
if ( ( $2 == Global ) && ( . !isin $5 ) ) /Set %Go.Rep GlobOps
if ($window(@ $+ %Go.Rep) == $null) { /window -bne @ $+ %Go.Rep $lower(/ $+ %Go.Rep) | /titlebar @ $+ %Go.Rep Filter }
Aline -ph @ $+ %Go.Rep < $+ $left($5,$calc($pos($5,!) -1)) $+ > $6-
Unset %Go.Rep
HaltDef

}


"... I prefer to call it an undocumented feature."
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
well, I did have some questions
Code:
on ^1:SNOTICE:*:{
  if (($2 != Global) &amp;&amp; ($2 != ChatOps)) { Return }
  if ( ( $2 == ChatOps ) &amp;&amp; ( . !isin $5 )) { Set %Go.Rep ChatOps }
  if ( ( $2 == Global ) &amp;&amp; ( . !isin $5 ) ) { Set %Go.Rep GlobOps }
  if ($window(@ $+ %Go.Rep) == $null) { 
    window -bne @ $+ %Go.Rep 
    ;; what is this meant to do? ===&gt; $lower(/ $+ %Go.Rep)
    titlebar @ $+ %Go.Rep Filter 
  }
  Aline -ph @ $+ %Go.Rep &lt; $+ $left($5,$calc($pos($5,!) -1)) $+ &gt; $6-
;;; does $5 Always have ! in the string?
;;; if you just want to take out the ! from $5 then use $remove($5,!)
;;; that wont fail if there is no ! in the string, but will remove all occurances of !

  Unset %Go.Rep
  HaltDef
} 


also if you use var %Go.Rep = in place of /set %Go.Rep you then don't have to unset the var at the end, this is not a big deal in this script but later on you may use several vars in a script and unless you need to save the value for later then the var %varname = is a much better way to do things.

Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Try this? It would probably help if you could provide use with examples of the Global and ChatOps notices if you still have problems with the script.

Code:
on ^1:SNOTICE:*:{
  if ($2 != Global) &amp;&amp; ($2 != ChatOps) { Return }
  if (. !isin $5)) {
    if ($2 == Global) { var %Go.Rep = GlobOps }
    else { var %Go.Rep = $2 }
    if (!$window(@ $+ %Go.Rep)) {
      window -bne @ $+ %Go.Rep $lower(/ $+ %Go.Rep)
      titlebar @ $+ %Go.Rep Filter
    }
    aline -ph @ $+ %Go.Rep &lt; $+ $left($5,$calc($pos($5,!) -1)) $+ &gt; $6-
    haltdef
  }
} 


MikeChat, the '$lower(/ $+ %Go.Rep)' is the [/command] parimater for creating windows. It will automatically put the /command followed by a space in the editbox, works much the same as the extra 'command editbox' for channels does, except that its for the main editbox of the window. $lower(/ $+ %Go.Rep) returns either /globops or /chatops.

Last edited by Om3n; 06/10/05 08:27 AM.

"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
Thanks again for the replies.

Om3n, I tried the code you provided and received the following message when trying to execute a "Globops" message

* /elseif: invalid format (line 7, script.mrc)

I have inserted below copies of the Global notices I am referring too, as requested.

Global - Globops:
-server.network.org- *** Global -- from Leroy: Test

Chatops:
-server.network.org- ***Chatops -- from Leroy: Test

Below is also an example of another type of Global message which causes the internal error I noted in my first post:

-server.network.org- *** Global -- from server.network.org: services are being severely attacked by <user>

My aim is to distinguish the Global "Globops" messages from the other Global messages - Globops being user issued and the other Global notices being from the server - and then execute in to its own filtered window (as mentioned in my first post). Globops and Chatops should have their own filter window (which is why in original script it is set in GoRep to @Chatops and @Globops accordingly).

Thanks in advance again.
Leroy


"... I prefer to call it an undocumented feature."
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
try these slightly different versions of the
Code:

on ^1:SNOTICE:*:{
  if ($2 != Global) &amp;&amp; ($2 != ChatOps) { Return }
  if (. !isin $5)) {
    if ($2 == Global) { var %Go.Rep = GlobOps }
    else { var %Go.Rep = $2 }
  }
  if (!$window(@ $+ %Go.Rep)) {
    window -bne @ $+ %Go.Rep $lower(/ $+ %Go.Rep)
    titlebar @ $+ %Go.Rep Filter
  }
  aline -ph @ $+ %Go.Rep &lt; $+ $left($5,$calc($pos($5,!) -1)) $+ &gt; $6-
  haltdef
}
on ^1:SNOTICE:*:{
  if ($2 != Global) || ($2 != ChatOps) { Return }
  if (. !isin $5)) {
    if ($2 == Global) { var %Go.Rep = GlobOps }
    if ($2 == ChatOps) { var %Go.Rep = ChatOps }
  }
  if (!$window(@ $+ %Go.Rep)) {
    window -bne @ $+ %Go.Rep $lower(/ $+ %Go.Rep)
    titlebar @ $+ %Go.Rep Filter
  }
  aline -ph @ $+ %Go.Rep &lt; $+ $left($5,$calc($pos($5,!) -1)) $+ &gt; $6-
  haltdef
}


I think the one from omen just missed a closeing bracket "}"

I have no way to test the code but I think it should be || (or) rather than && (and) because it should be one or the other, not both

Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
|| is wrong because if one exists the other can't, so the script will halt every time.

I didn't miss a bracket at all, because i figure the stuff inside the if (!$window), as well as the aline and haltdef, should not occur if "if (. !isin $5)" fails, which it does in the case of it being outside of the (. !isin $5) if. This is what creates the /window error, proceeding with this section of script when %Go.Rep is not set. I believe my mistake was using if-else-if.

Code:
on ^1:SNOTICE:*:{
  if ($2 != Global) &amp;&amp; ($2 != ChatOps) { Return }
  if (. !isin $5)) {
    if ($2 == Global) { var %Go.Rep = GlobOps }
    if ($2 == ChatOps) { var %Go.Rep = ChatOps }
    if (!$window(@ $+ %Go.Rep)) {
      window -bne @ $+ %Go.Rep $lower(/ $+ %Go.Rep)
      titlebar @ $+ %Go.Rep Filter
    }
    aline -ph @ $+ %Go.Rep &lt; $+ $left($5,$calc($pos($5,!) -1)) $+ &gt; $6-
    haltdef
  }
} 


If you didn't mind the @GlobOps window being @Global instead, you could remove those two if statements completely replacing them with a sinple 'var %Go.Rep = $2'

Edit :: Just an observation, "$left($5,$calc($pos($5,!) -1))" refers to an explanation mark in the token, but going by the examples you posted there is never an explanation mark in it, so that whole bit of code is useless. Did you mean colon? " : "

Last edited by Om3n; 07/10/05 05:49 AM.

"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
The section of code "$left($5,$calc($pos($5,!) -1))" is still in there from an older version of the script when the server would send Globop notices with *!*@* (nick!ident@ip) as the prefix - however, due to recent changes on the network, the coders have removed that prefix and now only use the nick - as you can see from the snippet of globop notice in my previous post - so you're quite right I can probably remove that section.

I'll try out the code this evening and report back if it works.

Thanks again.


"... I prefer to call it an undocumented feature."
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
Hi again,

I tried your script above, Om3n, I had to alter one small section, as it was giving me an elseif error. After amending it, I still get the same * /window: invalid parameters (line X, script.mrc)

I thought this script would be simpler than it's proving to be. Any more ideas guys? I appreciate all your help and input.


"... I prefer to call it an undocumented feature."
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
We must be missing something?? try typing the following commands manually...

//set %Go.Rep TESTING
//window -bne @ $+ %Go.Rep $lower(/ $+ %Go.Rep)

Does it still give an error? Maybe you need to force the evaluation of %Go.Rep with "@ $+ [ %Go.Rep ]"? hmm

Edit :: Looking more closely at your previous posts... the chatops example you posted was as follows. Was this simply a mispaste, or does the chatops notice infact show this way WITHOUT a space between *** and Chatops. (this would make ***Chatops $1 and -- $2 etc)

Chatops:
-server.network.org- ***Chatops -- from Leroy: Test


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
When I tried to enter your commands manually (as above), om3n, I do not get any error reply, it sets GOREP to TESTING and then executes the TESTING window.

My apologies, it must have been a mispaste, the chatops notice does have a space within it.


"... I prefer to call it an undocumented feature."
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
I finally got the script fixed after some alterations, I just wanted to say thanks to everyone that helped and answered my posts along the way. Thanks.


"... I prefer to call it an undocumented feature."
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Would you mind pasting your final code for this, i'd be interested in seing the difference. I tried the code locally and it seemed to work for me shrug.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Oct 2005
Posts: 8
L
Leroy Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2005
Posts: 8
Of course, here is the final code that eventually works a treat:

Code:
 on ^1:snotice:*???????--?from*: {
  if ($2 == helpop) { set %ops Helpops }
  if ($2 == global &amp;&amp; . !isin $5) { set %ops Globops  }
  if ($2 == global &amp;&amp; . isin $5) { return }
  if ($2 == locops) { set %ops Locops }
  if ($2 == chatops) { set %ops Chatops } 
  if ($window(@ $+ %ops) == $null) { /window -en @ $+ %ops $lower(/ $+ %ops) }
  aline -ph @ $+ %ops &lt; $+ $left($5,$calc($pos($5,!) -1)) $+ &gt; $6- | .halt
  unset %ops
} 


"... I prefer to call it an undocumented feature."

Link Copied to Clipboard