How to pass the server name to DosBox using a batch file?

For Multiplayer: Help and meet other players.

How to pass the server name to DosBox using a batch file?

Postby Da Easy Mitch » 2016-1-21 @ 13:54

I'm currently trying to set up a network game for Fatal Racing. So far all ist working flawlessly, as long as I add the server name to the .conf-file I use to start the client session. I start the client game using a .cmd-file with the following syntax:
<PATH-TO-DOSBOX>dosbox.exe - c "set SERVER=<SERVERNAME OR IP>" - conf <PATH-TO-CONF-FILE>

The problem is: The variable for SERVER only gets set after the autoexec in the conf file is processed, so it isn't set yet whe the autoexec calls "ipxnet connet %SERVER%" almost at the bginning.

Is there any way to add commands before the autoexec is run?
Last edited by Da Easy Mitch on 2016-1-21 @ 14:00, edited 1 time in total.
Da Easy Mitch
Newbie
 
Posts: 26
Joined: 2015-10-09 @ 10:11

Re: How to pass the server name to DosBox using a batch file?

Postby Dominus » 2016-1-21 @ 13:59

Just as an explanation, it's because the settings in the conf are read and set before any user command.
Move the ipxnet command from the autoexec section into a batch file and call that also via -c (for example dosbox.exe -c path\connect.bat)
User avatar
Dominus
DOSBox Moderator
 
Posts: 7576
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: How to pass the server name to DosBox using a batch file?

Postby Da Easy Mitch » 2016-1-21 @ 14:13

Wouldn't that be the same, just adding another file to the process? I could, of course, add the connect command, followed by the start file of the game as well to the batch, so it doesn't get started from the autoexec before making the connection. But that would mean moving half of the autoexec in the batch, which I don't particularly like. Yeah, i know, it's just cosmetics, but I like my batch files clean and easy! ;)

If there's no way to run commands before the autoexec, I'll just show my friends where to change the server name in the .conf-file, I think that's the easiest way. I was only hoping to make it as easy as possible by having them to change only a one-line batch file instead of the whole .conf.
Da Easy Mitch
Newbie
 
Posts: 26
Joined: 2015-10-09 @ 10:11

Re: How to pass the server name to DosBox using a batch file?

Postby Dominus » 2016-1-21 @ 14:16

if you pass the -c set Server=... before the batch file, then no, it's not the same as before.
The order is then:
autoexec section of the conf, set SERVER..., connect.bat
IMO, having as little as possible in the autoexec is best as you are more likely to accidentally lose your config than the batch file :)
User avatar
Dominus
DOSBox Moderator
 
Posts: 7576
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: How to pass the server name to DosBox using a batch file?

Postby Da Easy Mitch » 2016-1-21 @ 14:32

Ah, ok, I misunderstood what you meant earlier. Your idea is to keep only general settings in the autoexec section, then define the SERVER variable and then make the connection and start the game in another batch file. Yes, that should work as well. Thank you!

I set up a config and start batch for each game (and purpose), so neither should get lost. *crossing fingers* :)
Da Easy Mitch
Newbie
 
Posts: 26
Joined: 2015-10-09 @ 10:11


Return to DOSBox Multiplayer

Who is online

Users browsing this forum: No registered users and 1 guest