mIRC Home    About    Download    Register    News    Help

Topic Options
#157600 - 26/08/06 05:11 PM script help
Garou Offline
Fjord artisan

Registered: 19/08/06
Posts: 469
Why does it turn off or disable when I add a new nick to be notify?

menu nicklist {
-
Notify BanList Settings
.Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write $scriptdir $+ NB.txt %bnn 2 | unset %bnn
.Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] $scriptdir $+ NB.txt | unset %bnn
.View Ban NickList:/run $scriptdir $+ NB.txt
}

Top
#157601 - 26/08/06 05:28 PM Re: script help
Kurdish_Assass1n Offline
Fjord artisan

Registered: 11/04/06
Posts: 400
Loc: Nashville, Tennessee
Code:
menu nicklist {
-
Notify BanList Settings
.Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write [color:red]$scriptdir $+[/color] NB.txt %bnn 2 | unset %bnn
.Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] [color:red]$scriptdir $+[/color] NB.txt | unset %bnn
.View Ban NickList:/run [color:red]$scriptdir $+[/color] NB.txt
}

the red parts do not need to be there, it already writes to the directory, so, it'll write in the folder, without it, it seems to work.
try this:
Code:
menu nicklist {
  -
  Notify BanList Settings
  .Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write NB.txt %bnn 2 | unset %bnn
  .Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] NB.txt | unset %bnn
  .View Ban NickList:/run NB.txt
} 


Edited by Kurdish_Assass1n (26/08/06 05:31 PM)
_________________________
-Kurdish_Assass1n

Top
#157602 - 26/08/06 05:34 PM Re: script help
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 969
what "it" are you talking about?
Unrelated: you can avoid the need to unset %bnn by using var instead of set to create it.

You aren't trying to add a nick named 'off' to your notify list are you?

write $scriptdir $+ NB.txt %bnn 2
... will only add the correct mask if the nick is present, so perhaps you will want to instead have it use $$1 instead of entering the nick?

You'll need quotes if your $scriptdir contains a space in it.

Top
#157603 - 26/08/06 05:43 PM Re: script help
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 969
Quote:
the red parts do not need to be there, it already writes to the directory, so, it'll write in the folder, without it, it seems to work.


Kurdish, $scriptdir refers to the folder where the script being run is located - and is not always the same as $mircdir - but it is true that if he wants the .txt to be written into $mircdir that he should skip the references to the complete path when writing to the file.

Top
#157604 - 26/08/06 05:44 PM Re: script help
Garou Offline
Fjord artisan

Registered: 19/08/06
Posts: 469
I only add the correct nick and it still turns off after i add a new nick. Here is all my code.

menu nicklist {
-
Notify BanList Settings
.Add Nick:set %bnn $$?="Nick To Add" | notify %bnn | write NB.txt %bnn 2 | unset %bnn
.Remove Nick:set %bnn $$?="Nick To Remove" | notify -r %bnn | write -ds [ $+ [ %bnn ] ] NB.txt | unset %bnn
.View Ban NickList:/run NB.txt
}

on @*:notify: {
if ( %bnn == off ) || ( %bnn == $null ) || ($nick isop #) { return }
if ( $read -s $+ $nick NB.txt == 2) {
if (($chan(1) != $null) && ($me isop $chan(1))) //ban $chan(1) $$1
if (($chan(2) != $null) && ($me isop $chan(2))) //ban $chan(2) $$1
if (($chan(3) != $null) && ($me isop $chan(3))) //ban $chan(3) $$1
if (($chan(4) != $null) && ($me isop $chan(4))) //ban $chan(4) $$1
if (($chan(5) != $null) && ($me isop $chan(5))) //ban $chan(5) $$1
if (($chan(6) != $null) && ($me isop $chan(6))) //ban $chan(6) $$1
if (($chan(7) != $null) && ($me isop $chan(7))) //ban $chan(7) $$1
if (($chan(8) != $null) && ($me isop $chan(8))) //ban $chan(8) $$1
if (($chan(9) != $null) && ($me isop $chan(9))) //ban $chan(9) $$1
if (($chan(10) != $null) && ($me isop $chan(10))) //ban $chan(10) $$1
if (($chan(11) != $null) && ($me isop $chan(11))) //ban $chan(11) $$1
if (($chan(12) != $null) && ($me isop $chan(12))) //ban $chan(12) $$1
}
}


Edited by Garou (26/08/06 05:47 PM)

Top
#157605 - 26/08/06 06:16 PM Re: script help
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 969
Quote:

on @*:notify: {
if ( %bnn == off ) || ( %bnn == $null ) || ($nick isop #) { return }
[snip]
}


The # symbol is undefined inside this event. Either pass it as a variable, or else assume you're wanting to do it with $active

Top
#157606 - 26/08/06 06:20 PM Re: script help
Garou Offline
Fjord artisan

Registered: 19/08/06
Posts: 469
Same problem when I add or remove a nick it still turn off.

Top
#157607 - 26/08/06 06:26 PM Re: script help
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Here's a little re-write of your code, and a quick test shows it to be working as expected.
Code:
 menu nicklist {
  -
  Notify BanList Settings
  .Add Nick: banlist add $$?="Nick To Add"
  .Remove Nick: banlist del $$?="Nick To Remove"
  .View Ban NickList:/run NB.txt
}
alias banlist {
  notify $iif($1 == del,-r) $2
  write $iif($1 == del,-ds $+ $2) nb.txt $2
}
on *:notify: {
  if ($read(NB.txt,s,$nick) == 2) {
    var %a = 1, %b = $chan(0)
    while %a <= %b {
      if ($me isop $chan(%a)) ban $chan(%a) $nick
      inc %a
    }
  }
}
 

Top
#157608 - 26/08/06 06:43 PM Re: script help
Garou Offline
Fjord artisan

Registered: 19/08/06
Posts: 469
RusselB Its the adding and removing fine but it doesnt set ban!!


Edited by Garou (26/08/06 06:57 PM)

Top
#157609 - 27/08/06 12:46 AM Re: script help
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Found the problem, corrected, and then added a few little options, giving
Code:
on *:start:{
  if !$hget(NB) { .hmake NB 100 }
  if $exists(NB.txt) { .hload NB NB.txt }
}
on *:exit:{
  .hsave -o NB NB.txt
}
on *:disconnect:{
  .hsave -o NB NB.txt
}
menu nicklist {
  -
  Notify BanList Settings
  .Add Nick: banlist add $iif(!$snicks,$$?="Nick(s) To Add",$snicks)
  .Remove Nick: banlist del $iif(!$snicks,$$?="Nick To Remove",$snicks)
  .View Ban NickList:.hsave -o NB NB.txt | run NB.txt
}
alias banlist {
  var %nicks = $remove($replace($2-,$chr(32),$chr(44)),$me)
  while %nicks {
    notify $iif($1 == del,-r) $gettok(%nicks,1,44)
    .hadd -m NB $gettok(%nicks,1,44) $iif($1 == add,Banned)
    %nicks = $remtok(%nicks,$gettok(%nicks,1,44),1,44)
  }
}
on *:notify: {
  if $hget(NB,$nick) {
    var %a = 1, %b = $chan(0)
    while %a <= %b {
      if ($me isop $chan(%a)) {
        ban $iif($nick ison $chan(%a),-k) $chan(%a) $nick
      }
      inc %a
    }
  }
}
 


I realize there's a lot more code than originally, but I think you'll like the additions. Please review the code before using it so that you understand what I added, and why.

Top
#157610 - 27/08/06 01:21 AM Re: script help
Garou Offline
Fjord artisan

Registered: 19/08/06
Posts: 469
Wow its pretty cool thx :P
Can you please remove the kick msg?
Just set ban no kick thx.


Edited by Garou (27/08/06 01:59 AM)

Top
#157611 - 27/08/06 02:31 AM Re: script help
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Remove $iif($nick ison $chan(%a),-k) from the ban line

Top
#157612 - 27/08/06 02:48 AM Re: script help
Garou Offline
Fjord artisan

Registered: 19/08/06
Posts: 469
Great stuff :P
One last thing can you add another line to clear banlist ?
To clear all in NB.txt ?


Edited by Garou (27/08/06 02:51 AM)

Top
#157613 - 27/08/06 03:12 AM Re: script help
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
Add this to the nicklist menu
Code:
 .Clear Ban NickList: .hfree NB | $iif($exists(NB.txt),remove NB.txt) 

Top
#157614 - 27/08/06 03:21 AM Re: script help
Garou Offline
Fjord artisan

Registered: 19/08/06
Posts: 469
Great stuff thx.

Top