View Single Post
  #1  
Old 11-22-2011, 08:20 AM
gec gec is offline
Registered Member
 
Join Date: Jun 2010
Location: Zagreb, Croatia
Posts: 4
Default Dedicated server automation

Hi all,

i wanted to make some kind of tool to reset my server if something fails.

i'm no programmer but have some basic knowledge about it. for this purpose i've used AutiIt scripting language.

It is not allowed to discus game automation on their forums so i'll share my accomplishments and troubles with u.

the script is waiting in the tray and checks if Launcher program is running. if not it runs it and sends commands to load and start map cycle.

it also checks for error windows, closes them and restarts the server.

it works fine most of the times just did not cache all the errors windows that can aper that needs to be closed.

here is the script:

Code:
AutoItSetOption ("TrayIconDebug", 1);0-off
While 1 = 1
	While WinExists ("Launcher") > 0 ; if window exists ...
		While WinExists("Steam Connection") > 0 ; check if this windows exists and close
			WinActivate("Steam Connection")
			Send("{ENTER}")
			Sleep (500)
		WEnd
		While WinExists("Steam Connection Error") > 0 ; check if this windows exists and close
			WinActivate("Steam Connection Error")
			Send("{ENTER}")
			Sleep (500)
		WEnd
		While WinExists("Error") > 0 ; check if this windows exists and close
			WinActivate("Error")
			Send("{ENTER}")
			Sleep (500)
		WEnd
		While WinExists("Steam - Self Updater") > 0 ; check if this windows exists and close
			WinActivate("Steam - Self Updater")
			Send("{ENTER}")
			Sleep (500)
		WEnd
		While WinExists("Steam - Shutdown") > 0 ; check if this windows exists and close
			WinActivate("Steam - Shutdown")
			Send("{ENTER}")
			Sleep (500)
		WEnd
		Sleep (60000) ; check again in a minute
	WEnd
; if window does not exist
	ShellExecute("Launcher.lnk")
	WinActivate("Launcher")
	Sleep(10000)
	WinActivate("Launcher")
	Send("{ENTER}")
	Send("f start.cmd")
	Send("{ENTER}")
WEnd
i'm not going to explain how AutoIt works. please google it, RTFM , and try to understand it. it is quite simple.

would like to get some good ideas how to make it better. specially from programmers.
Reply With Quote