Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » Stars automated micromanagement
Re: Stars automated micromanagement Tue, 25 January 2011 12:48 Go to previous messageGo to next message
Eagle of Fire

 
Lt. Commander

Messages: 809
Registered: December 2008
Location: GMT -5
Yeah, I know that tactics and strategy (and diplomacy too!) are parts of the game which will never be automated... But I didn't mention them because they don't play any role in the point I was trying to make. Point that I think Blue still don't understand.

4X games are simply games with a lot of genres blended in the same game. If you remove MM from the game then you are left with whatever is left, which is pretty much a wargame with diplomacy added in. That would not be a 4X game anymore. And I hate wargames.

Anyways... I don't need someone to tell me how this technique save time and hassle. I saw that from the very beginning. But since it seems my point haven't even been acknowledged then I guess I have nothing more to add.



STARS! Wiki
STARS! Wiki Français
I am on a hot streak... Literally.

Report message to a moderator

Re: Stars automated micromanagement Tue, 25 January 2011 14:31 Go to previous messageGo to next message
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/Rock

Report message to a moderator

Re: Stars automated micromanagement Tue, 25 January 2011 18:29 Go to previous messageGo to next message
neilhoward

 
Commander

Messages: 1112
Registered: April 2008
Location: SW3 & 10023
m.a@stars wrote on Fri, 21 January 2011 12:14

Interesting! Twisted Evil

Why aren't you using the "next" button and the "enter" key, I wonder? Rolling Eyes


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 Not Worthy

Report message to a moderator

Re: Stars automated micromanagement Tue, 25 January 2011 18:54 Go to previous messageGo to next message
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! Twisted Evil

Why aren't you using the "next" button and the "enter" key, I wonder? Rolling Eyes


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 Not Worthy


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/Rock

Report message to a moderator

Re: Stars automated micromanagement Tue, 25 January 2011 18:57 Go to previous messageGo to next message
neilhoward

 
Commander

Messages: 1112
Registered: April 2008
Location: SW3 & 10023
Blue,
If you were Harry Kim, you would have just shaved 30 years off of Voyager's trip. This contribution is definitely deserving of recognition. I smell a Lieutenancy in the making.

I am in revision for exams now, but I will definitely try it this weekend.

Report message to a moderator

Re: Stars automated micromanagement Wed, 26 January 2011 01:57 Go to previous messageGo to next message
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/Rock

Report message to a moderator

Re: Stars automated micromanagement Wed, 26 January 2011 08:13 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
neilhoward wrote on Wed, 26 January 2011 00:29

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.

It can be done, though it's not so intuitive as with the mouse. Confused

When you enter the Queue window (by hitting the 'q' key), the left-side has the focus, so you can use the Arrow keys to navigate all the items to build there. Deal

Hit TAB once and focus shifts to the right-side, where again you can navigate thru the list with the Arrow keys. Teleport

A 2nd TAB gets the focus on the "Add" button, which you can press with either SPACE or ENTER. Repeat until done. You can also navigate the other buttons with more TABs or with the Arrow keys.

One interesting feature of the "Add" and "Remove" buttons is they can be pressed together with the "Shift" and "Ctrl" keys to work in tens and hundreds instead of single units. Very Happy

And then there's the "Next" button to take you to the next planet on the list.



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Stars automated micromanagement Wed, 26 January 2011 08:20 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
BlueTurbit wrote on Wed, 26 January 2011 07:57

I did a mouse move to position mouse cursor at top of production window. Then it does a loop and moves down in increments until mouse reads the highlighted (green on my screen) color of the ship type that the down arrow key stopped on.

Why do you need the mouse for that? Can't you use TAB to select the "Add" button and then activate it with SPACE? Sherlock

On a related note: I wonder if there's other software out there for this kind of key-pressing automation. Rolling Eyes

On another note: a nice app would be shifting planet routing to new hot-spots. That currently takes a lot of work. Asleep at cptr



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Stars automated micromanagement Wed, 26 January 2011 09:33 Go to previous messageGo to next message
BlueTurbit

 
Lt. Commander

RIP
BlueTurbit died Oct. 20, 2011

Messages: 835
Registered: October 2002
Location: Heart of Texas
[email

m.a@stars[/email] wrote on Wed, 26 January 2011 07:20]
BlueTurbit wrote on Wed, 26 January 2011 07:57

I did a mouse move to position mouse cursor at top of production window. Then it does a loop and moves down in increments until mouse reads the highlighted (green on my screen) color of the ship type that the down arrow key stopped on.

Why do you need the mouse for that? Can't you use TAB to select the "Add" button and then activate it with SPACE? Sherlock


That's correct! Thanks. I knew there was a better way. Missed that little add button and space. Maybe battle fatigue got to me. Smile So I'll change the mouse parts to tabs and spaces, and repost.

Well at least I learned how to detect screen colors with mouse. Now I can scan the map for MTs and purple wormhole demons. Rolling Eyes

EDIT: I changed the script and replaced the other script in my previous post. Much shorter now.


[Updated on: Wed, 26 January 2011 13:01]




BlueTurbit Country/Rock

Report message to a moderator

Re: Stars automated micromanagement Thu, 27 January 2011 14:37 Go to previous message
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/Rock

Report message to a moderator

Previous Topic: Wrong firing order ?
Next Topic: Windows 7: NewReports=1 in ini file
Goto Forum:
  


Current Time: Thu May 02 18:03:19 EDT 2024