|
From: Alexander W. <aw-...@st...> - 2011-06-19 14:33:48
|
On 05/29/11 16:24, Fred Mellender wrote:
Hi!
> I would like to see a general scripting capability that would have
> commands for all the menu items in SCID as well as keyboard shortcuts.
> As an example project: construct "mate in one" puzzles (which I have
> done via the current interface to SCID, game by game):
Though a nice idea to have some sort of macro recorder, I feel that at
the moment no one has capacities to work on this. Do you? Could you
contribute the code? I fear this could get quite complex. And I'm not
sure how much use a macro recorder is in the end.
[...]
> If there were a scripting capability that would include language for all
> menu commands and key short cuts it would make SCID very powerful for
> projects like the above. Perhaps a separate script interpreter (outside
> of SCID) that could send commands to SCID (say, via STDIN) and receive
> results back would be simplest to implement. If SCID would define the
> command protocol, that would be enough to get us started (leaving the
> script language definition and interpreter to the user community).
Well, if you want a full scale scripting language within Scid you can
just do it right now. You can even do it for years. There is no need to
invent yet another language (a wast of time anyway) and in fact not to
write a single line of code.
Just use TCL as language and use Scid as API backend. It's all there,
it's the very way how Scid is done itself. For simple examples on how to
do such things see e.g. sc_spell, sc_addmove, sc_spell, sc_import, sc_...
Doing automatic searches within the Scid database to find individual
games by some criteria is e.g. done extensively in the correspondence
chess code. (tcl/tools/correspondence.tcl) All the cc functionality
lives on top of the tcl ie. scripting layer of Scid. Not a single line
of C code is involved here. Though it integrates with Scids menues it
was in fact written almost entirely without this linkage, in a way it is
a sample of a (well, by now pretty large) Scid macro. If one drops the
requirement for NLS support, one could even move all menues and buttons
geneated right into the very module itself and it would have no
interference with Scids main code at all.
If you want to check out how such things can be done I've attached a
simple "macro" that embeds itself into Scids CC functions to provide
better blending with some functionalities my favourite chess club. This
is used as a plugin. This plugin adds it's own menu entries (in this
case to the CC window) and lives completely on it's own. It doesn't
provide NLS for that reason. (But personally I don't care about NLS
myself as long as everything is in English.)
However beware: if you do such scripting you can easily trigger side
effects and/or destroy your work. So place your favourite disclaimer
here before you proceed. You've been warned! ;)
--
Kind regards, / War is Peace.
| Freedom is Slavery.
Alexander Wagner | Ignorance is Strength.
|
| Theory : G. Orwell, "1984"
/ In practice: USA, since 2001
|