X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=new2%2Frogue_chat.html;fp=new2%2Frogue_chat.html;h=5af97daa722531a568665a6fe1cf7600926e67d3;hb=8db0e200f8c2d279c68ca01b9ae235ab63c8f642;hp=f1146cb7c9cd70646656c85c80ef67a4882a4973;hpb=428ba19a1984f385f5fc55201734a150f59dafcb;p=plomrogue2-experiments diff --git a/new2/rogue_chat.html b/new2/rogue_chat.html index f1146cb..5af97da 100644 --- a/new2/rogue_chat.html +++ b/new2/rogue_chat.html @@ -143,7 +143,9 @@ let game = { let chat = { input_line:"", - history: ["contain whitespace, escape them with \\.", + history: ["visible ASCII char in the input prompt.", + "To write on the map, enter on a single", + "contain whitespace, escape them with \\.", "Use double quotes for strings that", "Use arrow keys to move your avatar.", " QUERY USER TEXT - send TEXT to USER", @@ -169,8 +171,12 @@ document.addEventListener('keydown', (event) => { chat.input_line = chat.input_line.slice(0, -1); tui.draw_input_line(); } else if (event.key === 'Enter') { - websocket.send(chat.input_line); - chat.input_line = '' + if (chat.input_line.length === 1) { + websocket.send("TASK:WRITE " + chat.input_line); + } else { + websocket.send(chat.input_line); + } + chat.input_line = ''; tui.draw_input_line(); } else if (event.key === 'ArrowLeft') { websocket.send('TASK:MOVE LEFT'); @@ -181,7 +187,6 @@ document.addEventListener('keydown', (event) => { } else if (event.key === 'ArrowDown') { websocket.send('TASK:MOVE DOWN'); }; - console.log(event.key); }, false); let websocket = new WebSocket(websocket_location);