home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add map writing.
[plomrogue2-experiments]
/
new2
/
rogue_chat.html
diff --git
a/new2/rogue_chat.html
b/new2/rogue_chat.html
index f1146cb7c9cd70646656c85c80ef67a4882a4973..5af97daa722531a568665a6fe1cf7600926e67d3 100644
(file)
--- a/
new2/rogue_chat.html
+++ b/
new2/rogue_chat.html
@@
-143,7
+143,9
@@
let game = {
let chat = {
input_line:"",
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",
"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') {
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');
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');
};
} else if (event.key === 'ArrowDown') {
websocket.send('TASK:MOVE DOWN');
};
- console.log(event.key);
}, false);
let websocket = new WebSocket(websocket_location);
}, false);
let websocket = new WebSocket(websocket_location);