Incredible! Can't wait Vempele. Will you also be releasing the code? I assume if it's a chrome extension the source will be exposed anyway, but would be nice to throw it up on github.
Incredible! Can't wait Vempele. Will you also be releasing the code? I assume if it's a chrome extension the source will be exposed anyway, but would be nice to throw it up on github.
@vempele, while you're in the feature-adding mood, would be nice to have key-bindings to piece holdings. e.g. if I press "k" that puts a knight in my hand.
@vempele, while you're in the feature-adding mood, would be nice to have key-bindings to piece holdings. e.g. if I press "k" that puts a knight in my hand.
also is it possible to implement sequential premoves via an extension, or would that have to be done on lichess' end? would be neat to be able to hold "ctrl" and cast another premove that gets implemented if the first one fails.
also is it possible to implement sequential premoves via an extension, or would that have to be done on lichess' end? would be neat to be able to hold "ctrl" and cast another premove that gets implemented if the first one fails.
@Vempele, that's really great! Can it select squares with keys or make moves using arrows?
@Vempele, that's really great! Can it select squares with keys or make moves using arrows?
@Vempele, by the way, did you figure out how to simulate mouse clicks on chess pieces? Or you just use a field for keyboard input? It seems that simulating a click on a piece is only possible to do with an external program, which could control the mouse pointer. Don't you know a way to do this through a chrome extension by any chance?
@Vempele, by the way, did you figure out how to simulate mouse clicks on chess pieces? Or you just use a field for keyboard input? It seems that simulating a click on a piece is only possible to do with an external program, which could control the mouse pointer. Don't you know a way to do this through a chrome extension by any chance?
@Chesstroll_Ingot @Flourish Tampermonkey script here: https://gist.github.com/Vempele/46333e85e33b6d488c3ffb131942272d
Tested in Chrome, may work in other browsers.
Use
qwe
a d
zxc
to move a piece forward / sideways / backward to the square you're hovering over.
Piece drops:
12345=PNBRK, the piece is (by default) dropped immediately since the alternative of putting it in your hand is hacky.
Specific pieces: N for knight, K for king; others are implemented (except for pawn) but commented out (in function setShortcuts() near the bottom). If there are multiple pieces of the same kind that can move to the square, the piece is selected in
move forward > move backward
move to the right > move to the left
order (starting with greatest); press the shortcut again to select the next piece.
Do get familiar with it in https://lichess.org/analysis before trying it in real games.
Despite my attempts to bind it multiple times, Lichess sometimes overwrites Z with its shortcut for Zen mode. Reloading the page has a high chance of fixing it.
Will not work when playing Racing Kings if you're black. Works in analysis.
May not work in puzzles. Haven't checked in a while; last time I did, it required a reload of the page for each new puzzle.
Multi-premove would be too complicated.
On clicks: see the clickDown/clickUp/clickAt functions. Note that they use client coordinates.
On programmatically typing your moves: the contents of the input box are only checked on a keyup event. UCI moves must be typed one coordinate at a time, i.e.
e2<enter> (e2 is selected, input box becomes empty)
e4<enter> (e2e4 is played)
@Chesstroll_Ingot @Flourish Tampermonkey script here: https://gist.github.com/Vempele/46333e85e33b6d488c3ffb131942272d
Tested in Chrome, may work in other browsers.
Use
qwe
a d
zxc
to move a piece forward / sideways / backward to the square you're hovering over.
Piece drops:
12345=PNBRK, the piece is (by default) dropped immediately since the alternative of putting it in your hand is hacky.
Specific pieces: N for knight, K for king; others are implemented (except for pawn) but commented out (in function setShortcuts() near the bottom). If there are multiple pieces of the same kind that can move to the square, the piece is selected in
move forward > move backward
move to the right > move to the left
order (starting with greatest); press the shortcut again to select the next piece.
Do get familiar with it in https://lichess.org/analysis before trying it in real games.
Despite my attempts to bind it multiple times, Lichess sometimes overwrites Z with its shortcut for Zen mode. Reloading the page has a high chance of fixing it.
Will not work when playing Racing Kings if you're black. Works in analysis.
May not work in puzzles. Haven't checked in a while; last time I did, it required a reload of the page for each new puzzle.
Multi-premove would be too complicated.
On clicks: see the clickDown/clickUp/clickAt functions. Note that they use client coordinates.
On programmatically typing your moves: the contents of the input box are only checked on a keyup event. UCI moves must be typed one coordinate at a time, i.e.
e2<enter> (e2 is selected, input box becomes empty)
e4<enter> (e2e4 is played)
@Vempele, that's incredible! Thank you very much!
It works in puzzles without any problems too.
I had some ideas about implementing multi-premoves with AutoHotKey, by the way. Maybe I'll try to find some way.
@Vempele, that's incredible! Thank you very much!
It works in puzzles without any problems too.
I had some ideas about implementing multi-premoves with AutoHotKey, by the way. Maybe I'll try to find some way.
What I really don't like about multi-premove is that it's something you can't do at all with the standard Lichess interface. Keyboard+mouse move input is just another way to do the same things you (and everybody else) can do with a mouse (or even a touchscreen). But multi-premove automates something you'd otherwise have to do manually.
I could make it so you could "save" a move to be executed later on a key press. Ctrl+click/drag would be a natural way to do it, but your original premove would get cancelled along the way (and the board doesn't contain information about which premove square is the source and which is the target, so it's not always possible to automatically restore the premove). Shift+kbmove would avoid this problem.
What I really don't like about multi-premove is that it's something you can't do at all with the standard Lichess interface. Keyboard+mouse move input is just another way to do the same things you (and everybody else) can do with a mouse (or even a touchscreen). But multi-premove automates something you'd otherwise have to do manually.
I could make it so you could "save" a move to be executed later on a key press. Ctrl+click/drag would be a natural way to do it, but your original premove would get cancelled along the way (and the board doesn't contain information about which premove square is the source and which is the target, so it's not always possible to automatically restore the premove). Shift+kbmove would avoid this problem.
What about this idea:
- Let's say, we have one piece already premoved.
- We press Ctrl.
- We drag a second premove (but if we unpress left mouse button the first premove gets cancelled).
- So we make automatic click of the right mouse button (If we click the right mouse button while dragging the second premove, it gets cancelled without cancelling the first premove).
- If ctrl is pressed, right click happens automatically (but i don't know if it's possible to do: if we unpress left mouse button, then could a script for a few milliseconds prevent the information about unpressing to come to the board, and before this auto-press the right button) and the destination of the second premove gets higlighted with, for example, transparent red color by a userscript.
- It's still not a usual premove (and Lichess's board doesn't see it), but it gets executed by a script right after the first premove was executed. Then it executes as a usual premove.
- All it works while Ctrl is pressed, if we unpress Ctrl, premove just cancels.
- When the first premove (which is seen by Lichess board) gets executed, we may continue pressing Ctrl, and drag another premove. While our second (the premove which was red at the beginning) becomes blue (and is seen by Lichess board), we drag another premove, which becomes red, untill the previous one gets executed and so forth.
- If we want to make a third premove, we continue to press Ctrl and press Shift also, for example, and the script interprets it as an instruction for a third premove, which do next things.
- While executing the third premove, all mouse click on the board get prevented. We just click or drag a piece, but it doesn't move. But once the first premove gets executed, the third one turns into the second, by becoming red. Although that is probably impossible, i don't know, because the second premove requires dragging, and converting the third premove to the second would require not just clicking on two squares, but dragging a piece and then automatic right click again.
- So, probably, two premoves at least are possible. I don't know though, how would it work in combination with keyboard assistance for moves. Maybe the program can prevent clicks, remember the starting and the final position of mouse movement or a click, or, if it's done with keyboard, just remember two coordinates. Then it can highlight the starting and the final square with its script. And then it would be just converted in a usual 1-premove, when it's turn comes.
What about this idea:
1. Let's say, we have one piece already premoved.
2. We press Ctrl.
3. We drag a second premove (but if we unpress left mouse button the first premove gets cancelled).
4. So we make automatic click of the right mouse button (If we click the right mouse button while dragging the second premove, it gets cancelled without cancelling the first premove).
5. If ctrl is pressed, right click happens automatically (but i don't know if it's possible to do: if we unpress left mouse button, then could a script for a few milliseconds prevent the information about unpressing to come to the board, and before this auto-press the right button) and the destination of the second premove gets higlighted with, for example, transparent red color by a userscript.
6. It's still not a usual premove (and Lichess's board doesn't see it), but it gets executed by a script right after the first premove was executed. Then it executes as a usual premove.
7. All it works while Ctrl is pressed, if we unpress Ctrl, premove just cancels.
8. When the first premove (which is seen by Lichess board) gets executed, we may continue pressing Ctrl, and drag another premove. While our second (the premove which was red at the beginning) becomes blue (and is seen by Lichess board), we drag another premove, which becomes red, untill the previous one gets executed and so forth.
9. If we want to make a third premove, we continue to press Ctrl and press Shift also, for example, and the script interprets it as an instruction for a third premove, which do next things.
10. While executing the third premove, all mouse click on the board get prevented. We just click or drag a piece, but it doesn't move. But once the first premove gets executed, the third one turns into the second, by becoming red. Although that is probably impossible, i don't know, because the second premove requires dragging, and converting the third premove to the second would require not just clicking on two squares, but dragging a piece and then automatic right click again.
11. So, probably, two premoves at least are possible. I don't know though, how would it work in combination with keyboard assistance for moves. Maybe the program can prevent clicks, remember the starting and the final position of mouse movement or a click, or, if it's done with keyboard, just remember two coordinates. Then it can highlight the starting and the final square with its script. And then it would be just converted in a usual 1-premove, when it's turn comes.