mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2007
Posts: 3
C
Self-satisified door
OP Offline
Self-satisified door
C
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
Code:
$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
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
$read(filename.txt,nt,%line)

/help $read

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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
B
Fjord artisan
Offline
Fjord artisan
B
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
S
Hoopy frood
Offline
Hoopy frood
S
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
C
Self-satisified door
OP Offline
Self-satisified door
C
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
S
Hoopy frood
Offline
Hoopy frood
S
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
M
Hoopy frood
Offline
Hoopy frood
M
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
M
Fjord artisan
Offline
Fjord artisan
M
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
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
Originally Posted By: Criptych


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
C
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Jun 2007
Posts: 3
Originally Posted By: "deegee"
There is actually, you could /play the file (or line) to the channel.


That sounds too easy... well, thanks. smile



Link Copied to Clipboard