1 (edited by DarkWiiPlayer 2011-05-25 00:43:51)

Topic: Connect to server via parameters

Hello.
I want to create an AutoIt script that runs the teeworlds server and client, and connects to localhost automatically.
Is there any parameter that does that?

2 (edited by ghost 2011-05-25 02:24:21)

Re: Connect to server via parameters

you can pass any commands to the client by putting it behind the binary name. It could look like this in a bash script:

#!/bin/bash
./teeworlds_srv -f server.cfg &
./teeworlds "connect localhost:8303"

3

Re: Connect to server via parameters

all i needet was teeworlds "connect localhost", but thx smile

4 (edited by DarkWiiPlayer 2011-05-25 02:45:23)

Re: Connect to server via parameters

OK, now it's working.
And this is the code:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         DarkWiiPlayer

 Script Function:
    Run TeeWorlds server and client and the connects to localhost.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

$i = Run ( "teeworlds_srv.exe -f OnlineServer.cfg" )

If $i = 0 Then
    msgbox ( 0, "TeeWorlds", "ERROR: Could not start the server" )
EndIf

$i = Run ( 'teeworlds.exe "connect localhost"' )

If $i = 0 Then
    msgbox ( 0, "TeeWorlds", "ERROR: Could not start the game" )
EndIf

5

Re: Connect to server via parameters

DarkWiiPlayer wrote:
AutoIt Version: 3.3.6.1

lmao

6 (edited by DarkWiiPlayer 2011-05-26 23:10:18)

Re: Connect to server via parameters

???
yes, i'm using AutoIt version 3.3.6.1... and?

7

Re: Connect to server via parameters

fisted wrote:
DarkWiiPlayer wrote:
AutoIt Version: 3.3.6.1

lmao

Seconded. Don't use AutoIt. Batch scripts should be just as fine.

8

Re: Connect to server via parameters

AutoIt is easyer if you want to start the server AND the game from the same file...
If you just write

teeworlds_srv -f lol.cfg
teeworlds "connect localhost"

in a batch file, it will first start the server, and then it will wait until the program ends, but you want to start the game BEFORE the server closes, right?
In an AutoIt script that is easyer to solve. You just write

Run ( "teeworlds_srv.exe -f lol.cfg" )
Run ( 'teeworlds_srv.exe "connect localhost" )

And it works.

9

Re: Connect to server via parameters

DarkWiiPlayer wrote:

AutoIt is easyer if you want to start the server AND the game from the same file...
If you just write

teeworlds_srv -f lol.cfg
teeworlds "connect localhost"

in a batch file, it will first start the server, and then it will wait until the program ends, but you want to start the game BEFORE the server closes, right?

As you have to know how to code in AutoIt you have to know how to 'code' in batch:

@echo off
start teeworlds_srv.exe -f config.cfg
call teeworlds.exe "connect localhost"
exit

10

Re: Connect to server via parameters

...
that works...
But anyway, batch files aren't as cool as AutoIt scripts.

11

Re: Connect to server via parameters

DarkWiiPlayer wrote:

...
that works...
But anyway, batch files aren't as cool as AutoIt scripts.

Why?

12

Re: Connect to server via parameters

Give up...There's no way convincing them that it's your choice...But I guess batch file is better... (even if it's not "cooler")

Once in a century...

13

Re: Connect to server via parameters

because batch reminds me of strawberries, whereas autoit makes me think of robots. random info.

14

Re: Connect to server via parameters

I think AutoIt is better because you can make messageboxes.

$i = Run ( "teeworlds_srv.exe -f OnlineServer.cfg" )

If $i = 0 Then
    msgbox ( 0, "TeeWorlds", "ERROR: Could not start the server" )
EndIf