mIRC Homepage
Posted By: nataliad to msg all but protected people - 29/06/08 11:44 PM
hello

I have this script, which is supposed not to msn the people that match the protect list, but it does

any idea?

thanks

Code:
alias mm {
  var %a = $nvnick($chan,0)
  while (%a) {
    if (($fulladdress !isignore) && ($fulladdress !isprotect)) {
      .timer 1 $calc(%a * 9) .msg $nvnick($chan,%a) $1-
    }
    dec %a
  }
}
Posted By: RusselB Re: to msg all but protected people - 30/06/08 02:40 AM
1) Please ensure that you do have the addresses in the protect list set to match the same format as $fulladdress (ie:nick!user@host)

Aside from that, I see nothing wrong with your code.
Posted By: Lpfix5 Re: to msg all but protected people - 30/06/08 07:30 AM
RusselB Have you considered maybe the custom Identifier nvnick Could be an issue?

It is after all called upon in a while loop through a variable change.
Posted By: RusselB Re: to msg all but protected people - 30/06/08 08:08 AM
I did consider that, but the identifier seemed familiar to me, and while I couldn't find it in the current help file, testing the code did not generate an error for that identifier, and I don't have any aliases called nvnick, so I'm suspecting that it's either an old identifier, or an undocumented one.
Posted By: Lpfix5 Re: to msg all but protected people - 30/06/08 03:30 PM
Ya your right seems like it used to be an old identifier because I did google it and it came up many times, however in my current mirc its not included.
Posted By: nataliad Re: to msg all but protected people - 01/07/08 06:09 AM
Originally Posted By: RusselB
1) Please ensure that you do have the addresses in the protect list set to match the same format as $fulladdress (ie:nick!user@host)

Aside from that, I see nothing wrong with your code.


can you tell me please how to check this?
the addresses in my protect list are like: some*!*@*
Posted By: nataliad Re: to msg all but protected people - 04/07/08 01:59 AM
anyone please ?
Posted By: Miguel_A Re: to msg all but protected people - 04/07/08 09:18 AM
make for example
//echo -a $protect(1)
and
//echo -s $ignore(1)

check if the result is nick!user@host...

if the result is nick!*@* it´s wrong because $fulladress will return nick!nick@12.455.34.23.com.

Hope this help good luck
Posted By: nataliad Re: to msg all but protected people - 07/07/08 10:05 AM
thanks
it does reply the correct answer
Posted By: nataliad Re: to msg all but protected people - 07/08/08 05:18 PM
can anyone help me with this please ? any solution ?

thanks
Posted By: Wims Re: to msg all but protected people - 07/08/08 05:50 PM
Are you using mirc 6.33 to test this ? Because there is a known bug with condition like your...


Edit : $nvnick, $nhnick and $nopnick can be used to return non-voice/halfop/op users
Posted By: nataliad Re: to msg all but protected people - 10/08/08 11:51 PM
nope I use 6.21

is there anything I can do?
Posted By: Wims Re: to msg all but protected people - 11/08/08 12:23 AM
In fact the code is wrong, $fulladdress is only avalaible inside an event, logically, $fulladdress is $null here, you need to check the address of $nvnick($chan,%a) with $address($nvnick,$chan,%a),5) to respect the format :

Code:
alias mm {
  var %a = $nvnick($chan,0)
  while (%a) {
  var %addr $address($nvnick($chan,%a),5)
  if (%addr !isignore) && (%addr !isprotect) .timer 1 $calc(%a * 9) .msg $!nvnick($chan,%a) $1-
    dec %a
  }
}
This should work, but the $address value could be $null too
Posted By: nataliad Re: to msg all but protected people - 13/08/08 12:42 AM
it doesn;t work:

* Invalid format: $address (line 585, script.ini)
Posted By: RusselB Re: to msg all but protected people - 13/08/08 01:15 AM
flukey thing with $address (and a few other identifiers that use commas)
Try using this re-write
Code:
alias mm {
  var %a = $nvnick($chan,0)
  while (%a) {
  var %addr = $nvnick($chan,%a)
  %addr = $address(%addr,5)
  if (%addr !isignore) && (%addr !isprotect) .timer 1 $calc(%a * 9) .msg $!nvnick($chan,%a) $1-
    dec %a
  }
}

I'm going to presume that this alias is called from within a channel, otherwise $chan will return $null
Posted By: nataliad Re: to msg all but protected people - 13/08/08 11:53 PM
this is wrong too

I get

welcome No such nick/channel
Posted By: RusselB Re: to msg all but protected people - 14/08/08 09:48 AM
Code:
alias mm {
  var %a = 1, %b = $nick($chan,0)
  while %a <= %b {
    var %addr = $nick($chan,%a)
    %addr = $address(%addr,5)
    if (%addr !isignore) && (%addr !isprotect) {
      .timer 1 %a msg $!nick($chan,%a) $1-
    }
    dec %a
  }
}


Try this.. I have removed the usage of $nvnick as it's no longer supported via the help file, also, due to the noted/corrected bug regarding the usage of parentheses with the if statement, you may wish to ensure that you are running the latest version of mIRC.
Posted By: Wims Re: to msg all but protected people - 14/08/08 07:25 PM
It is not something with $address, it is just a mistake I've made.
Since mIRC 6.21, mirc does not care about the equal sign, and i'm used to not use it, a lot of people would said "a bad habit"...
Posted By: nataliad Re: to msg all but protected people - 14/08/08 09:34 PM
Originally Posted By: RusselB
Code:
alias mm {
  var %a = 1, %b = $nick($chan,0)
  while %a <= %b {
    var %addr = $nick($chan,%a)
    %addr = $address(%addr,5)
    if (%addr !isignore) && (%addr !isprotect) {
      .timer 1 %a msg $!nick($chan,%a) $1-
    }
    dec %a
  }
}


Try this.. I have removed the usage of $nvnick as it's no longer supported via the help file, also, due to the noted/corrected bug regarding the usage of parentheses with the if statement, you may wish to ensure that you are running the latest version of mIRC.


this crashes my mirc, I cannot update to latest mirc, because I will lose data

isn't there something for my version 6.21?
Posted By: MTec007 Re: to msg all but protected people - 14/08/08 10:22 PM
What data do you think you will lose? I ask because the mIRC installer is supposed to save your entire current configuration. In fact you can make a backup copy of your mIRC directory if you want.
Posted By: Wims Re: to msg all but protected people - 14/08/08 11:19 PM
Code:
alias mm {
  var %a = $nvnick($chan,0)
  while (%a) {
  var %addr = $address($nvnick($chan,%a),5)
  if (%addr !isignore) && (%addr !isprotect) .timer 1 $calc(%a * 9) .msg $nvnick($chan,%a) $1-
    dec %a
  }
}
Try with this.
Posted By: RusselB Re: to msg all but protected people - 15/08/08 12:05 AM
I can't see any reason why this would crash your 6.21 as all of the commands, variable assignments and comparisons are valid for 6.21 (as far as I am able to determine).
Posted By: Wims Re: to msg all but protected people - 15/08/08 12:09 AM
You've modified my code, i was using while (%a) and /dec %a, you were using while (%a <= %b) and /dec %a, a infinite loop.
Posted By: RusselB Re: to msg all but protected people - 15/08/08 12:39 AM
Ooops blush Thought I'd changed that to inc
Posted By: nataliad Re: to msg all but protected people - 16/08/08 01:01 AM
Originally Posted By: Wims
Code:
alias mm {
  var %a = $nvnick($chan,0)
  while (%a) {
  var %addr = $address($nvnick($chan,%a),5)
  if (%addr !isignore) && (%addr !isprotect) .timer 1 $calc(%a * 9) .msg $nvnick($chan,%a) $1-
    dec %a
  }
}
Try with this.


again, it msgs people that I have protected...
Posted By: RusselB Re: to msg all but protected people - 16/08/08 02:14 AM
Try replacing
Code:
var %addr = $address($nvnick($chan,%a),5)
with
Code:
var %addr = $+($nick,*!*@*.*)
I just back checked the previous posts and realized that the format you're reporting for the addresses in the protect list don't match the format returned by $address(<nick>,5)
Posted By: Wims Re: to msg all but protected people - 16/08/08 11:02 AM
Quote:
I just back checked the previous posts and realized that the format you're reporting for the addresses in the protect list don't match the format returned by $address(<nick>,5)
Imo, he is requesting some help here, this means that he should gave the right information to us, but he never stated clearly how he store his protect list.
Also, $address could be $null, he should try to debug this code with an echo with the value of %addr, and $nick should be $nvnick($chan,%a) in your last line wink
Posted By: RusselB Re: to msg all but protected people - 16/08/08 07:10 PM
All of the information that has been requested has been provided, but this topic has gotten big enough that some of the earlier replies have been forgotten.

An earlier reply
Quote:
the addresses in my protect list are like: some*!*@*
therefore the information in the protect list is stored in the format of <nick>*!*@* with the nick having a wildcard following it, and both the ident and host portions of the address being wildcarded, in contrast to the absolute return by $address(<nick>,5)

mIRC doesn't have a $address mask that matches that format, so I used the $+ concatenator to make an address format that matches the format in the list.
Posted By: Wims Re: to msg all but protected people - 16/08/08 07:14 PM
I hope you're right, but the $nick part have to be changed anyway
Posted By: nataliad Re: to msg all but protected people - 17/08/08 12:30 AM
Originally Posted By: Wims
[quote]Imo, he is requesting some help here, this means that he should gave the right information to us, but he never stated clearly how he store his protect list.


my protect list is stored in every possible way, which means, but is not limited to:

any*!*@*
*any!*@*
*any*!*@*

*!*@any*
*!*@*any
*!*@*any*

*!*any@*
*!any*@*
*!*any*@*

there may be also, 'channels' and 'network name or server address' value (but this is rare and I wouldn't like this to complicate matters)

I usualy use these aliases to add to my protect list:

/i protect -w $$1 $+ *!*@*
/d protect -w *!*@* $+ $$1
/l protect -w $+(*!*@,$$1,*)
/y protect -w $+(*,$$1,!*@*)

sorry for any inconvenience, I thought it was known that my protect list could be anything...
Posted By: RusselB Re: to msg all but protected people - 17/08/08 03:15 AM
Do yourself a favour.. pick one format for the information on your protect list, and stick with it. mIRC's /protect command has an optional [type] parameter, so you can fill that parameter in with the number that corresponds with the mask format you wish to use.
See /help $mask for a list of numbers and their corresponding formats.

It'll make writing any script that references your protect list a lot easier.

If you have a lot of entries on your protect list, I'll see what I can do about writing a conversion script, but I'll need to know what format you actually want to use.

Doing a quick think on this, based on this additional information, I think the following code would work
Code:
alias msg2 {
  if $chan && $$1 {
    var %a = 1, %b = $nick($chan,0)
    while %a <= %b {
      set %msg2 $addtok(%msg2,$nick($chan,%a),44)
      var %c = 0, %d = 19
      while %c <= %d {
        if $protect($address($nick($chan,%a),%c)) {
          set %msg2 $remtok(%msg2,$nick($chan,%a),1,44)
        }
        if $ignore($address($nick($chan,%a),%c)) {
          set %msg2 $remtok(%msg2,$nick($chan,%a),1,44)
        }
        inc %c
      }
      inc %a
    }
    .msg %msg2 $1-
  }
}

Usage: /msg2 common message here
Posted By: Wims Re: to msg all but protected people - 17/08/08 01:28 PM
Originally Posted By: RusselB
All of the information that has been requested has been provided
funny.
Posted By: RusselB Re: to msg all but protected people - 17/08/08 05:07 PM
You disagree? If so, please provide references where information was requested from the OP, in regards to this topic, and the OP has not provided the information.
Posted By: Wims Re: to msg all but protected people - 17/08/08 06:41 PM
I'll not provide anything, and yes of course i disagree, i'm not saying it's your fault or the OP fault, i'm just saying that wrong questions have been asked to the OP and it took 32 replies to state that finally, we were not aware about how his protect list was, the most important thing.
And now, the only solution you gave him is that he should change his "stored method" simply to make the code easier.Again i'm not saying it's bad or something like that.
Posted By: RusselB Re: to msg all but protected people - 17/08/08 09:00 PM
Hmm.. You say that you disagree that the OP has provided information that has been requested, yet you're unwilling or unable to substantiate this. As to the format for the protect list
Quote:
Originally Posted By: RusselB
1) Please ensure that you do have the addresses in the protect list set to match the same format as $fulladdress (ie:nick!user@host)

Aside from that, I see nothing wrong with your code.


can you tell me please how to check this?
the addresses in my protect list are like: some*!*@*

At this point, the OP has given a specific format that the protect list is in. It's not until much later that it's revealed that this is, in fact, only one of the formats that the protect list uses.

Quote:
And now, the only solution you gave him is that he should change his "stored method" simply to make the code easier.
-- Did you completely miss the code I appended to that message? Also, that was a suggestion, since, if the OP wanted other scripts that also referenced the protect list, they are easier to write if one format is used in the protect list, rather than multiple formats.

Posted By: Wims Re: to msg all but protected people - 17/08/08 09:48 PM
I disagree about the whole thing, bot about what you said.You have asked some information and the OP gave you only one part of the info since there are multiple format in his protect list.My post was not against you, rather against the OP but i already said that he should have gave better information.

Quote:
Did you completely miss the code I appended to that message? Also, that was a suggestion, since, if the OP wanted other scripts that also referenced the protect list, they are easier to write if one format is used in the protect list, rather than multiple formats.
Yes, i don't even read your code.I've simply read the part when you suggest him to use only one format.It is true that it would make thing easier for him, but it's not what he was looking for at the beginning.
Posted By: nataliad Re: to msg all but protected people - 18/08/08 01:21 AM
Originally Posted By: RusselB

Code:
alias msg2 {
  if $chan && $$1 {
    var %a = 1, %b = $nick($chan,0)
    while %a <= %b {
      set %msg2 $addtok(%msg2,$nick($chan,%a),44)
      var %c = 0, %d = 19
      while %c <= %d {
        if $protect($address($nick($chan,%a),%c)) {
          set %msg2 $remtok(%msg2,$nick($chan,%a),1,44)
        }
        if $ignore($address($nick($chan,%a),%c)) {
          set %msg2 $remtok(%msg2,$nick($chan,%a),1,44)
        }
        inc %c
      }
      inc %a
    }
    .msg %msg2 $1-
  }
}

Usage: /msg2 common message here


I get this error:
* /set: line too long (line 557, script.ini)

I don't understand about the protect reference, you may tell me what to do about this, thanks
Posted By: RusselB Re: to msg all but protected people - 18/08/08 08:16 AM
First off, there's no need for you to have this at the end of another script. I suggest loading it into a new/empty remote page/file in the Script editor, then try it again, as it's hard for me to know just which line is causing the problem when the line number that is referenced is higher than the total number of lines in the code.

I also just spotted one small possible problem, which can be taken care of by putting
Code:
unset %msg2
just after the
Code:
alias msg2 {
line

Unless you're in a huge channel, this should handle that problem.
GTW: This is another good reason for upgrading, as mIRC 6.3 (I think) and above allow for more information to be stored in the variable names before that error message occurs.

Before 6.3 variables were limited to about 900 characters, after that they can hold about 4000. A significant increase, especially for a code like this.
© mIRC Discussion Forums