Skip to content
Snippets Groups Projects
Commit 58638ece authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Lightbar confirm/deny Baja mods ported to JS, supporting multi-languages

Really, these should just be loadable modules (not loaded via text.dat
@exec and global variable magic), and merged into a single module, but for
now, this will do.

The old yesnobar.src/bin and noyesbar mods aren't used when these .js files
are in place, unless you have a copy yesnobar/noyesbar.bin in your mods dir.
parent b2d7d27a
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4833 passed
// JS version of noyesbar.src
const yes_str = bbs.text(bbs.text.Yes);
const yes_key = yes_str[0];
const no_str = bbs.text(bbs.text.No);
const no_key = no_str[0];
while(console.question.substring(0, 2) == "\r\n") {
console.crlf();
console.question = console.question.substring(2);
}
console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@");
var affirm = false;
while(bbs.online && !js.terminated) {
var str;
if(affirm)
str = format("\x01n\x01b\x01h \x01~%s \x014\x01w\x01e[\x01~%s]", no_str, yes_str);
else
str = format("\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s ", no_str, yes_str);
console.print(str);
var key = console.getkey(0).toUpperCase();
console.backspace(console.strlen(str));
console.print("\1n\1h\1>");
if(console.aborted) {
affirm = false;
break;
}
if(key == '\r')
break;
if(key == yes_key) {
affirm = true;
break;
}
if(key == no_key) {
affirm = false;
break;
}
affirm = !affirm;
}
console.ungetstr(affirm ? yes_key : no_key);
// JS version of yesnobar.src
const yes_str = bbs.text(bbs.text.Yes);
const yes_key = yes_str[0];
const no_str = bbs.text(bbs.text.No);
const no_key = no_str[0];
while(console.question.substring(0, 2) == "\r\n") {
console.crlf();
console.question = console.question.substring(2);
}
console.putmsg("\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@");
var affirm = true;
while(bbs.online && !js.terminated) {
var str;
if(affirm)
str = format("\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s ", yes_str, no_str);
else
str = format("\x01n\x01b\x01h \x01~%s \x014\x01w\x01e[\x01~%s]", yes_str, no_str);
console.print(str);
var key = console.getkey(0).toUpperCase();
console.backspace(console.strlen(str));
console.print("\1n\1h\1>");
if(console.aborted) {
affirm = false;
break;
}
if(key == '\r')
break;
if(key == yes_key) {
affirm = true;
break;
}
if(key == no_key) {
affirm = false;
break;
}
affirm = !affirm;
}
console.ungetstr(affirm ? yes_key : no_key);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment