Arimaa Forum (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi)
Arimaa >> Site Discussion >> Keyboard shortcuts (tampermonkey script)
(Message started by: harvestsnow on Mar 21st, 2013, 5:59pm)

Title: Keyboard shortcuts (tampermonkey script)
Post by harvestsnow on Mar 21st, 2013, 5:59pm
Hello,

This is a tampermonkey script that makes a few minor modifications to the js game client.

http://pastebin.com/b3u0b4zD

My first idea was to add a keyboard shortcut to send the move (space by default), saving the precious half-second needed to target and click the send button. Mostly intended for blitzers. I also added navigation keys: up and down arrows to go one move back or forward, page-up and page-down to go at the beginning and end of the game; "U" and "R" to undo/redo one step; backspace to undo the whole move; "G" to prompt for a particular move to go to, in the usual format; "P" to open a plan window, "M" to open the move list. Plus an option to automatically turn the sound off. All of these are easily modifiable.


I'm not sure to what extent this kind of client modifications complies with the tournament rules. I'd advise to use it with caution anyway, since it adds another possibility of accidental failure (hitting the send key by mistake).

I hope someone will find it helpful.


This works with chromium + tampermonkey, and should work with firefox + greasemonkey although I haven't tested it.
I used this page (http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes) to check the keyboard codes.


***
Added the possibility to control the pieces with the WASD keys (loosely following an idea presented here (http://arimaa.com/arimaa/forum/cgi/YaBB.cgi?board=siteIssues;action=display;num=1364038294)).
To move a piece, click on it first, then either click on the arrow or press a key to move it.
(very buggy, disabled by default)

Title: Re: Client modification (tampermonkey script)
Post by browni3141 on Mar 21st, 2013, 11:31pm
Awesome! I wish I had done this.

It works for me using Scriptish on Firefox.

Thanks a lot!

Title: Re: Keyboard shortcuts (tampermonkey script)
Post by harvestsnow on Apr 28th, 2013, 11:21am
I've added two things:
- predefined setups; it should be clear enough how to add your own. Currently used keys are 0 (random), 1-2-3-4, and TAB to mirror the setup horizontally.
- replay a game: F8 will ask for the game history (starting with the current move) and hopefully will play your moves for you, waiting for your opponent to do the same.  Wait until all your pieces are visible before calling it, and don't interact with the game board while it's working.

If it gets stuck for more than 10 seconds, there certainly is a bug somewhere. Reload the client and play without it; consider making a bug report here.

Bug reports and suggestions are welcome.

Title: Re: Keyboard shortcuts (tampermonkey script)
Post by harvestsnow on Jan 30th, 2014, 10:59am
Added a button to switch the animations off. The new position will be displayed immediately when the opponent moves, as if the "next move" button had been pressed.

+ "win/lose" labels are now hidden. Hit "l" to bring them back, or set the "NO_WINLOSE" var to true in the script.
To view a WC game without spoiling the result: copy the url of the scheduled game before it starts, and use it later.

Title: Re: Keyboard shortcuts (tampermonkey script)
Post by harvestsnow on Feb 3rd, 2014, 3:46pm
This bit should remove all indications of the outcome of a game from the client window:
http://pastebin.com/f4msCRRj
(I removed the corresponding part in the other script)

Title: Re: Keyboard shortcuts (tampermonkey script)
Post by harvestsnow on Jun 2nd, 2014, 9:52pm
The "Current" button prompts the current move for a quick copy (ctrl+c and escape). The "Range" button takes as input two move numbers separated by a hyphen (-), both optionnal (eg. 10g-12s, 20g-, -5s), and prompts a slash-separated move list.
This also works with the plan window in firefox, I haven't tested it yet with chromium.

Title: Re: Keyboard shortcuts (tampermonkey script)
Post by Brendan_M on Mar 31st, 2016, 3:11am
Thanks for making this harvestsnow

I changed the script so hovering the mouse over a piece and pressing arrow keys moves the piece, and spacebar to make the move

https://gist.github.com/brendanator/a7b1c2035d7065bd3c1b5497e0cf3f96




Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.