mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I have a script to list the users in my mIRC's built in ignore list. Currently, there are no entries, which is what I am told when I do a /ignore -l. However, when I try //echo -a $ignore(0), mIRC tells me that there are several entires on the ignore list, and will tell me what those ignored addresses are with $ignore(1) $ignore(2) $ignore(3) etc. That's a problem for this script:

Code:
on syscon:text:!list_ignored:#:{
  if (0 == $ignore(0)) { msg $chan No entries in the ignore list. }
  if (1 <= $ignore(0)) { /write -c C:\IcyBot2\Scripts\ignore_list.txt $ignore(1) }
  if (2 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(2) }
  if (3 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(3) }
  if (4 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(4) }
  if (5 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(5) }
  if (6 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(6) }
  if (7 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(7) }
  if (8 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(8) }
  if (9 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(9) }
  if (10 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(10) }
  if (11 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(11) }
  if (12 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(12) }
  if (13 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(13) }
  if (14 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(14) }
  if (15 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(15) }
  if (16 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(16) }
  if (17 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(17) }
  if (18 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(18) }
  if (19 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(19) }
  if (20 <= $ignore(0)) { /write C:\IcyBot2\Scripts\ignore_list.txt $ignore(20) }
  play $chan C:\IcyBot2\Scripts\ignore_list.txt 1750
}


What gives?

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Problem solved, thanks Wims! See above post for problem!

Last edited by Mpot; 16/03/08 07:01 PM.
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
Why don't you use /timer ?
If you really want to use /play, you can use an alias (-a switch) that $eval(,2) the text, but here timer is imo the best way to do what you want


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Timers have always given me a headache.

I figured it out. Thanks!

Last edited by Mpot; 16/03/08 07:00 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You really need to work on how you use your IFs. Your code is very inefficient with so many IFs like that. Just use a WHILE loop from 1 to $ignore(0). No IFs needed at all.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
I don't know anything about while loops. Futhermore, that still doesn't solve the problem.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's the code that I saw in your original post, but re-written to use a while loop
Code:
on syscon:text:!list_ignored:#:{
  if !$ignore(0) {    msg $chan No entries in the ignore list.  }
  else {
    var %a = 1, %b = $ignore(0)
    while %a <= %b {
      .write -c c:\IcyBot2\Scripts\ignore_list.txt $ignore(%a)
      inc %a
    }
    play $chan C:\IcyBot2\Scripts\ignore_list.txt 1750
  }
}


I don't know why you write to the text file each time, when the only one that'll end up showing is the one that matches the value of $ignore(0). With this being the case, I'd like to suggest you consider this
Code:
on syscon:text:!list_ignored:#:{
  if !$ignore(0) {    msg $chan No entries in the ignore list.  }
  else {
    .write -c c:\IcyBot2\Scripts\ignore_list.txt $ignore(0)
    play $chan C:\IcyBot2\Scripts\ignore_list.txt 1750
  }
}

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Not so. $ignore(0) gives how many people are on the ignore list. $ignore(1) gives the first entry on the ignore list, $ignore 2, the second, and so on. I write each entry to the list for channel playback. And, sure, a while loop is certainly lovely, but that still doesn't solve the problem! I'm not concerned with efficency!

Last edited by Mpot; 17/03/08 10:14 PM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
OK, as I understand it, from re-reading the posts, you want to display in the channel a list of all of the addresses on your ignore list. If this is the case I suggest you try
Code:
on syscon:text:!list_ignored:#:{
  if !$ignore(0) {    msg $chan No entries in the ignore list.  }
  else {
    var %a = 1
    while %a <= $ignore(0) {
      .write c:\IcyBot2\Scripts\ignore_list.txt $ignore(%a)
      inc %a
    }
    .play $chan c:\IcyBot2\Scripts\ignore_list.txt 1750
    .remove c:\IcyBot2\Scripts\ignore_list.txt
  }
}


Last edited by RusselB; 18/03/08 12:17 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Change $ignored to $ignore smile


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks.. going to blame that mistake on the keyboard, due to the closeness of the e & d keys.

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Code:
[21:31:26] <Mpot> !list_ignored
[21:31:28] <IcyBot> *!*IceChat7@adsl-70-137-29-13.dsl.okcyok.swbell.net
[21:31:29] <IcyBot> *!*IceChat7@adsl-70-137-12-227.dsl.okcyok.swbell.net
[21:31:31] <IcyBot> *!*@70.17.68.147
[21:31:33] <IcyBot> *!*@64.136.76.84
[21:31:35] <IcyBot> *!*@pool-70-17-112-72.res.east.verizon.net
/ignore -l
* Ignore list empty


Same problem.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
What (if any) switches are you using with the /ignore command?

Everything seems to work correctly in my testing, with the exception of the one entry that is marked as an exception (used /ignore -x)

Joined: Apr 2007
Posts: 228
M
Mpot Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Code:
on syscon:text:!ignore*:#:{
  if ($2 == $null) { msg $chan Specify a nickname. }
  elseif ($$2 !ison $chan) { msg $chan $$2 is not on $chan $+ ! }
  elseif ($ignore($address($$2,2)) == $address($$2,2)) { msg $chan $$2 is already ignored! }
  elseif ($$2 == $me) { 
    if ($me isop $chan) { kick $chan $nick You think that's funny, bitch? }
    else { msg $chan Ha ha, we have a funny guy. >_> }
  }
  elseif ($$2 == $nick) { msg $chan You cannot ignore yourself! }
  elseif (syscon isin $level($address($$2,2))) { msg $chan You can not ignore a bot operator! } 
  else { /ignore $$2 2 | msg $chan $$2 has been ignored at $address($$2,2) | /write C:\IcyBot2\Scripts\op_log.txt On $date(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) at $time(h:nn:ss TT) $nick used $$1 $$2 ( $+ $address($$2,2) $+ ) on $chan }
}

Last edited by Mpot; 18/03/08 06:57 PM.

Link Copied to Clipboard