Yawhatnever commented on a Page, Seen System - Help Needed!  -  Jun 22, 2013

Yes, using a loop to read through hundreds of lines will be slow. You should use $read()'s built in search functions. (/help $read)

if ($nick ison $chan) {
      var %relay notice $nick
      var %relay2 msg $chan
      goto seen
    }
    if ($nick !ison $chan) {
      var %relay msg $nick
      var %relat2 msg $nick
      goto seen
    }

Could be changed to something like:

if (#) {
  var %relay notice $nick
  var %relay2 msg $chan
}
else {
  var %relay msg $nick
  var %relay2 msg $nick
  ;I'm assuming "relat2" was a typo here.
  ;There's no reason to use 'goto seen'.
}

'goto seen_true' should really just be 'break' to exit the loop.

You can get rid of a lot of variables here:

    var %hostname_seen $address($nick,2)
    var %hostname-minus-front_seen $remove(%hostname_seen,*!*@)
    var %hostname-minus-back_seen $remove(%hostname-minus-front_seen,.users.netgamers.org)
    var %access_seen $readini(adata.ini,%hostname-minus-back_seen,access)

equals:

    var %access_seen $remove($address($nick,2),*!*@,.users.netgamers.org)
    var %access_seen $readini(adata.ini,%access_seen,access)

$chr(19) in the hostmask is strange, I don't think I've seen that before.

    if (%access_seen == hc || %access_seen == bc || %access_seen == scanner || %access_seen == member) {
;could be
    if ($istok(hc bc scanner member, %access_seen, 32)) {

Rather than using a bunch of halts in the main body, just use elseif (). (syntax: /help if then else)

Clouds  -  Jun 22, 2013

Thanks for that! Do you know why the while loops are causing mIRC to crash? Is it because the txt file contains too much data for it to loop?

Yawhatnever  -  Jun 22, 2013

Is it actually a crash, or is it just unresponsive?

If it's an endless loop, you will be able to press ctrl+break to break out of whatever it's doing and it will start responding again. You may have to press it a few times before it works.

Clouds  -  Jun 22, 2013

It's unresponsive for 30 seconds, and it does it with all my loop scripts. I'm thinking it's because the .txt file is too large for it to process.

Yawhatnever  -  Jun 22, 2013

But it does start responding again, right?

Clouds  -  Jun 22, 2013

Yes, but it's a pain when other scripts are being performed on command, which results in some of them to seriously lag due to mIRC not responding while processing the looping.

Yawhatnever  -  Jun 22, 2013

In that case, read the very first line of my original response.

Hawkee  -  Jun 22, 2013

Sorry, we do not accept questions posted as snippets. They must be complete code. I'll remove this.

[Plornt]  -  Jun 24, 2013

mIRC's read function got incredibly slow after version 7 for some reason. The quickest way to loop through WITHOUT using $read is to use the /fopen $fread /fclose commands. Tis much faster for whatever reason.

Yawhatnever  -  Jun 24, 2013

I think /filter would be a better solution than /fopen $fread...


var %x 1
var %totallines $lines(users.txt)
while (%x <= %totallines) {
  if ($2 isin $read(users.txt,%x)) { 
    var %search $addtok(%search,$read(users.txt,%x),32)    
  }
  inc %x
}

Should be equivalent to:

filter -fkg users.txt user_search $2
;
alias -l user_search set -u %search $addtok(%search, $1, 32)
[Plornt]  -  Jun 24, 2013

Yeah sorry, meant it not specifically in this case but if in the future they need to read raw lines.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.