Discussion:
[xHarbour-developers] Another one
Enrico Maria Giordano
2016-08-16 13:26:36 UTC
Permalink
#command MYSAY [<txt>];
[ROW <row>];
[COL <col>];
=> MySayText( <txt>, <row>, <col> )


FUNCTION MAIN()

PRIVATE cVar1 := "This is a test"

PRIVATE n := 1

CLS

@ 8, 0 SAY &( "cVar" + LTRIM( STR( n ) ) )

MYSAY ROW 10 COL 0 "" + &( "cVar" + LTRIM( STR( n ) ) )

// This SAY won't show
MYSAY ROW 12 COL 0 &( "cVar" + LTRIM( STR( n ) ) )

INKEY( 0 )

RETURN NIL


FUNCTION MYSAYTEXT( cTxt, nRow, nCol )

@ nRow, nCol SAY cTxt

RETURN NIL

Result:

This is a test

This is a test

NIL

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Ron Pinkas
2016-08-16 16:50:06 UTC
Permalink
If you check the .PPO you will understand that you have a Pre Processing issue, with your command.
Post by Enrico Maria Giordano
#command MYSAY [<txt>];
[ROW <row>];
[COL <col>];
=> MySayText( <txt>, <row>, <col> )
FUNCTION MAIN()
PRIVATE cVar1 := "This is a test"
PRIVATE n := 1
CLS
@ 8, 0 SAY &( "cVar" + LTRIM( STR( n ) ) )
MYSAY ROW 10 COL 0 "" + &( "cVar" + LTRIM( STR( n ) ) )
// This SAY won't show
MYSAY ROW 12 COL 0 &( "cVar" + LTRIM( STR( n ) ) )
INKEY( 0 )
RETURN NIL
FUNCTION MYSAYTEXT( cTxt, nRow, nCol )
@ nRow, nCol SAY cTxt
RETURN NIL
Enrico Maria Giordano
2016-08-16 17:09:12 UTC
Permalink
Post by Ron Pinkas
Post by Enrico Maria Giordano
#command MYSAY [<txt>];
[ROW <row>];
[COL <col>];
=> MySayText( <txt>, <row>, <col> )
FUNCTION MAIN()
PRIVATE cVar1 := "This is a test"
PRIVATE n := 1
CLS
@ 8, 0 SAY &( "cVar" + LTRIM( STR( n ) ) )
MYSAY ROW 10 COL 0 "" + &( "cVar" + LTRIM( STR( n ) ) )
// This SAY won't show
MYSAY ROW 12 COL 0 &( "cVar" + LTRIM( STR( n ) ) )
INKEY( 0 )
RETURN NIL
FUNCTION MYSAYTEXT( cTxt, nRow, nCol )
@ nRow, nCol SAY cTxt
RETURN NIL
If you check the .PPO you will understand that you have a Pre Processing
issue, with your command.
Yes, but please note that this works:

MYSAY ROW 10 COL 0 "" + &( "cVar" + LTRIM( STR( n ) ) )

while this don't:

MYSAY ROW 12 COL 0 &( "cVar" + LTRIM( STR( n ) ) )

The only difference is:

"" +

I don't understand why. Can you explain, please?

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Enrico Maria Giordano
2016-08-16 17:37:48 UTC
Permalink
Post by Enrico Maria Giordano
MYSAY ROW 12 COL 0 &( "cVar" + LTRIM( STR( n ) ) )
0 & …
Is a valid single expression!
Ahhhhhh! I really missed it! So what is the proper solution? A change in
this command definition?

#command MYSAY [<txt>];
[ROW <row>];
[COL <col>];
=> MySayText( <txt>, <row>, <col> )

Or the prefix

"" +

that I already adopted?

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Enrico Maria Giordano
2016-08-17 18:01:35 UTC
Permalink
MYSAY … ROW … COL …
Note the ORDER!
Ok, this way:

MYSAY &( "cVar" + LTRIM( STR( n ) ) ) ROW 12 COL 0
Also you can so round the & exp with () this too will remove the ambiguity.
Do you mean this way?

MYSAY ROW 12 COL 0 ( &( "cVar" + LTRIM( STR( n ) ) ) )

I get:

Error E0030 Syntax error: "syntax error at '('"

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Ron Pinkas
2016-08-17 23:17:08 UTC
Permalink
Post by Enrico Maria Giordano
MYSAY … ROW … COL …
Note the ORDER!
MYSAY &( "cVar" + LTRIM( STR( n ) ) ) ROW 12 COL 0
Yes.
Post by Enrico Maria Giordano
Also you can so round the & exp with () this too will remove the ambiguity.
Do you mean this way?
MYSAY ROW 12 COL 0 ( &( "cVar" + LTRIM( STR( n ) ) ) )
Error E0030 Syntax error: "syntax error at '(‘"
Strange, I believed it should have worked. I must be missing something or it might be some PP bug. Anyway the best approach is the solution above.

Ron
------------------------------------------------------------------------------
Enrico Maria Giordano
2016-08-18 08:24:27 UTC
Permalink
Post by Ron Pinkas
Post by Enrico Maria Giordano
Do you mean this way?
MYSAY ROW 12 COL 0 ( &( "cVar" + LTRIM( STR( n ) ) ) )
Error E0030 Syntax error: "syntax error at '(‘"
Strange, I believed it should have worked. I must be missing something or it might be some PP bug. Anyway the best approach is the solution above.
Ok, thank you.

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG Music page: http://www.emagsoftware.it/emgmusic
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg

------------------------------------------------------------------------------
Continue reading on narkive:
Loading...