X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=rogue_chat.html;h=23626cf7503a91a5aeaa527b39f48cae1adfa698;hb=03caeafc19a0c9a0c48fb667139c0b1726644f40;hp=5003854e7115ade22a4380f4a63dc788d04c8150;hpb=9f80260dd126a305f4b71541f00dcc88264ce716;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index 5003854..23626cf 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -14,8 +14,10 @@ terminal rows: / terminal columns: / source code (includes proper terminal/ncurses client) +

-
+
+

button controls for hard-to-remember keybindings

@@ -484,7 +486,7 @@ let server = { if (tokens[0] === 'TURN') { game.turn_complete = false; game.turn = parseInt(tokens[1]); - } else if (tokens[0] === 'PSEUDO_FOV_WIPE') { + } else if (tokens[0] === 'OTHER_WIPE') { game.portals_new = {}; explorer.annotations_new = {}; game.things_new = []; @@ -970,7 +972,7 @@ let tui = { recalc_input_lines: function() { if (this.mode.has_input_prompt) { let _ = null; - [this.input_lines, _] = this.msg_into_lines_of_width(this.input_prompt + this.inputEl.value, this.window_width); + [this.input_lines, _] = this.msg_into_lines_of_width(this.input_prompt + this.inputEl.value + '█', this.window_width); } else { this.input_lines = []; } @@ -1045,7 +1047,7 @@ let tui = { }, pick_selectable: function(task_name) { const i = parseInt(this.inputEl.value); - if (isNaN(i) || i < 0 || i >= this.selectables.length) { + if (isNaN(this.inputEl.value) || i < 0 || i >= this.selectables.length) { tui.log_msg('? invalid index, aborted'); } else { server.send(['TASK:' + task_name, tui.selectables[i]]); @@ -1055,7 +1057,7 @@ let tui = { }, enter_ascii_art: function(command) { if (this.inputEl.value.length != 6) { - this.log_msg('? wrong input length, try again'); + this.log_msg('? wrong input length, must be 6; try again'); return; } this.log_msg(' ' + this.inputEl.value); @@ -1554,7 +1556,7 @@ document.onclick = function() { }; tui.inputEl.addEventListener('keydown', (event) => { tui.show_help = false; - if (event.key == 'Enter') { + if (['Enter', 'ArrowLeft', 'ArrowRight'].includes(event.key)) { event.preventDefault(); } if ((!tui.mode.is_intro && event.key == 'Escape') @@ -1750,10 +1752,7 @@ window.setInterval(function() { }, 1000); window.setInterval(function() { if (document.activeElement.tagName.toLowerCase() != 'input') { - const scroll_x = window.scrollX; - const scroll_y = window.scrollY; tui.inputEl.focus(); - window.scrollTo(scroll_x, scroll_y); }; }, 100); document.getElementById("help").onclick = function() { @@ -1801,15 +1800,17 @@ for (const move_button of document.querySelectorAll('[id*="_move_"]')) { }; let direction = move_button.id.split('_')[2].toUpperCase(); let move_repeat; + function move() { + if (tui.mode.available_actions.includes("move")) { + server.send(['TASK:MOVE', direction]); + } else if (tui.mode.available_actions.includes("move_explorer")) { + explorer.move(direction); + tui.full_refresh(); + }; + } move_button.onmousedown = function() { - move_repeat = window.setInterval(function() { - if (tui.mode.available_actions.includes("move")) { - server.send(['TASK:MOVE', direction]); - } else if (tui.mode.available_actions.includes("move_explorer")) { - explorer.move(direction); - tui.full_refresh(); - }; - }, 100); + move(); + move_repeat = window.setInterval(move, 100); }; move_button.onmouseup = function() { window.clearInterval(move_repeat);