Skip to content

Black-on-black doesn't change attributes in Frame.js implementation of .putmsg()

If you use Frame.js's .putmsg() to write text in a color (say blue-on-black), then OVERWRITE that text with identical text in a different color (say red-on-black), it works as expected.

But if instead you were to overwrite with BLACK-on-black, it does NOT work. The frame keeps the previous foreground attribute (blue) instead of changing to black.

In contrast, console.putmsg() does NOT have this problem. It handles black-on-black just fine.

I presume there is a logic problem in Frame.prototype.putmsg(), but I haven't been able to figure it out.

Here's a short test case script:

load("sbbsdefs.js");
load("frame.js");

// COLOR CODES
var lowRed = '\x01N\x01R\x010';
var lowBlue = '\x01N\x01B\x010';
var lowWhite = '\x01N\x01W\x010';
var highCyan = '\x01H\x01C\x010';
var lowBlack = '\x01N\x01K\x010';
var highBlack = '\x01H\x01K\x010';

console.clear();

// PLAIN CONSOLE VERSION
console.gotoxy(1,1);
console.putmsg(lowWhite + 'PLAIN CONSOLE VERSION');
mswait(4000);
console.gotoxy(1,1);
console.putmsg(lowBlue + 'TEST1 TEST1' + highBlack + ' ... should say TEST1 TEST1 in low blue on black   ');
mswait(4000);
console.gotoxy(1,1);
console.putmsg(lowBlack + 'TEST2 TEST2' + highBlack + ' ... should say TEST2 TEST2 in black on black     ');
mswait(4000);
console.gotoxy(1,1);
console.putmsg(highCyan + 'TEST3 TEST3' + highBlack + ' ... should say TEST3 TEST3 in high cyan on black ');
mswait(4000);

// FRAME VERSION
testFrame = new Frame(1, 1, 80, 24, BG_BLACK);
testFrame.open();
testFrame.draw();
testFrame.gotoxy(1,1);
testFrame.putmsg(lowWhite + 'FRAME.JS VERSION');
testFrame.cycle();
mswait(4000);
testFrame.gotoxy(1,1);
testFrame.putmsg(lowBlue + 'TEST1 TEST1' + highBlack + ' ... should say TEST1 TEST1 in low blue on black    ');
testFrame.cycle();
mswait(4000);
testFrame.gotoxy(1,1);
testFrame.putmsg(lowBlack + 'TEST2 TEST2' + highBlack + ' ... should say TEST2 TEST2 in black on black     ');
testFrame.cycle();
mswait(4000);
testFrame.gotoxy(1,1);
testFrame.putmsg(highCyan + 'TEST3 TEST3' + highBlack + ' ... should say TEST3 TEST3 in high cyan on black ');
testFrame.cycle();
mswait(4000);
Edited by Josh Renaud