CPCWiki forum

General Category => Programming => Topic started by: IndyUK on 12:56, 02 December 21

Title: Transparency in BASIC
Post by: IndyUK on 12:56, 02 December 21
Hi

When using transparency mode in BASIC, does it not work when in TAG mode? I've attached a small test program which demostrates what I mean.

10 MODE 1
20 PRINT CHR$(22)+CHR$(1):REM Trans on
30 LOCATE 10,20:PEN 3:PRINT CHR$(143)
40 LOCATE 10,20:PEN 2:PRINT CHR$(238)
50 PRINT CHR$(22)+CHR$(0);:REM Trans off
60 TAG:REM Transparency not working with TAG mode on
70 PRINT CHR$(22)+CHR$(1);:REM Trans on
80 MOVE 100,150:PRINT CHR$(143);
90 MOVE 100,150:PRINT CHR$(238);
100 PRINT CHR$(22)+CHR$(0);:REM Trans off       
110 TAGOFF


Am I doing something wrong?

Thanks
Title: Re: Transparency in BASIC
Post by: eto on 13:32, 02 December 21
With TAG you are switching to graphics mode. You have to select the graphics ink mode to OR.

PRINT CHR$(23);CHR$(3)

Also if you want to change the pen, you have to select the graphics pen and no longer the text pen.


Title: Re: Transparency in BASIC
Post by: IndyUK on 14:14, 02 December 21

Quote from: eto on 13:32, 02 December 21PRINT CHR$(23);CHR$(3)

Hi

Tried that but still didn't work. BTW, I'm using 464 model, so could what you suggested be for 664/6128 only?

Also, what is the BASIC command for setting the graphics pen?

Thanks
Title: Re: Transparency in BASIC
Post by: eto on 14:41, 02 December 21
Quote from: IndyUK on 14:14, 02 December 21
Hi

Tried that but still didn't work. BTW, I'm using 464 model, so could what you suggested be for 664/6128 only?

Also, what is the BASIC command for setting the graphics pen?

Thanks


Afaik this works for both models, as long as you are using the Escape codes.
Can you try this?


10 CLS
20 PRINT CHR$(23);CHR$(3):rem before TAG
30 TAG
40 MOVE 100,100,2:PRINT "X";
50 MOVE 100,100,3:PRINT "O";



Title: Re: Transparency in BASIC
Post by: IndyUK on 16:51, 02 December 21
Quote from: IndyUK on 14:14, 02 December 2110 CLS 20 PRINT CHR$(23);CHR$(3):rem before TAG 30 TAG 40 MOVE 100,100,2:PRINT "X"; 50 MOVE 100,100,3:PRINT "O";

Kind of worked. The transparency worked - Thanks! But the pen colour did not as the MOVE command does not have a 3rd parameter. According to the CPC464 manual it only has two - X and Y.
Title: Re: Transparency in BASIC
Post by: SkulleateR on 17:00, 02 December 21
Quote from: IndyUK on 16:51, 02 December 21
Kind of worked. The transparency worked - Thanks! But the pen colour did not as the MOVE command does not have a 3rd parameter. According to the CPC464 manual it only has two - X and Y.


Out of the Wiki :



If the TAG command is used to set text at the graphics cursor GRAPHICS PEN or GRAPHICS PAPER instead of the regular PEN or PAPERis necessary to colour the text.
Title: Re: Transparency in BASIC
Post by: IndyUK on 18:32, 02 December 21
Hi Guys,

Thanks for your help. Much appreciated.

Quote from: IndyUK on 14:14, 02 December 2110 CLS 20 PRINT CHR$(23);CHR$(3):rem before TAG 30 TAG 40 MOVE 100,100,2:PRINT "X"; 50 MOVE 100,100,3:PRINT "O";

I did finally get the transparency to work. Not sure what I was doing wrong but, using the example posted worked. Maybe my code was a bit disorganised and just need a clean-up.

Quote from: IndyUK on 16:51, 02 December 21If the TAG command is used to set text at the graphics cursor GRAPHICS PEN or GRAPHICS PAPER instead of the regular PEN or PAPERis necessary to colour the text.

Looked up the article myself to see how to use the command. No example but, I used 6128 model of CPC and it worked. So guess BASIC 1.0 doesn't have this command. Shame that piece of info is ommitted from the article.

Thanks again.
Title: Re: Transparency in BASIC
Post by: eto on 01:51, 03 December 21
Quote from: IndyUK on 16:51, 02 December 21Kind of worked. The transparency worked - Thanks! But the pen colour did not as the MOVE command does not have a 3rd parameter. According to the CPC464 manual it only has two - X and Y.

I forgot that... In my game "Cameronne" I also use TAG to write text in a custom font (4x5 pixels) to the screen. I quickly checked the code and I use e.g. PLOT -2,-2,13 to set the graphics pen to 13. I remember that I had problems making the game compatible with the 464 because of some missing commands and that I recognised that PLOT has the third parameter to set the graphics pen on all machines in the same way. -2,-2 is outside the screen so it won't be visible but it still sets the graphics pen.
Powered by SMFPacks Menu Editor Mod