mIRC Home    About    Download    Register    News    Help

Print Thread
Bug In $read #42315 17/08/03 07:22 AM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
the status window says: * $base invalid parameters, even though i use the "n" switch in read(dont evaluate whats being read), this happens when im reading versions.txt from dohcans dstudio final.
this is my script:

Code:
alias aplay {
  var %i 1
  if ($1 == -s) { /eplay $2- | halt }
  if (!$exists($gettok($+(",$1-,"),1,64))) { echo -a 2* /aplay no such file | halt }
  if (!$2) { echo -a 2* /aplay invalid paramaters | halt }
  if ($lines($gettok($+(",$1-,"),1,64)) < 1) { echo -a 2* /aplay nothing to read | halt }
  if (!$window($eval(@ $+ $gettok($1-,2,64),2)).x) { window -a $eval(@ $+ $gettok($1-,2,64),2) }
  while (%i <= $lines($gettok($+(",$1-,"),1,64))) {
    $iif(!$read($gettok($+(",$1-,"),1,64),%i),goto next,echo $eval(@ $+ $gettok($1-,2,64),2) $read($gettok($+(",$1-,"),1,64),n,%i))
    :next
    inc %i
  }
}

Code:
alias eplay {
  var %x 1
  while (%x <= $lines($+(",$1-,"))) {
    $iif(!$read($+(",$1-,"),%x),goto next,echo -s $read($+(",$1-,"),n,%x))
    :next 
    inc %x
  }
}  

Last edited by pheonix; 17/08/03 07:22 AM.

new username: tidy_trax
Re: Bug In $read #42316 17/08/03 07:34 AM
Joined: Dec 2002
Posts: 169
J
Jerk Offline
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
You aren't specifying 'n' in the first $read on this line:

$iif(!$read($gettok($+(",$1-,"),1,64),%i),goto next,echo $eval(@ $+ $gettok($1-,2,64),2) $read($gettok($+(",$1-,"),1,64),n,%i))

Re: Bug In $read #42317 17/08/03 07:37 AM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
that shouldnt matter...., because when i echo it, it shouldnt evaluate it so it should echo the line non-evaluated


new username: tidy_trax
Re: Bug In $read #42318 17/08/03 07:45 AM
Joined: Dec 2002
Posts: 169
J
Jerk Offline
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
Sure it matters. When you do a $read without the N option mIRC will try to evaluate identifiers regardless of what you are doing with it.

When mIRC sees that line it evaluates $read(...) so it can check the condition of your IF statement. When it does the $read it attempts to evaluate $identifiers. The syntax in the file is not correct for $base so you get an error.

Re: Bug In $read #42319 17/08/03 08:09 AM
Joined: May 2003
Posts: 2,265
P
pheonix Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
ah yeah, thankyou very much grin


new username: tidy_trax