mIRC Homepage
Posted By: F15pilotX Trigger Help - 22/02/09 10:05 AM
Obviously, an anti-deprotection script; however, it does not trigger; any ideas why?


Code:
on @1:RAWMODE:#:{
  if ( ( ($1 == -a) || ($1 == -q) ) && ($2 == $me) ) {
    id
  }
}



Thanks in advance smile
Posted By: Tomao Re: Trigger Help - 22/02/09 11:40 AM
Code:
on *:RAWMODE:#:{
  if ($regex($1,/^[-][aq]$/)) && ($2 == $me) {
    id
  }
}

What is anti-deprotection? Does it mean if you are -a or -q, you will be +a and +q?
Posted By: hixxy Re: Trigger Help - 22/02/09 07:58 PM
Perhaps the person triggering the script is on a named userlevel? If so, then @1 won't work.

Code:
on @*:RAWMODE:#:{
  if ($istok(-a -q,$1,32)) && ($2 == $me) {
    id
  }
}


Otherwise, just make sure there's no other on rawmode even above that one in the same file.
Posted By: Tomao Re: Trigger Help - 22/02/09 08:48 PM
if ($regex($1,/^[-][aq]$/)) and if ($istok(-a -q,$1,32)) are the same difference, really.
Posted By: jaytea Re: Trigger Help - 23/02/09 03:28 AM
there's a subtle difference, $istok() isn't case sensitive, although i would opt for $istokcs() here if case is an issue.. $regex() is overkill

i realize +a cannot be set on a nick with other arbitrary modes (at least, if i remember right), but here's a code that parses any mode string and signals an event when +a or -a is detected on a nick:

Code:
on *:rawmode:#:{ 
  if (*a*,*,*,* iswmcs $chanmodes) {
    var %a = 1, %b, %c = 2
    while ($mid($1,%a,1)) {
      if ($v1 isin +-) %b = $v1
      if ($v1 === a) .signal a $+ %b # $($ $+ %c,2) $nick
      if ($regex($nickmode $chanmodes,/(?:^|,)(?=.* $v1 )/g) %b isin 3 +1 %b 2 %b) inc %c
      inc %a
    }
  }
}

on *:signal:a?:{
  /*

  in here, $signal = a+ or a- for whether mode a was given or taken
  $1 is the channel
  $2 is the affected nick
  $3 is the nick who did the mode change  
  
  */ 
}


if anything this can serve as an example of how to parse a mode string with minimal code :P

i believe you can use on *:owner:#: and on *:deowner:#: for +q and -q with the expected $nick/$chan/$opnick identifiers. the extent of its support has been discussed in the past but i can't really remember what the deal was. try it out and see
Posted By: F15pilotX Re: Trigger Help - 23/02/09 04:31 AM
Heh, I think I might have gotten a bit over my head with some of the explanations you all are giving; let me explain better now, since last time it was 4:30am.

I'm trying to write a script that, when I am deprotected (i.e. -a or -q), will re-identify. I have an alias named "id" which will do the re-identifying part, so what I need is the code to trigger the call of "id".
Posted By: Tomao Re: Trigger Help - 23/02/09 08:33 AM
Based on hixxy's, this will work:
Code:
on @*:RAWMODE:#:if ($istokcs(-a -q,$1,32)) && ($2 == $me) id

If it won't, you need to show people here what your alias part of code looks like so you can get better answers.
Posted By: F15pilotX Re: Trigger Help - 27/02/09 05:11 AM
Tried it and it doesn't trigger anything.

My id alias: (in aliases.ini)

Code:
/id ns identify <password>


It's used in my perform and i use it regularly, so I know it works.
Posted By: Trixar_za Re: Trigger Help - 27/02/09 06:21 PM
have you tried using $id instead of id?

Also you could rewrite that into a remote script:
Code:
alias id { ns identify <password> }
Posted By: Tomao Re: Trigger Help - 27/02/09 10:11 PM
Orginally I posted the exact same idea you have but deleted it. Because I figured it should have worked either way. I have no idea why that wouldn't trigger for the op. I'm also unsure if there's a conflict between that alias in his mirc perfom and alias.ini
© mIRC Discussion Forums