Board Markings Manager Script
From Jin
Note: This script is useless on ICC, where the functionality it provides is already built-in into Jin.
Note: This script is known to work with Jin 2.14. It may or may not work with other versions. It is not meant to be a full, working replacement of the arrows/circles functionality, as some things can't be done without server support. If you want true arrows/circles functionality, I suggest you message DAV on FICS and ask him to add it.
The Arrows and Circles manager script allows arrows and circles to be added to the board in examine mode. Once you've added the script, kibitz the following "commands" to add/remove arrows and circles:
$arrow e2 e4- adds an arrow from e2 to e4.$circle d5- adds a circle at d5 (it looks more like a square though :-)).$unarrow e2 e4- removes the e2-to-e4 arrow.$uncircle d5- removes the circle at d5.$cleararrows- removes all arrows.$clearcircles- removes all circles.$clearall- removes all board markings.
I suggest adding corresponding aliases (arrow, circle etc.) for the "commands".
Script definition:
- Script Type
- BeanShell.
- Event Type
- Chat
- Event Subtype
- Kibitz
- Code
import free.jin.board.*;
import free.jin.Game;
import free.chess.Square;
import java.awt.Color;
import free.util.StringTokenizer;
Game game = connection.getGame(gameNumber);
if (game.isPlayed())
return;
BoardManager bm = scripter.getPlugin("board");
JinBoard board = bm.getBoardPanel(game).getBoard();
StringTokenizer tokens = new StringTokenizer(message, " ");
String command = tokens.nextToken();
if (command.equals("$arrow")){
Square from = Square.parseSquare(tokens.nextToken());
Square to = Square.parseSquare(tokens.nextToken());
board.addArrow(new Arrow(from, to, Color.blue));
}
else if (command.equals("$circle")){
Square square = Square.parseSquare(tokens.nextToken());
board.addCircle(new Circle(square, Color.blue));
}
else if (command.equals("$unarrow")){
Square from = Square.parseSquare(tokens.nextToken());
Square to = Square.parseSquare(tokens.nextToken());
board.removeArrowsAt(from, to);
}
else if (command.equals("$uncircle")){
Square square = Square.parseSquare(tokens.nextToken());
board.removeCirclesAt(square);
}
else if (command.equals("$cleararrows")){
board.removeAllArrows();
}
else if (command.equals("$clearcircles")){
board.removeAllCircles();
}
else if (command.equals("$clearall")){
board.removeAllArrows();
board.removeAllCircles();
}
