A script worthy of Shakespeare
(Messige To The TOE Revenge Is Best Served Cold)
OK. People on Team E have been yacking about some scripts and it's high time we get the entire ToE to benefit from this. Many of you will pick right up on this, but if you have any trouble Lord Arkhan and to lesser degree I can help you out. This is in no way a complete guide as my own knowledge is still somewhat limited . The original intention was to split the thread off from the one in the ET forum, but I don't have the mod power there and other conversation intermingled would only cause confusion.
1. The program you will need is at http://www.autohotkey.com/download/ and some documentation if you'd like to peruse can be found here http://www.autohotkey.com/docs/Tutorial.htm
Welcome to autohotkey, a small program that is a big help. It comes with some very helpful things
One is the window spy which can determine mouse positioning on screen. Handy for writing your own scripts or slightly adjusting a script written by another to work on your resolution.

Next is the autoscript writer. This is as simple as it gets, hit record and go about your business and when your finished you have a nice little script to repeat what you just did.
But the real fun of it is you can write simple repeating scripts to take care of a number of different things in game. This is an example of the script I am currently using to buy 650K+ worth of ships in about two minutes. This was written by LA and can be altered easily with notepad. He has even added explainations to what each part does. As you can see it is real simple.
Code:
InputBox, PlanetCount, Planets, Please enter the TOTAL amount of planets you want to autobuy with. Pressing cancel will set the default to just 1 planet.
; InputBox will open up a pop-up window and ask you to enter the number of planets you want the script to
; to by ships for. The number you enter will be stored in the variable PlanetCount which was created
; solely for the purpose of handling how many times the script will run through the loop. I did this so
; the script will do exactly the amount of planets you tell it to and finish without any interaction from
; the player whatsoever.
If ErrorLevel ; If you hit the Cancel button, PlanetCount will only run one time
PlanetCount:=1
Else
PlanetCount := PlanetCount
IfWinExist, GalCiv2: Dark Avatar v1.80g Dark Avatar ; If the Window title exists, do the following things in brackets below
{
WinActivate ; WinActivate will essentially 'Alt-tab' the game so that it's at the forefront of all other programs.
Sleep, 1500 ; Instructs the script to wait for 1.5 seconds 1000 = 1 second.
}
Loop, %PlanetCount% ; Loop that starts the series of buying starships.
{
Click 1075, 805 ; Clicks the Buy button
Sleep, 250
click 845, 655 ; Clicks the Accept button when it appears
Sleep, 250
Send "z" ; Cycles to the next planet
Sleep, 250
}
Some things to note here: The click points are set for my resolution of 1440x900. These have to be altered per resolution. That's where the windows spy comes in to determine the pixel numbers of your own click points. Also after the IfWinExist, you need to have your version of GC2 there
Also I have setup my game for this script and it can have small issues if not properly planned for. I have set it up where I can choose my Homeworld and all the planets I cycle to have starports in order, so it never goes to a planet without a starport using the z key till it is past where I stop buying ships. The script may run with no issues without this setup, but if it goes to a planet without a starport it creates a dead click where the accept button would be de-selecting the planet. This in itself is not an issue as the next z hit will still go to the next planet as usual. But if that dead click is say, on a satrbase or an enemy ships the z key will no longer work causing the script to just keep going through the motions without doing anything. That was my fix for this, planning .
So in summary the way I use it is to select my homeworld, then simply double click the .ahk file(the script) a little box will popup asking how many ships I want to buy. I input an amount hit ok and let it go.
Another good thing about the program is, it is not running till you start the script and when it finishes it's run through the program turns right back off leaving no processes running(I like programs like that )
Now onto another way to do this through the colonies list and it looks something like this:
Code:
IfWinExist, GalCiv2 v1.5
{
WinActivate
Sleep, 1500
}
quad2:=165
WdCount:=0
SleepCount:=750
InputBox, PlanetCount, Planets, Please enter the TOTAL amount of planets you want to autobuy with. This number MUST be greater than 22. Pressing cancel will set the default to 23 planets.
If ErrorLevel
PlanetCount:=1
Else
PlanetCount := PlanetCount-22
Click 101, 112
Loop, 22
{
Sleep, 750
Click 865, %quad2%
Sleep, 750
Click 640, 459
Sleep, 750
Click 638, 619
Sleep, 2800
Click 721, 461
Sleep, 750
quad2 := quad2+24
}
Loop, %PlanetCount%
{
Sleep, 750
Click 977, 671
Sleep, 750
Click %WdCount%
Sleep, %SleepCount%
SleepCount := SleepCount+10
Click 865, 668
Sleep, 750
Click 640, 459
Sleep, 750
Click 638, 619
Sleep, 2800
Click 721, 461
Sleep, 750
WdCount := WdCount+1
}
Things to note on this one is it is shown setup for LAs Resolution, therefore he has 22 planets on the screen in the colony manager at one time. On mine it is 27, so you would change all the instances indicating planetcount by +5. Of course the same goes as above for changing click coordinates.
Good thing about this script is it never screws up as long as the sleep timers are adjusted to how fast your game reacts in that screen. The reason I had to change to the other script though is because as the planet count rises the slowness of the colony manager increases and I would have to set the timers up over thirty seconds for my game, meaning 20 minutes or more for buying ships.
I hope this gets every one started with some good basic understanding. LA has got scripts to also buy planetary improvements this way as well as a few other tricks . I'm sure he'll come in and cover some of the areas I missed as I'm still learning it myself and show off some of the other things he's done with them. Happy scripting