mIRC Home    About    Download    Register    News    Help

Print Thread
#150737 07/06/06 09:14 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
What i have here is a script to locate charitors in a line and let me know when there is a problem.

I am trying to identify charitors in a var line to see if they have the right amount of ='s verses the right amount of , in the line.
here are the two lines I am testing the script with
I can get it to work with var %t = 0
if I expand the var line to more var's. Then the script will not locate the correct information.

var %c = $line(@win,0) , %q = $gettok(%data,1,9)
[color:black]or

var %t = 1, %p = 0, %b = 0, %e = 0
[/color]

Code:
  [color:red] 
alias test {
  var %line = $1- , %i = 1
  while %i <= $numtok(%line,32) {
    var %word = $gettok(%line,%i,32)
    if (($chr(37) == $left(%word,1)) && (%equ != 1)) { set %per 1 }
    if (($chr(61) == %word) && (%per == 1)) { set %equ 1 }
    if (($chr(61) != %word) && (%per == 1)) { set %per 0 }
    if ((1 == %per) && (1 == %equ)) { 
      //echo -a error 1
      set %per 0
    }
    if ($chr(44) isin $right(%t.word,1)) { set %per 0 }
    inc %i 1
  }
}
 [/color] 

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If you really want to do this kind of script-checker, you really need to learn regex. That's the only way you're really going to have any luck with anything more than basic things, such as the number of parentheses/brackets.

I can't help you with that, though... I've not really learned it. Others here have a good handle on it if you have questions, though.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
I have taken your suggestion about the script and incorperated it into the script. as far as Regex I know nothing about it yet. Sounds like its time to do more research on Regex.

If anyone is interested in this script I am compiling. send me a pm and I will keep you informed as to the progress and updates on this script.

I am also interested on any input as to what kind of errors I could incorperate into the script to search for

So far, I have the script that will scan for errors within script for these problems.


Missing Parentheses () within a script
Missing Evaluation Brackets [] within a script
Too many Left Opening Brace { and spacing errors within the braces
Too many Right Closing Brace } and spacing errors within the braces
Un-necessary use of Double Forward Slashes // witin a script


What I am working on now is errors contained within a var string and a script for checking the opening command line for

on <level>:TRIGGER:<?|@|=|!|*>:<matchtext>:<commands>
on <level>:TRIGGER:<matchtext>:<*><?><#[,#]>:<commands>
on <level>:TRIGGER:<commands>




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Quote:

Un-necessary use of Double Forward Slashes // witin a script



You should just call that "Unnecessary use of slashes / within a script". You don't need any /'s in a script for a command -- single or double. Of course, keep in mind that someone may try to output that or have it somewhere on purpose, so you should only check for them at the beginning of a line or after a pipe |.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard