Page 1 of 1

zippyGameEnd command in xboard for FICS

PostPosted: 25 Sep 2012, 06:36
by velocidrom
Hello guys,
So I have a computer account on FICS and would like to use xboard (under ubuntu linux if that matter). After each game I would like to send to the server several commands: lin0, lin1, ..., lin7.
And then on FICS I use aliases, for example "alias lin0 seek 3 0" so that my bot will auto seek after every game, automatically.
My problem is, I could not send those commands to the chess server.
I have read the read me file of zippy, even copied and pasted the only example given there for xboard but it did not work.
Here is an example that should have worked and that you can find by googling:
Code: Select all
-xrm '*zippyGameEnd: say hi\nsay prepare to die\n'
. However after a game on FICS all what was sent to the server was "gameend" (instead of "say hi" and "say prepare to die"), which is sent by default when there's nothing assignated to zippyGameEnd if I understood well.
So I tried a lot of variants like
Code: Select all
-zippyGameEnd='end0\n end1\n end2\n end3\n end4\n end5\n end6\n end7'
with and without spaces, a la winboard and a la xboard; sometimes when using -zippyGameEnd (thus the winboard way, something that SHOULD NOT work with xboard!) I could send the command lin0nlin1nlin2n...nli7n but never what I want. That is, 7 different commands.
With winboard I have no problem using zippyGameEnd, but for some unknown reason to me, I can't make it work with xboard. I've asked in FICS and several people helped me but they could not go further than what was written in the read me file of zippy and someone suggested me to create an account here and seek further help.
P.S.:Here is the example given in the read me file of zippy:
Code: Select all
-xrm '*zippyGameEnd: say thanks\nseek 5 0\nseek 2 12\n'
. I copied and pasted it into the terminal when login to FICS, but after a game what was sent to the server was "gameend" instead of "thanks", "seek 5 0", "seek 2 12".
Any help is greatly appreciated, thank you.
P.S.2:All works fine except this so far, here is my complete sentence to log into FICS if it matters:
Code: Select all
xboard -ics -icshost localhost -icsport 5501 -zp -fUCI -fcp /usr/games/critter -zippyGameEnd 'lin2\n lin3\n lin4\n lin5\n lin6\n'
where for the -zippyGameEnd part I tried tons of variants as I said and none worked.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 25 Sep 2012, 08:00
by H.G.Muller
Well, for one, in recent XBoard versions the command-line options are no longer processed by X, (because it has its own persistent settings file), so general system options like -xrm no longer work.

-zippyGameEnd="..."

(or even with a space in stead of the '=') do work to set the option, but the problem in your case is how to get the newlines in the. WinBoard processes strings to expand escape sequences like \n, but XBoard does not. I was told the reason for this is that in Linux it is possible to enter linefeeds in a string from the command line, by preceding them with backslash. Like

xboard -zippyGameEnd "line1\
line2\
line3"

Let me know if this works for you. Do you think it would be preferable if XBoard expanded all common escape sequences in all its string options?

Re: zippyGameEnd command in xboard for FICS

PostPosted: 25 Sep 2012, 20:02
by velocidrom
Thank you very much for the help!
I tried
Code: Select all
xboard -ics -icshost localhost -icsport 5501 -icslogon =/home/isaac/Games/critteronfics/critterstart.bin -zp -fUCI -fcp /usr/games/critter -zippyGameEnd "lin0\
lin1\
lin2\
lin3\
lin4\
lin5\
lin6"

The result on FICS after a game was "lin0lin1lin2lin3lin4lin5lin6". So only 1 command instead of 7.
I don't really understand your last question (English is not my native tongue) so I can't really answer. I think all would be fine if the example given in the read me file worked.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 26 Sep 2012, 09:27
by H.G.Muller
You are right: \ at the end of a line does not (no longer?) seem to be recognized as entry of a linefeed in Linux. I guess this forces us to rethink the handling of string options; I think that it becomes essential to recognize combinations like \n in all strings as linefeed, like WinBoard does.

There is still one way in which I could get it to work, though. I created a file 'ge', which contains the text:
Code: Select all
-zippyGameEnd {line1
line2
line3}

and then run the command

xboard -zp -ics -icshost freechess.org @ge

in the directory where ge is. This has the desired effect. When reading options from a file, linefeeds are still recognized, and considered part of the option value between {}. Of course you could put all options in a file, say 'bot', like

Code: Select all
-zp
-fcp crafty
-ics
-icshost freechess.org
-icshelper timeseal
-autoKibitz
-zippyGameEnd {line1
line2
line3}


and start with the command

xboard @bot

.

[Edit]

OK, I do understand better how this works now. XBoard, like WinBoard, does actually expand escape sequences like \n into what they stand for (newline, in this case). But only in arguments that are surrounded by single or double quotes.

Now the problem is that when you write double quotes on the Linux command line, like in -zippyGameEnd "line1\nline2", it is the Linux shell (bash) that strips off the quotes, (but does not convert the \n to a linefeed). When XBoard then handles the argument, it no longer sees the double quotes, and considers the argument a literal, not recognizing the \ as anything special. (line1\nline2 would be a valid Windows filename for nline2 if folder line1...)

So the solution is to protect the double quotes from being molested by bash, by preceding them with \ . This, however, then makes bash molest the \ in \n, which before was protected by the double quotes. So you also have to protect that, by prefixing it with a second backslash. So

-zippyGameEnd \"line1\\nline2\"

on the command line does the trick. After processing by bash, this is passed to XBoard as

-zippyGameEnd "line1\nline2"

and then XBoard sees it is a double-quoted string, and thus will replace any \n in it by linefeed.

A bit cumbersome. Perhaps we should XBoard also make the \n -> newline translation in strings that are not quoted.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 26 Sep 2012, 16:40
by velocidrom
Thank you immensely!!! It works great! :mrgreen:
I'm fine with the syntax but I think they should update the read me file.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 27 Sep 2012, 09:30
by H.G.Muller
I don't think I ever even looked in that README file...

After discussing this with someone else we came to the conclusion that putting the entire double-quoted string within single quotes should probably do it too. (Not tested)

-zippyGameEnd '"line1\nline2"'

Bash would then recognize the outer quotes, strip them, but let them protect everything that was between them from further scrutiny, so that both " and \ are not touched and passed to XBoard. Reversing the quote order (use " as outer quoting) would work with even larger likelihood. So I will probably adopt that as preferred syntax. (And adapt the README file accordingly.)

Thanks for reporting this problem!

Re: zippyGameEnd command in xboard for FICS

PostPosted: 08 Sep 2014, 00:12
by kalle
Hello . Do anyone know the correct commandline for zippyEndGame if you use Xboard. I use Xboard and Crafty 24.0 to connect to the ICC (ICS).
I have tried this line :

-xrm '*zippyGameEnd: say thanks\nseek 5 0\nseek 2 12\n'

But it doesnt seem to work. Do anyone know what command line to use these days ?

What i want is simply that Crafty sends out a 'seek' after each game.
All the best

Re: zippyGameEnd command in xboard for FICS

PostPosted: 08 Sep 2014, 06:48
by H.G.Muller
As described above (and in the zippy.README file)

-zippyGameEnd \"say thanks\\nseek 5 0\\nseek 2 12\\n\"

should work. And most likely

-zippyGameEnd '"say thanks\nseek 5 0\nseek 2 12\n"'

would work too. The trick is to prevent that the Linux shell will strip all quotes before passing the command to XBoard, as XBoard only recognizes '\n' as linefeed withing quotes.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 08 Sep 2014, 13:20
by mike schoonover
this is whats in my winboard ini. file

/zippyPlay=true
/zippyGameEnd='seek 5 \n seek 1 \n seek 3 \n'

note zippy commands usually have to be re-entered after every session.
i save ini. files in separate folders depending on the time controls i want.
note:you can only send three seeks at a time on fics.
regards
mike

Re: zippyGameEnd command in xboard for FICS

PostPosted: 08 Sep 2014, 14:09
by H.G.Muller
Yes, for WinBoard it is much easier as for XBoard, because you do not have to deal with a shell stripping the quotes off the string (which then makes XBoard fail to recognize the \n as linefeeds). Usually you just type the options in the Startup Dialog. Editing the 'ini file' (~/.xboardrc in the case of XBoard) would work there too, though, as XBoard reads from there without shell involvement.

But, like you mention, the zippy options are all volatile, so the changes would be immediately overwritten when XBoard saves settings. You can prevent that by defining the zippy options at the end of the master settings file, however. (Just after the /settingsFile and /saveSettingsFile arguments.) As the master settings file is never overwritten, anything you add there would be permanent, even volatile options. And after the /settingsFile option they would be processed after any saved settings are read, so that you could even overrule saved persistent options permanently.

An alternative is to rely on ini files invoked with the @ options, which are never used for saving settings. WinBoard's start-menu items for FICS and ICC make use of such files (FICS.xop and ICC.xop). You could easily clone those files under other names, and build them into zippy files by adding engine spec and your favorite zippy options, as well as specifying time controls. You then only have to double-click the applicable .xop file to start WinBoard with the options it contains (or drag it on top of the winboard.exe icon).

Re: zippyGameEnd command in xboard for FICS

PostPosted: 08 Sep 2014, 15:01
by kalle
H.G.Muller wrote:As described above (and in the zippy.README file)

-zippyGameEnd \"say thanks\\nseek 5 0\\nseek 2 12\\n\"

should work. And most likely

-zippyGameEnd '"say thanks\nseek 5 0\nseek 2 12\n"'

would work too. The trick is to prevent that the Linux shell will strip all quotes before passing the command to XBoard, as XBoard only recognizes '\n' as linefeed withing quotes.



This is what the ICC server says after every game : "aics% No such command (gameend)."

I cant get this to work.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 08 Sep 2014, 18:18
by H.G.Muller
Well, this goes far beyond the issues we were discussing here. Which was how to make sure a linefeed in the -zippyGameEnd string would not be molested. What you see shows that the -zippyGameEnd option is not seen at all, so that the default (gameend) stays in effect. This should not be possible at all.

What exactly is the complete command line you are using, when XBoard behaves this way?

Re: zippyGameEnd command in xboard for FICS

PostPosted: 09 Sep 2014, 00:01
by kalle
H.G.Muller wrote:Well, this goes far beyond the issues we were discussing here. Which was how to make sure a linefeed in the -zippyGameEnd string would not be molested. What you see shows that the -zippyGameEnd option is not seen at all, so that the default (gameend) stays in effect. This should not be possible at all.

What exactly is the complete command line you are using, when XBoard behaves this way?


I have tested many lines. First the line which is given in zippyreadme ....this one :

xboard -fcp crafty -zp -xrm '*zippyGameEnd: say thanks\nseek 5 0\nseek 2 12\n' = Doesnt work.



Then I have tested these lines in different ways...but in vain.



xboard -fcp crafty -zp -ics -icshost chessclub.com -xrm '*zippyGameEnd: seek 3 0 u f\n seek 5 0 u f\n resume'


xboard -fcp crafty -zp -ics -icshost chessclub.com -xrm -zippyGameEnd '"say thanks\nseek 3 0 u\nseek 5 0 u\n"'

xboard -fcp crafty -zp -ics -icshost chessclub.com -zippyGameEnd '"say thanks\nseek 3 0 u\nseek 5 0 u\n"'


xboard -fcp crafty -zp -ics -icshost chessclub.com -xrm -zippyGameEnd \"say thanks\\nseek 3 0 u\\nseek 5 0 u\n\"

xboard -fcp crafty -zp -ics -icshost chessclub.com -zippyGameEnd "say thanks\nseek 3 0 u\nseek 5 0 u"\n"

xboard -fcp crafty -zp -ics -icshost chessclub.com -zippyGameEnd "Thanks!\nseek 3 0 u\nseek 5 0 u"\n"

But maybe I have to give up and sit and make my "seeks" manually.

:(

Re: zippyGameEnd command in xboard for FICS

PostPosted: 09 Sep 2014, 00:24
by kalle
Here is the solution!! It works!!

Here is the golden command line :

xboard -fcp crafty -zp -ics -icshost chessclub.com -zippyGameEnd 'seek 3 0 u' -saveGameFile crafty.pgn -autoSaveGames true

The commandline connects to ICC (ICS). There I make the first seek manually and after the first game it sends a seek of 3 0 unrated. And it also saves my game to my pgn-file.



NICE!

And thanks for your efforts.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 09 Sep 2014, 08:42
by H.G.Muller
Indeed, everything with -xrm should not work anymore, and the -xrm probably makes what follows it invisible to XBoard (because the X-server snatches it away before XBoard processes its command line). This would explain why the -zippyGameEnd is completely ignored in those cases.

For the others, they should at least have led to sending something other than 'gameend' to ICC, but it might have been defective in linefeeds. I am surprised that the one with single quotes around the double quotes does not work. Perhaps it would have worked the other way around. The last two have an odd number of double quotes in them (all non-escaped), which is sure to confuse both the shell and XBoard.

I think this one:

xboard -fcp crafty -zp -ics -icshost chessclub.com -zippyGameEnd \"say thanks\\nseek 3 0 u\\nseek 5 0 u\\n\"

which is the one recommended in the discussion above, should still have worked, though.

Re: zippyGameEnd command in xboard for FICS

PostPosted: 14 Feb 2016, 19:52
by Richard Allbert
Bit of a bump, but

Code: Select all
\"say thanks\\nseek 3 0 u\\nseek 5 0 u\\n\"


Does work with Xboard.