mIRC Home    About    Download    Register    News    Help

Print Thread
Stopping identifier evaluation #178920 16/06/07 01:47 PM
Joined: Jun 2007
Posts: 3
C
Criptych Offline OP
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.
Re: Stopping identifier evaluation [Re: Criptych] #178922 16/06/07 01:52 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
$read(filename.txt,nt,%line)

/help $read

Re: Stopping identifier evaluation [Re: Criptych] #178923 16/06/07 01:53 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
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.

Re: Stopping identifier evaluation [Re: SladeKraven] #178981 16/06/07 10:25 PM
Joined: Dec 2002
Posts: 503
B
Bekar Offline
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.

Re: Stopping identifier evaluation [Re: Bekar] #179039 17/06/07 11:54 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
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.

Re: Stopping identifier evaluation [Re: SladeKraven] #179152 18/06/07 04:35 PM
Joined: Jun 2007
Posts: 3
C
Criptych Offline OP
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.
Re: Stopping identifier evaluation [Re: Criptych] #179158 18/06/07 06:02 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
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.

Re: Stopping identifier evaluation [Re: SladeKraven] #179192 18/06/07 11:32 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
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
Re: Stopping identifier evaluation [Re: Mpdreamz] #179205 19/06/07 06:00 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
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!
Re: Stopping identifier evaluation [Re: Criptych] #179275 20/06/07 02:15 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
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.

Re: Stopping identifier evaluation [Re: deegee] #179614 25/06/07 02:44 PM
Joined: Jun 2007
Posts: 3
C
Criptych Offline OP
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