Home » Stars! 2.6/7 » The Academy » Stars automated micromanagement
|
Re: Stars automated micromanagement |
Tue, 25 January 2011 14:31 |
|
BlueTurbit | | Lt. Commander
RIP BlueTurbit died Oct. 20, 2011 | Messages: 835
Registered: October 2002 Location: Heart of Texas | |
|
begin recording your first script: also added link to my first post.
Video 1 - step 1 begin recording your script
Video 2 - step 2 test-run your script
Video 3 - step 3 game-compatibility
Video 4 - step 4 input-boxes
this is the code for the input boxes:
Quote: | InputBox, shipno, ship type number, Enter number of ship type on list., , 300, 150
Sleep, 100
shipverify = %shipno%
; on my screen the first item on production list is at
; cursor position 25+16, the next item is 16 down, etc.
; item(ship) 3 would be 25 + (16*3) in making selection
shipno := 25 + (16 * shipno)
InputBox, planets, Number of Planets, Enter number of planets to queue., , 300, 150
Sleep, 100
InputBox, ships, number of shps to build, Enter number of ships to queue., , 300, 150
Sleep, 100
; on my screen 70 is the cursor row location for first planet on planet summary window
planetrow := 70
;MsgBox [, Options, Title, Text, Timeout]
MsgBox, 4, , .You entered ship type %shipverify%`n Build on %planets% planets`n %ships% ships on each planet`n Do you want to continue?`n (Press YES or NO)
IfMsgBox No
return
|
more videos on the way
Remember, that my computer screen is different than yours, so likely the mouse coordinates will be different on yours. Therefore, recording your own and then following my video instructions might be better.
Best to set your game window to full screen when recording and playing scripts. This will insure that your mouse coordinates will always be correct on playback of scripts. Unless you are positive you will never change screen size in game.
And also, if you can use keys instead of mouse clicks, like enter key instead of clicking on OK, this will make it easier to read the scripts and edit them, as instead of mouse coordinates you will see key names on the script.
This script will only run on the same game you recorded it for now. When we make some changes it will run on all of your games.
[Updated on: Tue, 25 January 2011 21:02]
BlueTurbit Country/RockReport message to a moderator
|
|
| |
Re: Stars automated micromanagement |
Tue, 25 January 2011 18:54 |
|
BlueTurbit | | Lt. Commander
RIP BlueTurbit died Oct. 20, 2011 | Messages: 835
Registered: October 2002 Location: Heart of Texas | |
|
neilhoward wrote on Tue, 25 January 2011 17:29 |
[email | m.a@stars[/email] wrote on Fri, 21 January 2011 12:14]Interesting!
Why aren't you using the "next" button and the "enter" key, I wonder?
|
I would love to be able to play entirely by keyboard. Is there a way to use keyboard for Queue detail? I use keyboard as much as I can, but have not discovered way of detailing the number of ships to build. My humble obeisance before a master
|
with regard to using automation,
keyboard entry recording is better, as it could be used by most other users... but when I did this it was a first idea and I just clicked away in record mode. Also keyboard entries are easier when editing the script, than mouse coordinates.
the number of ships to build is done by having the input boxes with user entry stored into variables. This comes in my next video, the input boxes.
I will post the entire routine, in text, that I used to do the part of the demo video that does the ship building. This includes the input boxes and the loops to do repeats. Just don't anyone try to run it on your screen as the coordinates will likely be different. lol
--------------------
WinWait, Stars!,
IfWinNotActive, Stars!, , WinActivate, Stars!,
WinWaitActive, Stars!,
InputBox, shipno, ship type number, Enter number of ship type on list., , 300, 150
Sleep, 100
shipverify = %shipno%
; on my screen the first item on production list is at
; cursor position 25+16, the next item is 16 down, etc.
; item(ship) 3 would be 25 + (16*3) in making selection
shipno := 25 + (16 * shipno)
InputBox, planets, Number of Planets, Enter number of planets to queue., , 300, 150
Sleep, 100
InputBox, ships, number of shps to build, Enter number of ships to queue., , 300, 150
Sleep, 100
; on my screen 70 is the cursor row location for first planet on planet summary window
planetrow := 70
;MsgBox [, Options, Title, Text, Timeout]
MsgBox, 4, , .You entered ship type %shipverify%`n Build on %planets% planets`n %ships% ships on each planet`n Do you want to continue?`n (Press YES or NO)
IfMsgBox No
return
WinWait, Stars!,
IfWinNotActive, Stars!, , WinActivate, Stars!,
WinWaitActive, Stars!,
MouseClick, left, 225, 48
Sleep, 100
MouseClick, left, 229, 57
Sleep, 100
Loop, %planets% {
WinWait, Planet Summary Report,
IfWinNotActive, Planet Summary Report, , WinActivate, Planet Summary Report,
WinWaitActive, Planet Summary Report,
MouseClick, left, 118, planetrow
Sleep, 100
MouseClick, left, 429, planetrow
Sleep, 100
WinWait, Production Queue,
IfWinNotActive, Production Queue, , WinActivate, Production Queue,
WinWaitActive, Production Queue,
MouseClick, left, 570, 44
Sleep, 100
loop, %ships% {
; double click ships and loop until all entered for the planet
MouseClick, left, 89, %shipno%
MouseClick, left, 89, %shipno%
Sleep, 100
}
MouseClick, left, 643, 559
Sleep, 100
Sleep, 100
; increment to the next row on planet summary screen to select
; next planet, on my screen it is 17 down per planet row
planetrow := planetrow + 17
}
Sleep, 300
...
[Updated on: Tue, 25 January 2011 19:15]
BlueTurbit Country/RockReport message to a moderator
|
|
| |
Re: Stars automated micromanagement |
Wed, 26 January 2011 01:57 |
|
BlueTurbit | | Lt. Commander
RIP BlueTurbit died Oct. 20, 2011 | Messages: 835
Registered: October 2002 Location: Heart of Texas | |
|
neilhoward wrote on Tue, 25 January 2011 17:57 | Blue,
I am in revision for exams now, but I will definitely try it this weekend.
|
After listening to you and Ron about suggestions using less mouse clicks, this evening I made a new version of script.
I went to AutoHotKey site and read some docs and decided to try something and it works for me, in early trials.
Only requirement is to open planet summary window first and click on first planet name you want production to start. You want to sort the list by your choice to make sure the planets come up in the order you see. The script uses the next button in production queue window to move to next planet. I believe the next order is different if you don't open the planet summary window first. And Stars window doesn't have to be full screen now.
Quote: | WinWait, Stars!,
IfWinNotActive, Stars!, , WinActivate, Stars!,
WinWaitActive, Stars!,
Sleep, 100
Send, q
WinWait, Production Queue
IfWinNotActive, Production Queue, , WinActivate, Production Queue,
WinWaitActive, Production Queue,
Send, {TAB}{HOME}{SHIFTDOWN}{TAB}{SHIFTUP}
InputBox, shiptype, ship type number, Enter number of ship/item type on list., , 350, 150
loop, %shiptype% {
Send, {DOWN}
}
Send, {UP}
InputBox, ships, number of shps to build, Enter number of ships to queue., , 350, 150
InputBox, planets, Number of Planets, Enter number of planets to queue., , 350, 150
; MsgBox [, Options, Title, Text, Timeout]
MsgBox, 4, , .You entered ship/item type %shiptype%`n Build on %planets% planets`n build %ships% on each planet`n Do you want to continue?`n (Press YES or NO)
IfMsgBox No
return
Send, {HOME}
sleep, 1000
SetMouseDelay, 0
Loop, %planets% {
WinWait, Production Queue
IfWinNotActive, Production Queue, , WinActivate, Production Queue,
WinWaitActive, Production Queue,
Send, {TAB}{HOME}{SHIFTDOWN}{TAB}{SHIFTUP}
loop, %shiptype% {
Send, {DOWN}
}
Send, {UP}
send, {TAB}{TAB}
loop, %ships% {
send, {SPACE}
}
send, {TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{SPACE}
send, {TAB}{TAB}{TAB}
Sleep, 100
}
|
edit: script modified to remove all mouse clicks
[Updated on: Wed, 26 January 2011 13:04]
BlueTurbit Country/RockReport message to a moderator
|
|
| | | |
Re: Stars automated micromanagement |
Thu, 27 January 2011 14:37 |
|
BlueTurbit | | Lt. Commander
RIP BlueTurbit died Oct. 20, 2011 | Messages: 835
Registered: October 2002 Location: Heart of Texas | |
|
If you want to test or use the autoproduction file I made without installing the AutoHotKey on your computer there is another option. The AutoHotKey program allows you to right click on its files and compile them/convert them to .exe files that other users can run without AutoHotKey installed.
I did that, and included the .ahk source file, if you have AutoHotKey and want to modify/edit it, zipped file is available for you here:
http://blueturbit.com/Starsautomate/autoproduction.zip
Download and unzip the file. Open a Stars game, open your planet summary report, click on the name of the planet you want to begin on.
Run the autoproduction.exe file. It will automatically open the production queue window for that planet and prompt you with what you want to build.
After you approve the data you entered in the first three input boxes, it will auto build that for you. Then you can go back to review the results, either by clicking on the previous button, or closing the window and viewing on your planet summary report.
I also added error trapping on the input boxes. So if you click on cancel on the first three input boxes it will abort the mission and exit.
After you get to last message box to review your orders, either approve and click on yes, or click on no to abort the entire process.
If you did lots of stuff you don't want to keep in this test, or messed up, then exit the game without saving to undo everything you added while testing. No harm done.
Note that after the production is built, it stays in the production queue window, and goes to the next planet on the list. So you can click on previous button to review all of the planets you built items on, and edit any if you wish.
[Updated on: Thu, 27 January 2011 14:40]
BlueTurbit Country/RockReport message to a moderator
|
|
|
Goto Forum:
Current Time: Thu May 02 18:03:19 EDT 2024
|