2021-01-26, 05:16 PM
(2021-01-26, 01:22 PM)patters Wrote: If I have multiple attribute changes on a single line, the last one is ignored on exit from a SUB.
Consider this example which exposes the problem:
Code:SUB screenAttributes PAPER 3: INK 7: BRIGHT 1 END SUB SUB screenAttributes2 PAPER 4: BRIGHT 1: INK 2 END SUB CLS screenAttributes() PRINT AT 0,0;"test" screenAttributes2() PRINT AT 2,0;"test2"
For the first example print, it should be bright but it isn't.
The second example print should have red ink but it doesn't.
I thought I was going mad until I found this.
If I substitute another command in this last statement position of the SUB (like a PRINT for instance) then that works. It's only attribute assignments that seem to fail. Also, if I insert another command before the END SUB, then it all works as expected. e.g. the below code works fine:
Code:SUB screenAttributes PAPER 3: INK 7: BRIGHT 1 BEEP 0.1,60 END SUB SUB screenAttributes2 PAPER 4: BRIGHT 1: INK 2 BEEP 0.1,60 END SUB CLS screenAttributes() PRINT AT 0,0;"test" screenAttributes2() PRINT AT 2,0;"test2"
On further testing, the issue is not related to multiple colon-separated statements on the same line. With the following code the compiler also loses the last statement in each Sub and fails to work as expected:
Code:SUB screenAttributes PAPER 3 INK 7 BRIGHT 1 END SUB SUB screenAttributes2 PAPER 4 BRIGHT 1 INK 2 END SUB CLS screenAttributes() PRINT AT 0,0;"test" screenAttributes2() PRINT AT 2,0;"test2"
What version are you using? (zxbc --version)

