Space Engineers

Space Engineers

View Stats:
Operation40 Apr 20, 2014 @ 5:32am
AutoHotKey - scripts
Well, hope this isn't considered cheating or anything, but given the lack of macros and grouping in the console control panel, I decided to give AutoIt a shot -- had trouble getting the ImageSearch dll to work, then found out about AutoHotKey..

As a proof of concept, I've created a simple script that turns all the drills off on a control panel, bound to Win+D.. It does it by finding the "Drill" graphic, then the "Off" button.. And does work for anything starting with the word "Drill", like Drill 1, Drill 2, etc or even "Drill Front or Drill Back".. It does not scroll yet :( though have a few ideas how to do that..

This works similar to other ImageSearch scripts, in that you have to take a screenshot at your resolution, crop out the "Drill" graphic and save to the script directory -- this becomes the graphic it searches for (then similar for the "off" button)..

Next steps: create a small GUI that can brought up in-game to "record" macros and save them, including ability to box out buttons at whatever your game resolution is running at (to automate the process of getting screen shots and cropping them)..

As usual: No warrenty is expressed, implied, etc.. I'm not responsible for anything at all anywhere, any time. https://github.com/pilnomi/SEScripts

< >
Showing 1-11 of 11 comments
Johari Apr 20, 2014 @ 5:34am 
Cool beans.
In the script, is that VB? Looks like it.
Last edited by Johari; Apr 20, 2014 @ 5:35am
Operation40 Apr 20, 2014 @ 5:41am 
AutoHotKey employs it's own language.. it uses curly brackets, more like java or c.. but doesn't require semicolons (semicolons start a remark here actually).. easy enough to learn, it's quite similar to other script engines I've worked with..

lots of junk hard coded in there - like the path to the images, so if you want to try it, you'll need to edit the script (exe probably won't work for you for this reason).. I'll get that fixed shortly
Last edited by Operation40; Apr 20, 2014 @ 5:45am
Marek Rosa  [developer] Apr 20, 2014 @ 6:28am 
Nice :)
kaiyl_kariashi Apr 20, 2014 @ 12:08pm 
Yeesh, I haven't had to use that since UCGO (mining was entirely manual and required you to right click the target and pick Drill every ~45 seconds for HOURS to get even a tiny bit of resources). (though most people automated the entire production process due to how mind numbingly boring and time consuming it was)

It is a pretty easy to use program though.
Last edited by kaiyl_kariashi; Apr 20, 2014 @ 12:10pm
Operation40 Apr 20, 2014 @ 3:07pm 
so just updated the repository..
ini file added and some scripting supported, lots of bugs fixed as I learn Autohotkey (most involved using an "=" instead of ":=" ergh.. )
All this can be done in the ini now:
+ can add Buttons and declare various attributes (other than drill if you want)
+ can create limited scripts with the following commands:
-- LoopButton - starts a loop cycle where buttons are clicked (nesting not supported for now)
-- FindButtonAndClick - finds button on the screen starting at x0,y0 and clicks
-- FindNextButtonAndClick - find button + retain previous (y) position so it finds the "next" one on the screen
-- EndLoopButton - ends the loop cycle where buttons are clicked

still only the "drilloff" script is in there.. and it still doesn't scroll .. and no gui yet, but had to do this stuff to get ready for that.. New exe is "SEScriptMain.exe"
Last edited by Operation40; Apr 20, 2014 @ 3:27pm
Operation40 Apr 21, 2014 @ 3:53pm 
-Added simple gui to display messages on screen
-LoopButton is recursive now so should support nesting loops (havent tested)

-New script commands:
-+ActivateWindow - finds target window as defined in ini file *does not work in compiled exe for some reason?*
-+SendKeyifbuttonnotexists - send key only if target graphic does not exist
-+Sleep - pause in the script
-+MouseMove - move the mouse
-+MouseWheelScroll - clicks an image on the screen (scroll bar) and uses the mousewheel to scroll at a set interval
-+DragScrollBar - click and hold scroll bar graphic and drag up or down (positive or negative increments)
WabbaCat Apr 21, 2014 @ 6:40pm 
good job doing this... I have alot of experience with autohoykey myself.

I do have a question tho... it has not yet even occured to me to bother making any macros for this game, as I do not see any point.
Whats the utility to binding these drills in such a way when you can simply choose "drill" as your active weapon/tool, and left click to activate?

as proof of concept, I applaud you tho. I can see this being useful for other things eventually.
Fury6 Apr 21, 2014 @ 11:30pm 
Originally posted by JackInTheCrack:
[...]it has not yet even occured to me to bother making any macros for this game, as I do not see any point.
Whats the utility to binding these drills in such a way when you can simply choose "drill" as your active weapon/tool, and left click to activate?[...]

So that you don't have to keep holding down the mouse-button or keyboard key to keep the drills running.

If you have more than about 4 drills it starts to get way too tedious to keep having to switch them on/off individually in the UI. I have a rig with 52 points on it, ain't gonna be doing those individually.

I can do fine without AutoHotKey so far as my keyboard is configurable/programmable but some method of being able to toggle multiple selected systems on/off with a keypress is going to be absolutely necessary for the more complex machinery/system designs.
Last edited by Fury6; Apr 21, 2014 @ 11:31pm
Operation40 Apr 22, 2014 @ 1:31am 
started this cause it's a pain to shutoff the drills on my platform (15 of them and planning for more).. I prefer to just hit "y" when I can, but sometimes stuff happens lol..
now I'm seeing other uses for a "screen-shot" based macro recorder (vs the traditional pixel coordinate-based recorder)... I may use this for automation for other stuff, especially when I get the GUI up to snuff..

*edit*: also, I literally picked up AHK for the first time the day I made my first post on this topic (4/20 !) I have years of experience in c,vb,java, and scripting like asp,js,php,bash,perl,etc but there are a few gotchyas in ahk - so if anyone sees anything that I could improve upon, let me know, thanks!
Last edited by Operation40; Apr 22, 2014 @ 5:51am
Blaank Jul 17, 2015 @ 6:23am 
Searching for a thread I found way back not turning up anything. This is best result. I saw a thread where a guy asked for an autohotkey script to toggle on and off m1. Someone gave him an autofire script. He corrected them. Someone submitted a toggle script. Another person refined the script and that is what I'm currently using. http://pastebin.com/2810FQrg This is it here. What I'm looking for was the autofire one earlier in that thread. End goal is to get an autohotkey script that will let me toggle on and off spamming the R button 4 times per second. I was going to edit that autofire one and substitute some keys around.
Phade Jul 17, 2015 @ 6:29am 
Originally posted by Blaank:
Searching for a thread I found way back not turning up anything. This is best result. I saw a thread where a guy asked for an autohotkey script to toggle on and off m1. Someone gave him an autofire script. He corrected them. Someone submitted a toggle script. Another person refined the script and that is what I'm currently using. http://pastebin.com/2810FQrg This is it here. What I'm looking for was the autofire one earlier in that thread. End goal is to get an autohotkey script that will let me toggle on and off spamming the R button 4 times per second. I was going to edit that autofire one and substitute some keys around.

This thread is a year old.
< >
Showing 1-11 of 11 comments
Per page: 1530 50

Date Posted: Apr 20, 2014 @ 5:32am
Posts: 11