mIRC Homepage
Posted By: andymps hmmmm... while - 18/03/04 05:53 AM
$mods...... makes mirc freeze... i know its the while but i just dont know why it doesnt work
Code:
alias mods {
  set %i 1
  while ($read(onlinemods1.txt,%i)) {
    if (@ iswm $read(onlinemods1.txt,%i)) {
      if (%@s == $null) {
        set %@s  $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
      elseif (%@s != $null) {
        set %@s %@s $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
    }
    if ($chr(33) iswm $read(onlinemods1.txt.%i)) {
      if (%!s == $null) {
        set %!s  $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
      elseif (%!s != $null) {
        set %!s %!s $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
    }
    if ($chr(37) iswm $read(onlinemods1.txt,%i)) {
      if (%hs == $null) {
        set %hs  $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
      elseif (%hs != $null) {
        set %hs %hs $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
    }
    if ($chr(43) iswm $read(onlinemods1.txt,%i)) {
      if (%+s == $null) {
        set %+s  $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
      elseif (%+s != $null) {
        set %+s %+s $read(onlinemods1.txt,%i) $+ ,
        inc %i
      }
    }
  }
  return %!s %@s %hs %+s
  unset %!s 
  unset %@s 
  unset %hs 
  unset %+s
}
Posted By: andymps Re: hmmmm... while - 18/03/04 05:54 AM
btw the onlinemods.txt is:
!name
@name
%name
+name
like that
Posted By: Online Re: hmmmm... while - 18/03/04 08:17 AM
It's not recommended to do $read loops because they involve intensive (and relatively slow) hard disk access. This script dumps the whole file to a hidden @window in one instance and enables you to use $fline (a bonus by itself):
  • alias mods {
    window -h @@
    loadbuf @@ onlinemods.txt
    var %result = $fline(@@,!*,0) $fline(@@,@*,0) $fline(@@,% $+ *,0) $fline(@@,+*,0)
    close -@ @@
    return %result
    }
Posted By: andymps Re: hmmmm... while - 18/03/04 09:07 AM
shocked how simple!
Posted By: tidy_trax Re: hmmmm... while - 18/03/04 09:46 AM
btw, i think your problem was, if all if () statements were $false, then %i wouldn't be inc'd wink
© mIRC Discussion Forums