mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2005
Posts: 18
L
latumus Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Oct 2005
Posts: 18
Code:
ON 1: TEXT:*:# {
  if ($nick isin %watch) {
    set %checknick $nick
    set %checkmsg $1-

    ;[Test1]
    if (check1 isin %checkmsg) && (check2 isin %checkmsg) {
      if ($read(c:\check.txt,w,$3) == $null) {
        if (check3 isin %checkmsg) && (check4 isin %checkmsg) {
          if (fail1 isin %checkmsg) || (fail2 isin %checkmsg) || (fail3 isin %checkmsg) || (fail4 isin %checkmsg) || (fail5 isin %checkmsg) { halt }
          elseif (-Variable1 isin %checkmsg) { $read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action 1 is working }
            if ($read(c:\check2.txt,w,$checker($cutoff($3))) isin %checkmsg) { //echo -a action 2 is working }
            else { //echo -a action 3 is working }
          }
        }
      }
    }

    unset %checknick
    unset %checkmsg
  }
  else {
    halt
  }
}


anyone have any idea why this doesnt work?
$checker, $fixstr, $cutoff are regex variables which work fine when testing with //echo -a

any advice would be very welcome

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
This line is screwed up
elseif (-Variable1 isin %checkmsg) { $read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action 1 is working }
in correcting it, i also had to remove a closing }, so im listing you the whole thing here.

Code:
ON 1: TEXT:*:# {
  if ($nick isin %watch) {
    set %checknick $nick
    set %checkmsg $1-

    ;[Test1]
    if (check1 isin %checkmsg) && (check2 isin %checkmsg) {
      if ($read(c:\check.txt,w,$3) == $null) {
        if (check3 isin %checkmsg) && (check4 isin %checkmsg) {
          if (fail1 isin %checkmsg) || (fail2 isin %checkmsg) || (fail3 isin %checkmsg) || (fail4 isin %checkmsg) || (fail5 isin %checkmsg) { halt }
          elseif (-Variable1 isin %checkmsg) && ($read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action 1 is working }
          if ($read(c:\check2.txt,w,$checker($cutoff($3))) isin %checkmsg) { //echo -a action 2 is working }
          else { //echo -a action 3 is working }
        }
      }
    }
    unset %checknick
    unset %checkmsg
  }
  else {
    halt
  }
}


I made no other changes to your code. However I dont think the code is overly optimal, below is what i think would be a better code.
* also since you dont supply us any data, you could be getting fails due to not stripping color codes from the $1-, i have inclused this also.

Code:
ON 1:TEXT:*:#: {
  if ($nick isin %watch) {
    ;
    ;^ I would have changed this to "IF ($ISTOK(%WATCH,$NICK,32)) {" but i dont know if the list of nicks uses space (32) as the seperator
    ;
    ;
    var %checknick $nick
    var %checkmsg $strip($1-)
    ;
    ;^ Use VAR since it appears you dont use the variables globally, Also i used $STRIP($1-) to remove color codes etc, i dont know if this is wanted, change to $1- if not.
    ;
    ;
    if (fail1 isin %checkmsg) || (fail2 isin %checkmsg) || (fail3 isin %checkmsg) || (fail4 isin %checkmsg) || (fail5 isin %checkmsg) { halt }
    ;
    ;^ Since you always stop on any of the failN values just do them first, saves on other pointless checking
    ;
    ;
    if (check1 isin %checkmsg) && (check2 isin %checkmsg) && (check3 isin %checkmsg) && (check4 isin %checkmsg) {
      ;
      ;^ Do all non file wildcard checks you possably can first, to reduce cpu load when doing $read's
      ;
      ;
      if ($read(c:\check.txt,w,$3) == $null) {
        ;
        ;^ This could have been included in the IF above but for clarity i placed it on its own line
        ;
        ;
        if (-Variable1 isin %checkmsg) && ($read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action 1 is working }
        ;
        ;^ *** This is the line I corrected ***
        ;
        ;
        if ($read(c:\check2.txt,w,$checker($cutoff($3))) isin %checkmsg)                                         { //echo -a action 2 is working }
        else                                                                                                     { //echo -a action 3 is working }
        ;
        ;^ as per keeping with your design, weather action1 is performed or not, action 2 or 3 is selected to be performed
        ;
        ;
      }
    }
  }
}


The UNSET's and ending HALT were unneeded so were removed.

Joined: Oct 2005
Posts: 18
L
latumus Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Oct 2005
Posts: 18
thanks alot man the stripping i do in my own client i have mirc stripping all bold/color/etc

i really appreciate your pointers!

/latumus

Joined: Oct 2005
Posts: 18
L
latumus Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Oct 2005
Posts: 18
;^ as per keeping with your design, weather action1 is performed or not, action 2 or 3 is selected to be performed

;

if action 1 is performed it should halt after that action
so its one of 3 not more than 1

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
ON 1:TEXT:*:#: {
  if ($nick isin %watch) {
    ;
    ;^ I would have changed this to "IF ($ISTOK(%WATCH,$NICK,32)) {" but i dont know if the list of nicks uses space (32) as the seperator
    ;
    ;
    var %checknick $nick
    var %checkmsg $strip($1-)
    ;
    ;^ Use VAR since it appears you dont use the variables globally
    ;^ I would leave stripping in, incase one day you turn OFF the auto stripping and wonder why the scripts all fail, i know I did when i turned mine off.
    ;
    ;
    if (fail1 isin %checkmsg) || (fail2 isin %checkmsg) || (fail3 isin %checkmsg) || (fail4 isin %checkmsg) || (fail5 isin %checkmsg) { halt }
    ;
    ;^ Since you always stop on any of the failN values just do them first, saves on other pointless checking
    ;
    ;
    if (check1 isin %checkmsg) && (check2 isin %checkmsg) && (check3 isin %checkmsg) && (check4 isin %checkmsg) {
      ;
      ;^ Do all non file wildcard checks you possably can first, to reduce cpu load when doing $read's
      ;
      ;
      if ($read(c:\check.txt,w,$3) == $null) {
        ;
        ;^ This could have been included in the IF above but for clarity i placed it on its own line
        ;
        ;
        if (-Variable1 isin %checkmsg) && ($read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action 1 is working }
        elseif ($read(c:\check2.txt,w,$checker($cutoff($3))) isin %checkmsg)                                     { //echo -a action 2 is working }
        else                                                                                                     { //echo -a action 3 is working }
        ;
        ;^ now does action1 or 2 or 3
        ;
        ;
      }
    }
  }
}


Whats the format of your %watch var, since ISIN well match part names up , like its ment to watch for FREDRICK ir well ISIN match FRED and RICK and EDRICK etc
to correct i need to know what the %watch uses to seperate nicks, is it spaces (FRED BILL TED) or commas (FRED,BILL,TED) or what ?

Joined: Oct 2005
Posts: 18
L
latumus Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Oct 2005
Posts: 18
ok gonna play with it
i bet it works since it looks smooth =)

/latumus

Joined: Oct 2005
Posts: 18
L
latumus Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Oct 2005
Posts: 18
action 1 doesnt seem to work
with the variable1 in the message
and it reading from the txt it performs action 3 instead of 1

Last edited by latumus; 20/10/05 10:19 PM.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Your using -Variable1 in the example script, im not clear on if this is a string litterla of the word "-Variable1" or ment to be a %Variable1, all i can really say is add some check points into the script, to see what values your making and where it might be going wrong.

ex, take the code below...
Code:
        if (-Variable1 isin %checkmsg) && ($read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action 1 is working }
        elseif ($read(c:\check2.txt,w,$checker($cutoff($3))) isin %checkmsg)                                     { //echo -a action 2 is working }
        else                                                                                                     { //echo -a action 3 is working }


and replace it with this code

Code:
        ;
        ; check point values
        ;
        echo -a % $+ variable1 = %variable1
        echo -a % $+ checkmsg = %checkmsg
        echo -a $!3 = $3
        echo -a $!cutoff($3) = $cutoff($3)
        echo -a $!fixstr($cutoff($3)))) = $fixstr($cutoff($3))
        echo -a $!checker($fixstr($cutoff($3))) = $checker($fixstr($cutoff($3)))
        echo -a $!read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) = $read(c:\check2.txt,w,$checker($fixstr($cutoff($3))))
        if (-Variable1 isin %checkmsg)                                            { //echo -a action1's 1st condition $true ( $v1 isin $v2 ) } | else { //echo -a action1's 1st condition $false ( $v1 isin $v2 ) }
        if ($read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action1's 2nd condition $true ( $v1 isin $v2 ) } | else { //echo -a action1's 2nd condition $false ( $v1 isin $v2 ) }
        ;
        ; original code
        ;
        if (-Variable1 isin %checkmsg) && ($read(c:\check2.txt,w,$checker($fixstr($cutoff($3)))) isin %checkmsg) { //echo -a action 1 is working }
        elseif ($read(c:\check2.txt,w,$checker($cutoff($3))) isin %checkmsg)                                     { //echo -a action 2 is working }
        else                                                                                                     { //echo -a action 3 is working }


Essentially list all used values, and how they were used if need be, and even make duplicate IF's with them to see what the outcome of the comparison was.

Joined: Oct 2005
Posts: 18
L
latumus Offline OP
Pikka bird
OP Offline
Pikka bird
L
Joined: Oct 2005
Posts: 18
variable 1 is just a word

lets say -blah
or something

but im gonna test the stuff you recommended now smile
lets hope i can figure it out

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
ok well then you can remove the line below i guess lol

echo -a % $+ variable1 = %variable1


Link Copied to Clipboard