CONSTANT CLR_CURRENT 0, It allows to change only one of the two parametrize (foreground, background) of @set_colour. The second is preserved.
Without library :[code]CONSTANT CLR_CURRENT 0;
Constant CLR_DEFAULT 1; Constant CLR_BLACK 2; Constant CLR_RED 3; Constant CLR_YELLOW 5; Constant CLR_BLUE 6;
[ color_ f b; @set_colour f b; ];
[ main key;
color_ (CLR_YELLOW, CLR_BLUE);
print "foreground: Yellow, background: Blue^";
color_ (CLR_RED, CLR_CURRENT);
print "foreground: Red, background: Blue^";
color_ (CLR_CURRENT, CLR_BLACK);
print "foreground: Red, background: Black^";
color_ (CLR_DEFAULT, CLR_DEFAULT);
print "foreground: Default, background: Default^";
@read_char 1 ->key;
];
But with library and SetColour(fg, bg), i can’t do that. I always have to define value of foreground and background.
Constant COLOR;
CONSTANT CLR_CURRENT 0;
Include "parser"; Include "verblib";
Object room "Color Room"
with
description [;
SetColour (CLR_YELLOW, CLR_BLUE);
print "foreground: Yellow, background: Blue^";
SetColour (CLR_RED, CLR_CURRENT);
print "foreground: Red, background: Blue^";
SetColour (CLR_CURRENT, CLR_BLACK);
print "foreground: Red, background: Black^";
SetColour (CLR_DEFAULT, CLR_DEFAULT);
print "foreground: Default, background: Default^";
],
has light;
[ initialise; clr_on = 1; location = room; ];
Include "grammar";
And if I want to use colors, I MUST SET CLR_ON TO 1 because in library it is never set, and it’s always equal to 0 !?
(Thanks to the (stupid!?) machine translator, it is hard to explain something in a language which is not his!)