<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ucgohost.com/index.php?action=history&amp;feed=atom&amp;title=User%3AFelix%2FMacros</id>
	<title>User:Felix/Macros - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ucgohost.com/index.php?action=history&amp;feed=atom&amp;title=User%3AFelix%2FMacros"/>
	<link rel="alternate" type="text/html" href="https://wiki.ucgohost.com/index.php?title=User:Felix/Macros&amp;action=history"/>
	<updated>2026-07-01T10:31:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.11</generator>
	<entry>
		<id>https://wiki.ucgohost.com/index.php?title=User:Felix/Macros&amp;diff=1275&amp;oldid=prev</id>
		<title>Felix: Created page with &quot;This page contains the suite of macros I created for use with UCGO, running with [https://www.autohotkey.com/ AutoHotKey] software.  It could probably be optimized a bit, but...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.ucgohost.com/index.php?title=User:Felix/Macros&amp;diff=1275&amp;oldid=prev"/>
		<updated>2023-02-17T05:59:14Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page contains the suite of macros I created for use with UCGO, running with [https://www.autohotkey.com/ AutoHotKey] software.  It could probably be optimized a bit, but...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page contains the suite of macros I created for use with UCGO, running with [https://www.autohotkey.com/ AutoHotKey] software.  It could probably be optimized a bit, but it works as-is.&lt;br /&gt;
&lt;br /&gt;
The script in full is at the end of the page, but first I&amp;#039;ll go block by block to explain what each bit does.  For more in-depth information, the documentation within AHK is very useful.&lt;br /&gt;
&lt;br /&gt;
== Header ==&lt;br /&gt;
Some of these lines are commented already and provided by the software itself, and therefore need no explanation, like the first two lines.&lt;br /&gt;
&lt;br /&gt;
 #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.&lt;br /&gt;
 #Warn  ; Enable warnings to assist with detecting common errors.&lt;br /&gt;
&lt;br /&gt;
I have never gotten anything thanks to #Warn, but YMMW.&lt;br /&gt;
&lt;br /&gt;
 #SingleInstance, Force&lt;br /&gt;
 #Persistent&lt;br /&gt;
&lt;br /&gt;
The first line here is protection for if you accidentally reopen the script while you already have it running (in case you don&amp;#039;t realize it&amp;#039;s up, if you forgot to close it).&lt;br /&gt;
* There&amp;#039;s only a &amp;#039;&amp;#039;&amp;#039;single instance&amp;#039;&amp;#039;&amp;#039; of the script allowed, no duplicates.&lt;br /&gt;
* Instead of opening a dialog box to ask you what you want it to do, it will simply &amp;#039;&amp;#039;&amp;#039;force&amp;#039;&amp;#039;&amp;#039; the original script to close, effectively the same as reloading the script.&lt;br /&gt;
The second line just says the script won&amp;#039;t automatically exit unless you specifically tell it to - it will stay open and wait for you to hit hotkeys.&lt;br /&gt;
&lt;br /&gt;
 SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.&lt;br /&gt;
 SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.&lt;br /&gt;
&lt;br /&gt;
The above lines were placed in the script by default, and I haven&amp;#039;t touched them (yet).  Now, onto the part I wrote.&lt;br /&gt;
&lt;br /&gt;
== Ctrl Shift 1: Mining Loop ==&lt;br /&gt;
&lt;br /&gt;
 ^+1::  ; miner&lt;br /&gt;
&lt;br /&gt;
The very first part of any AHK command (when you&amp;#039;re using a hotkey-based setup and not something that auto-runs) is the hotkey itself.  In this case:&lt;br /&gt;
* ^ is the Ctrl key&lt;br /&gt;
* + is the Shift key&lt;br /&gt;
* 1 is simply the number 1&lt;br /&gt;
* :: is the separator between the hotkey and the code you&amp;#039;re writing, which in this case is on the next line.&lt;br /&gt;
Comments in AHK are put behind semicolons, which can come at the front of a line or after whitespace after code as in this case.&lt;br /&gt;
&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
If a window named &amp;quot;UCClient&amp;quot; doesn&amp;#039;t exist (that&amp;#039;s UCGO, of course), then display a little text messagebox so I know I did something wrong, and don&amp;#039;t go any further.  Otherwise...&lt;br /&gt;
&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
&lt;br /&gt;
First, activate the window (bring it to the front so it gets clicks instead of any other applications that are running).&lt;br /&gt;
&lt;br /&gt;
 while WinActive(&amp;quot;UCClient&amp;quot;) and !GetKeyState(&amp;quot;q&amp;quot;)  ; hold Q to terminate at the end of a loop&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
It is very important that if you run things in a loop, you give yourself a way to break out of it.  This loop only runs &amp;#039;&amp;#039;&amp;#039;while&amp;#039;&amp;#039;&amp;#039; two things are BOTH true:&lt;br /&gt;
* UCGO is active (in front), AND&lt;br /&gt;
* the Q key is &amp;#039;&amp;#039;not&amp;#039;&amp;#039; true (it&amp;#039;s not pressed).&lt;br /&gt;
However, it only checks those two conditions at the start of a new loop.  I could make it check with each operation, but that would be a lot more code and I didn&amp;#039;t feel like it.&lt;br /&gt;
&lt;br /&gt;
 Click, 421 1037 ; get bar&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Send /mine{Enter}&lt;br /&gt;
&lt;br /&gt;
In these three statements you find the vast majority of what makes up the rest of the script, which will prevent me from needing to explain a lot more.&lt;br /&gt;
* The first line clicks the mouse at x/y coordinates, which happen to be the text input bar, thus the comment.&lt;br /&gt;
* The second line waits (sleeps) for 0.15 seconds (times given are in milliseconds).&lt;br /&gt;
* The third line &amp;#039;&amp;#039;&amp;#039;sends&amp;#039;&amp;#039;&amp;#039; text to the program - UCClient - in this case the literal text string &amp;lt;code&amp;gt;/mine&amp;lt;/code&amp;gt; and then the Enter key.&lt;br /&gt;
&lt;br /&gt;
 Sleep 12500 ; wait for mining&lt;br /&gt;
&lt;br /&gt;
After mining, you wait.  Roughly 12.5 seconds works for me, but this may need to be adjusted based on your internet.&lt;br /&gt;
&lt;br /&gt;
 Click, 1063 577 ; OK (1 item)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 586 ; OK (2 item)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 595 ; OK (3 items)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 604 ; OK (4 items)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 613 ; OK (5 items)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 622 ; OK (6 items)&lt;br /&gt;
&lt;br /&gt;
This section clicks multiple times to accept the results of mining.  Since you may get a different number of items after mining, depending on your luck and how full your inventory is, I mapped out the location of the OK button from 1 to 6 items - or rather I did it at I think 3, 4, and 5 and noticed they were 9 pixels apart and then extrapolated the other positions accordingly.  Math is fun.&lt;br /&gt;
&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
&lt;br /&gt;
And that&amp;#039;s the end of the loop, and the statement itself; you hit the return once you&amp;#039;re out of the loop.  You may notice I use &amp;#039;Sleep 150&amp;#039; a lot between actions.  Clicking multiple times with a 0ms break seemed like a bad idea to me as it might trigger some sort of anti-cheat protection, so I decided to save myself some heartache ahead of time, just in case.  You&amp;#039;re welcome to remove those lines if you&amp;#039;re feeling adventurous though.&lt;br /&gt;
&lt;br /&gt;
== Ctrl Shift 2: Refining Loop ==&lt;br /&gt;
&lt;br /&gt;
 ^+2::  ; smelt 10x loop&lt;br /&gt;
&lt;br /&gt;
All of the hotkeys are Ctrl+Shift+(something), so here&amp;#039;s 2, for refining.&lt;br /&gt;
&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
 while WinActive(&amp;quot;UCClient&amp;quot;) and !GetKeyState(&amp;quot;q&amp;quot;)  ; hold Q to terminate at the end of a loop&lt;br /&gt;
 {&lt;br /&gt;
&lt;br /&gt;
All the same headers and conditions as the first one, for consistency.&lt;br /&gt;
&lt;br /&gt;
 Click, 971 150 2 ; open factory&lt;br /&gt;
 Sleep 150&lt;br /&gt;
&lt;br /&gt;
For all the building interactions, you need not just x/y coordinates, but also the number of clicks to be 2 so you&amp;#039;re opening the UI instead of just selecting.  Obviously you also need to have your camera in a position where that x/y will actually hit the building as well.&lt;br /&gt;
&lt;br /&gt;
 Click, 453 190 ; take out 1&lt;br /&gt;
 Sleep 650&lt;br /&gt;
 Click, 453 190 ; take out 2&lt;br /&gt;
 Sleep 150&lt;br /&gt;
&lt;br /&gt;
For failed refines you need to remove both materials.  After you take out the first one, there&amp;#039;s a longer delay before the &amp;#039;take out&amp;#039; button becomes interactable again, which is why this Sleep is larger than the others.&lt;br /&gt;
&lt;br /&gt;
 Click, 453 223 ; refine&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 466 284 ; next&lt;br /&gt;
 Sleep 150&lt;br /&gt;
&lt;br /&gt;
Factories have a variety of different windows so you&amp;#039;ll need to make sure all the x/y coords are correct.  My usual monitor is 1920x1080 and I have tried not to mess with the UI window positions &amp;#039;&amp;#039;too&amp;#039;&amp;#039; much, but I know they&amp;#039;re not default any more.&lt;br /&gt;
&lt;br /&gt;
 ; START QUANT BLOCK&lt;br /&gt;
 Click, 300 260 ; select quantity&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Send 0 ; add a zero (1 -&amp;gt; 10)&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 ; END QUANT BLOCK&lt;br /&gt;
&lt;br /&gt;
There are a number of ways you could manipulate this block if you so chose, but the way it&amp;#039;s set up is for 10x refines in order to take advantage of the 1.1x refine multiplier (refine 10, get 11) while still doing a large enough number of refine operations to feel like I&amp;#039;m chipping away at my refining skills.  Normally I save this for TCC or luna; if it&amp;#039;s steel I&amp;#039;ll often do it all at once.&lt;br /&gt;
&lt;br /&gt;
 Click, 374 544 ; start&lt;br /&gt;
 Sleep 3000&lt;br /&gt;
 ; WAIT TIME VARIES&lt;br /&gt;
&lt;br /&gt;
As the note says, it&amp;#039;s hard to time this one specifically because different metals refine for different lengths of time, unlike mining.  So I just have it loop repeatedly, and catch the confirmation on the next line.  It used to be a much shorter sleep time, but I almost locked myself into a loop that way; 3 seconds allows enough time to get to the taskbar and manually pause the script (there is now a hotkey for that, you may notice).&lt;br /&gt;
&lt;br /&gt;
 Click, 1100 565 ; confirm success/fail&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
&lt;br /&gt;
No additional notes here, it&amp;#039;s the end of a loop just like any other.&lt;br /&gt;
&lt;br /&gt;
== Ctrl Shift 3: Weapon Crafting Loop ==&lt;br /&gt;
&lt;br /&gt;
(todo 3-6 and p: getting sleepy)&lt;br /&gt;
&lt;br /&gt;
== Ctrl Shift 4: MS Crafting Single ==&lt;br /&gt;
&lt;br /&gt;
== Ctrl Shift 5: MS Dismantling Single ==&lt;br /&gt;
&lt;br /&gt;
== Ctrl Shift 6: MS Crafting/Dismantling Loop ==&lt;br /&gt;
&lt;br /&gt;
== Ctrl Shift P: Pause ==&lt;br /&gt;
&lt;br /&gt;
== Full script ==&lt;br /&gt;
Copy this entire section, starting with the header, into a text file and save it as &amp;lt;code&amp;gt;any_name_you_want.ahk&amp;lt;/code&amp;gt; and you&amp;#039;ll have the script as it is on my computer.  As noted in the sections above though, you&amp;#039;ll probably need to change values and/or move windows around before it works properly for you.&lt;br /&gt;
&lt;br /&gt;
 #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.&lt;br /&gt;
 #Warn  ; Enable warnings to assist with detecting common errors.&lt;br /&gt;
 #SingleInstance, Force&lt;br /&gt;
 #Persistent&lt;br /&gt;
 SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.&lt;br /&gt;
 SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.&lt;br /&gt;
 &lt;br /&gt;
 ^+1::  ; miner&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
 while WinActive(&amp;quot;UCClient&amp;quot;) and !GetKeyState(&amp;quot;q&amp;quot;)  ; hold Q to terminate at the end of a loop&lt;br /&gt;
 {&lt;br /&gt;
 Click, 421 1037 ; get bar&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Send /mine{Enter}&lt;br /&gt;
 Sleep 12500 ; wait for mining&lt;br /&gt;
 Click, 1063 577 ; OK (1 item)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 586 ; OK (2 item)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 595 ; OK (3 items)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 604 ; OK (4 items)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 613 ; OK (5 items)&lt;br /&gt;
 Sleep 50&lt;br /&gt;
 Click, 1063 622 ; OK (6 items)&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
 &lt;br /&gt;
 ^+2::  ; smelt 10x loop&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
 while WinActive(&amp;quot;UCClient&amp;quot;) and !GetKeyState(&amp;quot;q&amp;quot;)  ; hold Q to terminate at the end of a loop&lt;br /&gt;
 {&lt;br /&gt;
 Click, 971 150 2 ; open factory&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 453 190 ; take out 1&lt;br /&gt;
 Sleep 650&lt;br /&gt;
 Click, 453 190 ; take out 2&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 453 223 ; refine&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 466 284 ; next&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 ; START QUANT BLOCK&lt;br /&gt;
 Click, 300 260 ; select quantity&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Send 0 ; add a zero (1 -&amp;gt; 10)&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 ; END QUANT BLOCK&lt;br /&gt;
 Click, 374 544 ; start&lt;br /&gt;
 Sleep 3000&lt;br /&gt;
 ; WAIT TIME VARIES&lt;br /&gt;
 Click, 1100 565 ; confirm success/fail&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
&lt;br /&gt;
 ^+3::  ; make weapon&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
 while WinActive(&amp;quot;UCClient&amp;quot;) and !GetKeyState(&amp;quot;q&amp;quot;)  ; hold Q to terminate at the end of a loop&lt;br /&gt;
 {&lt;br /&gt;
 Click, 971 150 2 ; open factory&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 438 171 ; take out&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 438 255 ; develop&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1112 790 ; next&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1160 620 ; start&lt;br /&gt;
 Sleep 3000&lt;br /&gt;
 ; WAIT TIME VARIES&lt;br /&gt;
 Click, 1080 570 ; confirm success/fail&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
 &lt;br /&gt;
 ^+4::  ; make vehicle single&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
 Click, 1109 567 ; confirm previous action&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 971 150 2 ; open factory&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1215 292 ; take out&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1215 435 ; develop&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1235 651 ; next&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 377 472 ; start&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
&lt;br /&gt;
 ^+5::  ; dismantle vehicle single&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
 Click, 1109 567 ; confirm previous action&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 971 150 2 ; open factory&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1215 370 ; dismantle&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 377 335 ; next&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
 &lt;br /&gt;
 ^+6::  ; make/dismantle vehicle&lt;br /&gt;
 if not WinExist(&amp;quot;UCClient&amp;quot;)&lt;br /&gt;
 {&lt;br /&gt;
   MsgBox faildetect&lt;br /&gt;
   return&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 WinActivate, UCClient&lt;br /&gt;
 while WinActive(&amp;quot;UCClient&amp;quot;) and !GetKeyState(&amp;quot;q&amp;quot;)  ; hold Q to terminate at the end of a loop&lt;br /&gt;
 {&lt;br /&gt;
 Click, 1109 567 ; confirm previous action&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 971 150 2 ; open factory&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1215 292 ; take out&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1215 435 ; develop&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1235 651 ; next&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 377 472 ; start&lt;br /&gt;
 Sleep 13000&lt;br /&gt;
 Click, 1109 567 ; confirm previous action&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 971 150 2 ; open factory&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 1215 370 ; dismantle&lt;br /&gt;
 Sleep 150&lt;br /&gt;
 Click, 377 335 ; next&lt;br /&gt;
 Sleep 13000&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 return&lt;br /&gt;
 &lt;br /&gt;
 ^+p::Pause&lt;/div&gt;</summary>
		<author><name>Felix</name></author>
	</entry>
</feed>