home · contact · privacy
Only send PONG to connection_id that sent the PING.
[plomrogue2-experiments] / new2 / rogue_chat_nocanvas_monochrome.html
index 6436f216ee29f76e861d699d7a44884ba4827534..ab3ce34b1a65df612a176204f24f0dc09823f1fa 100644 (file)
@@ -10,7 +10,7 @@ terminal columns: <input id="n_cols" type="number" step=4 min=20 value=80 />
 <pre id="terminal" style="display: inline-block;"></pre>
 <textarea id="input" style="opacity: 0; width: 0px;"></textarea>
 <div>
-keys:<br />
+keys (see <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values">here</a> for non-obvious available values):<br />
 move up (square grid): <input id="key_square_move_up" type="text" value="w" /> (hint: ArrowUp)<br />
 move left (square grid): <input id="key_square_move_left" type="text" value="a" /> (hint: ArrowLeft)<br />
 move down (square grid): <input id="key_square_move_down" type="text" value="s" /> (hint: ArrowDown)<br />
@@ -708,9 +708,9 @@ tui.inputEl.addEventListener('keydown', (event) => {
         let [tokens, token_starts] = parser.tokenize(tui.inputEl.value);
         if (tokens.length > 0 && tokens[0].length > 0) {
             if (tui.inputEl.value[0][0] == '/') {
-                if (tokens[0].slice(1) == 'play' || tokens[0].slice(1) == 'P') {
+                if (tokens[0].slice(1) == 'play' || tokens[0][1] == tui.keys.switch_to_play) {
                     tui.switch_mode(mode_play);
-                } else if (tokens[0].slice(1) == 'study' || tokens[0].slice(1) == '?') {
+                } else if (tokens[0].slice(1) == 'study' || tokens[0][1] == tui.keys.switch_to_study) {
                     tui.switch_mode(mode_study);
                 } else if (tokens[0].slice(1) == 'help') {
                     tui.log_help();