mIRC Home    About    Download    Register    News    Help

Print Thread
#152445 01/07/06 12:33 AM
Joined: Jun 2004
Posts: 25
Q
Quia Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Jun 2004
Posts: 25
Is there an easier way of doing this? Right now, it seems incredibly redundant, and is a pain in the ass to update(there is a practically identical on ACTION part of this script, which makes four places I have to change every time I want to add one execption.

Code:
 
on ^*:TEXT:*:*: { 
  if ($chan) {
    if (Qui isin $1-) { if (quis isin $1-) || (quie isin $1-) || (quic isin $1-) || (quir isin $1-) || (quit isin $1-) || (squi isin $1-) || (quid isin $1-) || (quiz isin $1-) || (quiz isin $1-) || (equi isin $1-) ||  (quin isin $1-) || (quil isin $1-) || (xqui isin $1-) || (nqui isin $1-) || (quiv isin $1-) || (quip isin $1-) || ($chan == #IdleRPG) || (quike isin $1-) { echo -mt # < $+ $nick $+ > $$1- | halt }
      else echo 0 -mt # < $+ $nick $+ > $$1- { if (%hstatus == on) { splay quia.wav | halt }
        else halt 
      }
    }
    elseif (Bri isin $1-) { if (brim isin $1-) || (brie isin $1-) || (brin isin $1-) || (brit isin $1-) || (brig isin $1-) || (bric isin $1-) || (brid isin $1-) || (brib isin $1-) || (abri isin $1-) || (bril isin $1-) || (bris isin $1-) || (brio isin $1-) || ($chan == #IdleRPG) || (bria isin $1-) && (briana !isin $1-) { echo -mt # < $+ $nick $+ > $$1- | halt }
      else echo 0 -mt # < $+ $nick $+ > $$1- { if (%hstatus == on) { splay bri.wav | halt }
        else halt 
      }
    }
    else echo -mt # < $+ $nick $+ > $$1- | halt
  }
  else { 
    if (Qui isin $1-) { if (quis isin $1-) || (quie isin $1-) || (quic isin $1-) || (quir isin $1-) || (quit isin $1-) || (squi isin $1-) || (quid isin $1-) || (quiz isin $1-) || (quiz isin $1-) || (equi isin $1-) ||  (quin isin $1-) || (quil isin $1-) || (xqui isin $1-) || (nqui isin $1-) || (quiv isin $1-) || (quip isin $1-) || ($chan == #IdleRPG) || (quike isin $1-) { echo -mt $nick < $+ $nick $+ > $$1- | halt }
      else echo 0 -mt $nick < $+ $nick $+ > $$1- { if (%hstatus == on)  { splay quia.wav | halt }
        else halt

      }
    }
    elseif (Bri isin $1-) { if (brim isin $1-) || (brie isin $1-) || (brin isin $1-) || (brit isin $1-) || (brig isin $1-) || (bric isin $1-) || (brid isin $1-) || (brib isin $1-) || (abri isin $1-) || (bril isin $1-) || (bris isin $1-) || (brio isin $1-) || ($chan == #IdleRPG) || (bria isin $1-) && (briana !isin $1-) { echo -mt $nick < $+ $nick $+ > $$1- | halt }
      else echo 0 -mt $nick < $+ $nick $+ > $$1- { if (%hstatus == on) { splay bri.wav | halt }
        else halt
      } 
    }
    else echo -mt $nick < $+ $nick $+ > $$1- | halt
  }
}
 

#152446 01/07/06 09:46 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
For one, use $target. That will remove the need for the first condition. From there, not sure what your methodology of the search terms are, but try using regular expressions. I'm willing to help, but first clear this section up for me:

Code:
    [color:Red]if[/color] (Qui isin $1-) { if (quis isin $1-) || (quie isin $1-) || (quic isin $1-) || (quir isin $1-) || (quit isin $1-) || (squi isin $1-) || (quid isin $1-) || (quiz isin $1-) || (quiz isin $1-) || (equi isin $1-) ||  (quin isin $1-) || (quil isin $1-) || (xqui isin $1-) || (nqui isin $1-) || (quiv isin $1-) || (quip isin $1-) || ($chan == #IdleRPG) || (quike isin $1-) { echo -mt # < $+ $nick $+ > $$1- | halt }
      [color:red]else[/color] echo 0 -mt # < $+ $nick $+ > $$1- { if (%hstatus == on) { splay quia.wav | halt }
        [color:red]else[/color] halt 
      }
    }


You have an else under the if (qui) but then use elseif for the bri matches. Which is it?


-KingTomato
#152447 01/07/06 10:03 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Here';s what I cam up with making assumptions. If I'm totally off, let me know. I hope I did it correctly or, if not, atleast gave you the right direction so you can solve it.

Code:
;
; Tried to clean this up a bit, and explain what I've done. I've commented and attempted
; color coding to make it more legible. For the first change, you have ifs comparing the
; channel name. This can be resolved by adding it to the event call. The ,? means include
; queries. Seperate more channels or destinations with commas (,).
;
on ^*:TEXT:*:[color:blue]#IdleRPG,?[/color]: { 
  ;
  ; First, we use $target instead of checking for a nick or channel. Next, use regular
  ; expressions to match the words. Add each word to the below regular expressions in
  ; the parenthesis, but divided by a pipe (|) as I have done. Feel free to add more
  ; %term_N's, but make sure to add another If statement for them!
  ; 
  var %term_1 = /([color:blue]quis|quie|quic|quir|quit|squi|quid|quiz|quiz|equi|quin|quil|xqui|nqui|quiv|quip|quike[/color])/i
  var %term_2 = /([color:blue]brim|brie|brin|brit|brig|bric|brid|brib|abri|bril|bris|brio|bria|briana[/color])/i
  ;
  ; Match the qui one first
  ;
  if ($regex($1-,%term_1)) {
    ;
    ; Here, i got a little confused. You have an IF in an echo line. I assumed
    ; it fell under the echo, as another condition? What i assumed was the echo
    ; with '0' (white) color was the highlight, so I used it below. The echo
    ; (that i assumed was default) has no color, and is in the last else statement.
    ; Again, we use $target to remove the first if statement you included.
    ;
    echo [color:blue]0[/color] -mt [color:blue]$target[/color] < $+ $nick $+ > $$1-
    ;
    ; I'm not sure what the other else is for. If it's important, feel free to add it.
    ; I'm just going to ignore it for now, and move on to your sounds.
    ;
    if (%hstatus == on) { /splay quia.wav }
  }
  ;
  ; Next match bri
  ;
  else if ($regex($1-,%term_2)) {
    ;
    ; Again, just a different set of words. Almost all the same code.
    ;
    echo [color:blue]0[/color] -mt [color:blue]$target[/color] < $+ $nick $+ > $$1-
    ;
    ; Sound again
    ;
    if (%hstatus == on) { /splay bri.wav }
  }
  ;
  ; default output for anything else
  else {
    echo -mt # < $+ $nick $+ > $$1-
  }
  ;
  ; Put haltdef down here. It's goiung to be called regardles, just call it once.
  ; With properly nested if statements also, the halt's are unnecessary.
  ;
  haltdef
}


-KingTomato

Link Copied to Clipboard