Civ4 Pitboss Launcher - For Pitboss players

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
I've been hosting a Pitboss game that I've been playing with several friends for a few months now. Every single day I have had to launch Civ 4, go to Multiplayer, go to Direct IP, enter the server information, connect, select my leader, enter my password, and then FINALLY load the game so I can play my turn.

I looked around for a way to connect directly to a server by using command line options, but I couldn't find any.

So I made this. It's a program that automatically launches Civ 4 and clicks through the menus to get you connected to your Pitboss server. It has several features such as the ability to have multiple profiles for different Pitboss games.

It's written in the AutoIt scripting language, and the source code is included so you can be sure there's no foul play. :)

Download
Download version 2.5 here.

Notes
I have only tested this on Windows XP with an English version of Civ 4.
Please post any problems you have here.
IF you get a crash or something doesn't work properly, please modify your PitbossLauncher.ini file and change LogLevel to 3. Run the program again and then post the contents of your log here. Warning: you should edit out your server address and passwords from the log file if you do this.

Here's the full readme. Please read it, especially the troubleshooting section!
Code:
OVERVIEW
--------
This program will assist you in connecting to Pitboss servers via "Direct IP."
You enter all the details about your Pitboss game in to the GUI, and this
program will automatically launch Civilization 4, connect to the server, select
your leader, enter your password, and get in to gameplay.


FEATURES
--------
* Multiple profile support - You can define multiple profiles if you are
  playing in multiple Pitboss games.
* Option to remember game and player passwords - If you don't want your
  password stored in the PitbossLauncher.ini file, you don't have to.
* Support for 5 resolutions currently: 1024x768, 1280x960, 1280x1024, 1440x900,
  1680x1050
* Works with Warlords
* Mod support


INSTALLATION
------------
Simply extract the PitbossLauncher.zip archive to any folder on your computer.
Run PitbossLauncher.exe! When you click Go, do not move the mouse at all until
the process is finished. Be patient; it can take up to 16 seconds on the main
menu before it goes to work.


TROUBLESHOOTING/NOTES
---------------------
* If you use a resolution that is not supported, feel free to request that
  support for it be added on the CivFanatics forums.
* There is absolutely no way to tell if Civ 4 is actually finished loading
  before this programs starts clicking the mouse. I tried to err on the side of
  caution, so it might wait a little longer than it needs to before it starts
  clicking things. Currently it waits about 10 seconds after the Civ 4 window
  is detected.
* If the script is not waiting long enough for the game to load (if this
  happens your mouse will probably be moving around in Windows instead of the
  game) you can change the "SecondsToLoad" option in the PitbossLauncher.ini
  file to something higher. The default is 10.
* Similarly, if the script is not waiting long enough for the "choose your
  leader" window to pop up (after connecting to the server) you try increase
  the "SecondsToConnect" options in the PitbossLauncher.ini file.
* If the process for some reason gets off track and the wrong buttons are being
  pressed, simply press Escape - that will abort the script.
* If you turn on the "Go on Launch" option, you can still get to the GUI by
  holding down shift when you launch the program.



CHANGELOG
---------
2.5.0.0
+Added Beyond the Sword support. It works the same way Warlords does; if you
 want to just launch BtS without a mod, select "(BtS) None" from the mod list.
 
2.1.0.0
+Added the ability to directly launch a particular profile by adding the
 profile name as a command line parameter. The profile name must be enclosed
 in double quotes, "like so." The profile name is case sensitive.
+Added a button in the GUI to create a shortcut for you that will directly
 launch the profile selected.
+Added a "ExeOverride" variable for each profile that can be used to make a
 certain profile use an exe that is different from the rest of the profiles.
 This is for people who maintain multiple installations of Civ4 so that they
 can connect to servers running different versions.

2.0.0.0
+Added Warlords support in the form of a "mod" - in the mod dropdown, you will
 notice that there are several mods that say "(Warlords)" in front of them.
 Those are all Warlords mods. To run Warlords without a mod, choose the
 "(Warlords) None" option.
+Made it so that it does not try to click through the movies if a mod is
 loaded, since the intro movies do not play when a mod is loaded. This speeds
 up the process by several seconds.
+Made a tweak that allows the legal screen to be clicked through. This speeds
 up the whole process by a couple seconds.

1.9.1.0
+Added support for resolution 1680x1050. Thanks portuga!

1.9.0.2
+Added mod support! You can now select a mod for each profile.
+Added an extra click after you connect that will clear the "Modified Assets
 Warning" - clicking on that spot when the window doesn't appear does not cause
 any harm, so there was no reason not to add this, for the people who are using
 modified assets.

1.6.1.0
+Added the ability to hold down shift when launching the program to prevent the
 "Auto Go" feature.
=REALLY Fixed the bug that caused "Auto Go on Launch" to crash the script.

1.6.0.0
=Fixed a bug that caused "Auto Go on Launch" to crash the script.
=Updated the AutoIt engine to 3.1.1.125 BETA so I could use some of the nifty
 new tray icon features. The tray icon will now only appear when you actually
 start the process, and it will no longer have the "pause" option.
=A few other minor improvements related to the update.

1.5.1.0
+Added the profile selection stuff to the main interface and got rid of the
 Profiles button. It's now faster and easier to switch profiles.
+Added detection code for the window that pops up if you have fullscreen set to
 "ask" - it will now wait for you to manually select what you want instead of
 complaining about the resolution.
+Added detection code for the "Please insert CD" window so the script will exit
 if it finds that window.
=Moved all the strings to global variables to make localization easy. You know,
 just in case.

1.2.0.0
+Added the "SecondsToConnect" option to the PitbossLauncher.ini file and also
 increased the default value from 5 seconds to 8 seconds.

1.1.0.0
+Added support for 1440x900
+Added the "SecondsToLoad" option to the PitbossLauncher.ini file

1.0.0.4
=Initial Release

Here's a screenshot of the UI:
 

Thrar

King
Joined
Nov 3, 2003
Messages
768
This sounds very useful, thanks!
Can you add support for 1440x900 resolution? Does it make a difference if it's used in windowed mode or not?
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
My monitor doesn't support 1440x900, so if you want support added I need some screenshots from you.

I need a screenshot of:
The main menu
The main menu after you click "Multiplayer"
The window that pops up after you click "Direct IP Game"
The "Leader Select" window that pops up after you connect to a direct IP game.
And finally, the password window that pops up after you select what leader you want to play.

Please take all of these screenshots in full screen mode, as I need the exact coordinates and they're harder to get in window mode.

However, when using this tool normally, you can run in window mode or full screen; it works with either.
 

Thrar

King
Joined
Nov 3, 2003
Messages
768
here you go, I hope this works. :)
 

Attachments

  • 1440x900-1.zip
    398.2 KB · Views: 414
  • 1440x900-2.zip
    445.2 KB · Views: 378

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
Okay, I just uploaded version 1.1 that has support for 1440x900. :)

Give it a try and tell me if it works! Remember to read troubleshooting before launching it - it's important to know that ESC aborts it in case it starts moving the mouse around in the wrong places.

And to fully test the resolution, please try it with player number 16 - that will be sure it can properly scroll down the list of leaders.
 

Thrar

King
Joined
Nov 3, 2003
Messages
768
unfortunately, no. :(
It moves the mouse to the middle right side (probably coordinates 0,450), both in windowed and full screen mode. Other than that, nothing happens. :-/
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
Strange. The first thing it does after it detects a window is wait 10 seconds. Then it clicks 10 times on the left-middle side of the screen to make sure all the movies are skipped (with a few extra clicks for good measure) - it does it on the left middle to be sure it doesn't accidentially click any menus with the extra clicks.

Those 10 clicks take about 6 seconds to execute, and then it should start clicking on the menu options (starting with "Multiplayer")

Could it be you didn't wait the 6 seconds for it to skip all the movies? I can't imagine why it would move the mouse in the beginning and then not click on anything else...
 

Thrar

King
Joined
Nov 3, 2003
Messages
768
You're right, it does continue after waiting a while. Sorry, I didn't know about that and wasn't very patient I guess.
It works well now, most of it. However, it apparently has some problems selecting the correct leader from the list. The first couple of times I tried it moved the mouse a bit while still connecting, then just pressed OK without selecting the leader. Maybe you should increase the waiting time for the connection a little bit? After two or three tries it was ok, though.
I also tried selecting Civ #18, works like a charm! This can really save a lot of hassle, thanks a lot! :)
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
Ah, okay I was worried that the wait when connecting to the server might not be long enough. My pitboss server is running inside my home network so my connection time is very quick - I wasn't sure how long it takes for a typical Internet user. I will increase the delay and make it configurable like I did for the 10 second delay at the beginning.
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
Okay, I just uploaded a new version. Same link.

The default "Time to Connect" is now 8 seconds instead of 5, and it's also configurable by modifying the PitbossLauncher.ini file.
 

the oob

Retired PTBS host
Joined
Nov 5, 2005
Messages
1,004
Location
Auckland, New Zealand
One minor problem, if you have Civ 4 set up so it asks you if you want fullscreen or windowed mode (in CivilizationIV.ini):

Code:
; Specify whether to play in fullscreen mode 0/1/ask
FullScreen = ask

then the launcher detects the prompt window as the Civ 4 window and complains about the resolution.

I don't care myself since I never use windowed mode anymore anyway, so I just set it back to 1, just thought you might like to know.

A combobox to select the profile (instead of a seperate screen) would also be nice.

Other than that it works great, thanks :)
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
the oob said:
One minor problem, if you have Civ 4 set up so it asks you if you want fullscreen or windowed mode (in CivilizationIV.ini)

Ah! I didn't even know about that option.

I just uploaded version 1.5.
The profiles stuff is now moved to the main GUI instead of its own window, and I also added detection code for that "ask" window. The screenshot above has been updated to show the new design.
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
New version uploaded: 1.6.1.0

A couple small changes to the way the systray icon works, and more importantly a bug fix that makes it not crash when you select the "Go on Launch" option.

Oh, and you can now hold down shift when launching the program to prevent it from automatically "Going on Launch".
 

mickeyj

Warlord
Joined
Sep 29, 2003
Messages
129
Location
London
Excellent, I've been waiting for something like this! I find it really annoying that If playing more than one pitboss game you have to retype all the info.
 

astrologix

Chieftain
Joined
Jun 11, 2002
Messages
32
Location
Switzerland
Good job OverloadUT !!!

It would be great if your tool could work with the mods too. I am currently playing a pitboss game with the Desert War mod. Your program does stop when Civ4 asks for restarting the game with the mod.

:)
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
andy_smaga - Try downloading it again, and if that doesn't work, download it with a different browser. I've seen this happen lots of times across the web - sometimes downloads just get corrupted.

astrologix - Adding mod support has been on my To-Do list for a long time now. I've gotten sidetracked by my other Civ project, but I'll see if I can get mod support working tonight. Does anyone know what the command line argument is for running a mod?
 

Thrar

King
Joined
Nov 3, 2003
Messages
768
OverloadUT said:
Does anyone know what the command line argument is for running a mod?

mod="mod directory here". Funny thing is that you need to have that first " there (or a blank, or anything else), or it cuts off the parameter's first character. You don't need the final ", however... :crazyeye:

I've only used this with the HoF mod (so that's mod="HOF-1.61.003"), not sure how to specify other folders or what it does to blanks, maybe you'll need the closing " then, after all.
 

OverloadUT

Stats Monkey
Joined
Nov 9, 2005
Messages
352
Location
Novato, CA
Sorry it took so long, but here it is finally:

New version released!
Mod support added

This new version has two new features:
Mod support! You can select a mod for each profile and it will automatically load it.
I added a click for the "Modified Assets" warning that can appear after you connect to the server. This should be useful for people who use modified assets.
 
Top Bottom