mIRC Home    About    Download    Register    News    Help

Print Thread
#209740 22/02/09 10:05 AM
Joined: Feb 2009
Posts: 3
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Feb 2009
Posts: 3
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

F15pilotX #209742 22/02/09 11:40 AM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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?

F15pilotX #209752 22/02/09 07:58 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

hixxy #209756 22/02/09 08:48 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
if ($regex($1,/^[-][aq]$/)) and if ($istok(-a -q,$1,32)) are the same difference, really.

Tomao #209773 23/02/09 03:28 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #209777 23/02/09 04:31 AM
Joined: Feb 2009
Posts: 3
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Feb 2009
Posts: 3
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".

Last edited by F15pilotX; 23/02/09 04:32 AM.
F15pilotX #209788 23/02/09 08:33 AM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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.

Last edited by Tomao; 23/02/09 08:37 AM.
Tomao #209929 27/02/09 05:11 AM
Joined: Feb 2009
Posts: 3
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Feb 2009
Posts: 3
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.

Last edited by F15pilotX; 27/02/09 05:11 AM.
F15pilotX #209951 27/02/09 06:21 PM
Joined: Feb 2007
Posts: 75
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2007
Posts: 75
have you tried using $id instead of id?

Also you could rewrite that into a remote script:
Code:
alias id { ns identify <password> }


GigIRC Network Admin
irc.gigirc.com
Trixar_za #209955 27/02/09 10:11 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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

Last edited by Tomao; 27/02/09 10:15 PM.

Link Copied to Clipboard