Discuss and request scripts and script accessories.
Site Admin
Post Oct 07, 2017 12:35
v4.0.7 brings enhanced colour and blinking features to the console. This example script shows off the capabilities. Try different modes and combinations of display adapter settings (see Options > Console)!

INSTALLATION:

1. Get the code below and save it somewhere on your computer
2. Open the console
3. Enter: "IMPORT ATTRDEMO.NUT" (without the quotes) at the prompt
4. When the file selector opens, navigate to the file and select it.
5. Type "ATTRDEMO" at the prompt:

Image


SOURCE CODE:

download here

Code: Select all

var attr = GCConsole.Attrib;

function main( _args )
{
	GCConsole.Clear();

	attr( 0x70 );
	print( "\n Character Attribute Demo " );
	attr( 7 );
	print( "\n\n" );

	for ( var y = 0; y < 16; ++y )
	{
		attr( 0 );
		
 		for ( var x = 0; x < 16; ++x )
		{
			if ( x > 0 ) {
				attr( 0 );
				putchar( ' ' );
			}
			attr( ( y << 4 ) | x );
			print( " " + y.ToHexStr().ToUpper() + x.ToHexStr().ToUpper() + " " );
		}
		
		putchar( '\n' );
	}
	
	attr( 7 );
	putchar( '\n' );
	
	attr( 0x34 );
	print( " Use 0x07 for: " );
	attr( 0x07 );
	print( " NORMAL TEXT " );
	attr( 0x7 );
	print( "\t\t" );
	
	attr( 0x34 );
	print( " Use 0x70 for: " );
	attr( 0x70 );
	print( " REVERSE TEXT " );
	attr( 0x7 );
	print( "\n" );
	
	attr( 0x34 );
	print( " Add 0x08 for: " );
	attr( 0x08 | 0x7 );
	print( " BRIGHT TEXT " );
	attr( 0x7 );
	print( "\t\t" );
	
	attr( 0x34 );
	print( " Add 0x80 for: " );
	attr( 0x80 | 0x7 );
	print( " BLINKING TEXT " );
	attr( 0x7 );
	print( "\n" );
}