allow clear command in chat

This commit is contained in:
Baipyrus 2023-02-02 11:09:33 +01:00
parent 0367fe45d1
commit d2be753513

View File

@ -6,9 +6,15 @@ function runCommand(input) {
// Exit current level
const modeSplit = chatMode.split(' ');
if (input.toLowerCase().startsWith("exit") && modeSplit[0] !== "default") {
cmd_exit();
return "";
if (modeSplit[0] !== "default") {
const lowerIn = input.toLowerCase();
if (lowerIn.startsWith("exit")) {
cmd_exit();
return "";
} else if (lowerIn.startsWith("clear")) {
cmd_clear();
return "";
}
}
// Handle different chat modes
@ -90,10 +96,9 @@ function cmd_clear() {
tbDiv.removeChild(tbc[i]);
const prelink = document.createElement("a");
prelink.innerHTML = pretext.original;
prelink.innerHTML = pretext.current;
tbDiv.replaceChild(prelink, tbc[1]);
pretext.current = pretext.original;
cursorPosition = 0;
cursorYOffset = 7;