|
Joined: Jun 2007
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Jun 2007
Posts: 3 |
I have a script that uses echo/msg to display lines from a file. Some lines contain items that mIRC tries to evaluate as identifiers, but I don't want it to do that. Using $eval($read(filename.txt,t,%line),1) still evaluates the contents for some reason (and not just the $read). How can I return the untouched line from the file?
Last edited by Criptych; 16/06/07 01:49 PM.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
$read(filename.txt,nt,%line)
/help $read
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Well first off, the $eval() identifier evaluates text so remove that.
$read(filename.txt,tn,%line)
Add the n switch.
From the help file:
If the n switch is specified then the line read in will not be evaluated and will be treated as plain text.
|
|
|
|
Joined: Dec 2002
Posts: 503
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 503 |
Slade, $eval() doesn't force evaluation. It uses the ',n' as the number of times to evaluate text. You can use $eval(xxx,0) to force non-evaluation.
Using ',1' in this case probably wouldn't work at all though.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
That is what I meant, I should have stated that 0 doesn't evaluate it.
|
|
|
|
Joined: Jun 2007
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Jun 2007
Posts: 3 |
Thank you, that seems to work great. Not sure how I missed that in the help file... n_n"
Unfortunately it still strips spaces from the line but I guess there's no way around that.
Bekar: As for $eval(...,0) I found that it doesn't even evaluate $read()!
Last edited by Criptych; 18/06/07 04:37 PM.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
While $eval($read(filename.txt,t,%line),0) doesn't evaluate the line, $read(filename.txt,tn,%line) does the same thing just shorter code so it'd seem more logical to do the latter.
|
|
|
|
Joined: Apr 2004
Posts: 759
Hoopy frood
|
Hoopy frood
Joined: Apr 2004
Posts: 759 |
That information is false
$eval($read(filename.txt,t,%line),0) doesn't evaluate the line NOR does it evaluate $read(..). $read(...) is treated as plain text.
$read(filename.txt,tn,%line) DOES evaluate $read but not any variables/identifiers it finds in the line $read returns because you tell it not too with the n parameter.
$maybe
|
|
|
|
Joined: Apr 2003
Posts: 342
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 342 |
Ugh... $read is evil!
Use $fread! BWAHAHAHA!
Beware of MeStinkBAD! He knows more than he actually does!
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
Unfortunately it still strips spaces from the line but I guess there's no way around that.
There is actually, you could /play the file (or line) to the channel. /play doesn't evaluate or strip spaces by default.
|
|
|
|
Joined: Jun 2007
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Jun 2007
Posts: 3 |
There is actually, you could /play the file (or line) to the channel. That sounds too easy... well, thanks.
|
|
|
|
|