Accounts e-mail HP

Command-line options to connect

Join us, meet players from all around the world, challenge the strongest top players, practice and be one of them!

Command-line options to connect

Postby monamipierrot » Sun Mar 10, 2013 9:53 pm

Hi,
I sigend up to 3 GT games so each time I have to type a different port when connecting.
I could remember that back in the LT days I had some batch files (in Windows) to launch different games and having only to type my password. Unfortunately I lost them and now I can't re-create them.
Can someone help me?
Another thing. One of the games I play with needs a different, hex-type tileset. So if I previoulsy played a different game, each time I need to additonally go to client options and manually select the new tileset.
Is there a way to put this option in the .bat file?
Thx
monamipierrot
Co-Admin of GT01, GT10-Hex.
 
Posts: 444
Joined: Sat Nov 03, 2012 8:43 pm
Location: Barcelona, Spain

Re: Command-line options to connect

Postby Davide » Sun Mar 10, 2013 11:25 pm

Hey monamipierrot,

for the ports hassle, Greatturn servers are listed on the public metaserver, so you could just point and click on a GT server and your client would get connected. However, let's take the batch scripting approach, which also allows for defining predetermined tilesets.

Suppose you are playing two Greatturn matches: GT00 and GT01. You can create one script for each match, bearing the names GT00.bat and GT01.bat. Pay attention to not let Windows hide the real file extension from the name, because it may append an additional invisible ".txt" without telling you, and this wouldn't work.
Inside each of the files, insert one of the following text line. Which line to insert into what file depends on the wanted configuration. The files need to be encoded in ASCII 7 bit (eg. use Notepad, but not Microsoft Word).

Code: Select all
C:\path\to\freeciv-client --autoconnect --server greatturn.org --port 5100 --tiles amplio2
C:\path\to\freeciv-client --autoconnect --server greatturn.org --port 5101 --tiles hex2t

Now when you want to connect to a server you just need to click on one of these scripts you made.
User avatar
Davide
 
Posts: 864
Joined: Sat Mar 24, 2012 12:34 am

Re: Command-line options to connect

Postby monamipierrot » Sun Mar 10, 2013 11:53 pm

Davide wrote:
Code: Select all
C:\path\to\freeciv-client --autoconnect --server greatturn.org --port 5100 --tiles amplio2
C:\path\to\freeciv-client --autoconnect --server greatturn.org --port 5101 --tiles hex2t


Great! It works! Grande Davide!
And what about passwords? I read somewhere ther was some leak in the server, so they shouldn't be used in a script. Is there any solution?
monamipierrot
Co-Admin of GT01, GT10-Hex.
 
Posts: 444
Joined: Sat Nov 03, 2012 8:43 pm
Location: Barcelona, Spain

Re: Command-line options to connect

Postby Davide » Mon Mar 11, 2013 12:19 am

It's not possible to automate the authentication using a vanilla client. This would require either to create an expansion feature on the client side, or to use other raw user-side solutions such as windowing scripts, which don't yet exist in public domain AFAIK.
User avatar
Davide
 
Posts: 864
Joined: Sat Mar 24, 2012 12:34 am

Re: Command-line options to connect

Postby ifaesfu » Mon Mar 11, 2013 5:27 pm

Wow, that's great! It was really annoying to change the tileset each time you switched an hex game for a non-hex one, and viceversa
User avatar
ifaesfu
 
Posts: 243
Joined: Sun Aug 26, 2012 1:03 pm
Location: Huelva, Spain

Re: Command-line options to connect

Postby monamipierrot » Mon Mar 11, 2013 6:10 pm

ifaesfu wrote:Wow, that's great! It was really annoying to change the tileset each time you switched an hex game for a non-hex one, and viceversa

Yes. Althou it should be a feature of the client itself to check for tileset consistency/compatibility and, if check is unsuccessfull, to automatically switch to a suitable one.
monamipierrot
Co-Admin of GT01, GT10-Hex.
 
Posts: 444
Joined: Sat Nov 03, 2012 8:43 pm
Location: Barcelona, Spain

Re: Command-line options to connect

Postby monamipierrot » Mon Mar 11, 2013 9:31 pm

The trick is great, but I found out that it overrides my original Windows launcher which sets language to en-gb.
Freeciv then "detects" the system language and run automatically with it (if it has been installed). Then, there's no way to change it from the client (quite an issue, in my opinion). I don't like any language different than English, which Freeciv could "detect".
I bet there's a batch option to run freeciv in English? Which one?
monamipierrot
Co-Admin of GT01, GT10-Hex.
 
Posts: 444
Joined: Sat Nov 03, 2012 8:43 pm
Location: Barcelona, Spain

Re: Command-line options to connect

Postby Davide » Mon Mar 11, 2013 9:57 pm

Try to insert a localization variable before invoking the client, such as:

Code: Select all
SET LC_ALL=C
C:\path\to\freeciv-client --autoconnect --server greatturn.org --port 5100 --tiles amplio2

If that doesn't work, try to replace LC_ALL with LANG.
Here's the manual page.
User avatar
Davide
 
Posts: 864
Joined: Sat Mar 24, 2012 12:34 am

Re: Command-line options to connect

Postby monamipierrot » Mon Mar 11, 2013 10:14 pm

Davide wrote:
Code: Select all
SET LC_ALL=C
C:\path\to\freeciv-client --autoconnect --server greatturn.org --port 5100 --tiles amplio2


It works great! I hope it has no side-effects on windows system. Thanks!
monamipierrot
Co-Admin of GT01, GT10-Hex.
 
Posts: 444
Joined: Sat Nov 03, 2012 8:43 pm
Location: Barcelona, Spain

Re: Command-line options to connect

Postby Davide » Mon Mar 11, 2013 10:46 pm

It shouldn't have side effects as that's solely a local variable which Windows forgets about after Freeciv quits.
User avatar
Davide
 
Posts: 864
Joined: Sat Mar 24, 2012 12:34 am


Return to Multiplayer / Online gaming

Who is online

Users browsing this forum: No registered users and 4 guests

cron