Jump to content

Does AutoHotkey work with Skyrim?


Frozenwolf150

Recommended Posts

I have been searching high and low for an interface mod for Skyrim that will let me craft multiple items at once without having to repeatedly tap the "craft" key on my keyboard. I know there isn't a way to do this for Enchanting, since the game engine doesn't remember the components you selected from the previous item. However, it should work for Smithing and Alchemy since you're just tapping the same keys over and over again in order to spam craft items.

 

I looked around and found a couple of sources that suggested creating a keyboard macro, so that you can just use your custom hotkey and let it run. The safest program I found is AutoHotkey. The documentation for it said that certain games have cheat protection software that will detect repeat-command macros and ban you from the server; I'm assuming this only applies to online games, and not single-player games like Skyrim. So question is, does anyone know how to get this to work with Skyrim?

 

One of the things I want is to be able to toggle the script on, and then hold down the R (craft) key to spam craft potions. I've followed the tutorials and created some basic rapid-fire scripts, but I can only get them to work in Windows, not when the game itself is running. I'm running Skyrim in windowed mode as they have recommended, but nothing happens.

Edited by Frozenwolf150
Link to comment
Share on other sites

  • 2 weeks later...

I should mention that I finally got it to work. I've created a couple of simple macros, one for crafting and one for training weapons. I'll share them here, but keep in mind that I'm still learning my way around Autohotkey and am by no means an expert.

 

First, I wanted to be able to switch the macros on and off, so I set them to toggles. For the crafting one, I used:

Rctrl::Toggle := Toggle ? 0 : 1

However, you can designate whatever key you want that Skyrim or your mods don't already use.

 

The Alchemy section was the easiest, since I just wanted a way to hold down "R" to rapidly create hundreds of potions. This is a lot easier than having to tap the "R" key a thousand times when you've got a thousand units of home grown creep cluster, mora tapinella, and scaly pholiota. You can always set the sleep value lower if you want it to go even faster.

~R::
If Toggle = 1
Loop                
{
    GetKeyState, var, R, P
    If var = U
        Break
    Send R
    sleep 50
} 
Else
return

The next section is for Smithing, cooking, and anything else that requires you to hit "Enter" and "Y" in rapid succession. I found it especially helpful when grilling meat over the fire in Hunterborn with Campfire, since you can easily get over a thousand cuts after just one hunting expedition.

~Y::
If Toggle = 1
Loop
{
	GetKeyState, var, Y, P
	If var = U
		Break
	SetKeyDelay 0, 50, Play
	Send {Enter}{Y}
	sleep 50
}
Else
return

The one I came up with most recently is a very crude Enchanting macro. This does require SkyUI if you don't already have it, as well as a little preparation. Remove every blank item from your inventory except for the ones you want to enchant in bulk, and remove all filled soul gems except the ones you intend to use. Unfortunately, I could not figure out a way to get it to jump to or remember a specific enchantment, like Turn Undead, which would be useful to turn a profit early on. This macro will only use the first enchantment on the list, which in my case is Absorb Health. Still, it's useful for rapidly leveling up your skill, since the XP is not related to the total item value.

~X::
If Toggle = 1
Loop
{
	GetKeyState, var, X, P
	If var = U
		Break
	SetKeyDelay 50, Delay
	Send {R}
	sleep 50
	Send {Y}
	sleep 50
	Send {S}
	sleep 50
	Send {E}
	sleep 50
	Send {D}
	sleep 50
}
Else
return

I discovered it was necessary to treat each keypress separately when creating a key combo for games, otherwise it will try to produce the whole word at once, which will confuse Skyrim's crafting interface. If anyone does figure out a way to get it to select a specific enchantment, please feel free to share it.

 

Finally, here's the macro for a rapid clicker. I would make this a separate macro, instead of including it with the crafting one.

Rshift::Toggle := Toggle ? 0 : 1

~LButton::
If Toggle = 1
Loop
{
	SetMouseDelay 50
	Click down
	Click up
	If (GetKeyState("LButton","P")=0)
	Break
}
Else
return

This worked for me for one-handed and ranged weapons, but I got some weird delays with two-handed weapons, so it may be necessary to play around with the mouse delay to see what works best for you.

 

ETA: Here's a variant on the rapid-clicker if you just want to set it and forget it, so that you don't have to tape down the mouse button. I use this because I have Dynamic Things, which lets you train skills on practice dummies and archery targets. Just aim at a valid target, toggle the macro, left click once, and then walk away.

Rshift::Toggle := Toggle ? 0 : 1

~LButton::
If Toggle = 1
Loop
{
	SetMouseDelay 50
	Click down
	Click up
	If Toggle = 0
	Break
}
Else
return

To shut it off, just hit the toggle key again.

Edited by Frozenwolf150
Link to comment
Share on other sites

  • 11 months later...

Not related to AHK (though that's how I found this thread, because I was trying to see if anyone had gotten "ImageSearch" to work reliably, since I wanted it to be a sort of "auto-pilot" for following quest targets), but you mentioned the crafting thing for enchanting being impossible, and I'm pleased to say I actually just got a mod working to do just that. I only finished it a couple of days ago, and it's still got a bit more customization I want to add before releasing it, but it is at least possible, at least in a sense. I wasn't able to make it keep the selection so you could repeatedly click craft if wanted to (and thus could automate it from there how you want), but rather I added a "Mass Crafting" input box that asks how many copies of the enchanting process you'd like to perform and then does everything at once. (It doesn't let you do anything you couldn't already do; it only lets you skip the tedious menu flipping by doing it all at once.) If you'd be interested in that, I can post a link here when I get around to uploading it.

Link to comment
Share on other sites

  • 4 months later...

Not related to AHK (though that's how I found this thread, because I was trying to see if anyone had gotten "ImageSearch" to work reliably, since I wanted it to be a sort of "auto-pilot" for following quest targets), but you mentioned the crafting thing for enchanting being impossible, and I'm pleased to say I actually just got a mod working to do just that. I only finished it a couple of days ago, and it's still got a bit more customization I want to add before releasing it, but it is at least possible, at least in a sense. I wasn't able to make it keep the selection so you could repeatedly click craft if wanted to (and thus could automate it from there how you want), but rather I added a "Mass Crafting" input box that asks how many copies of the enchanting process you'd like to perform and then does everything at once. (It doesn't let you do anything you couldn't already do; it only lets you skip the tedious menu flipping by doing it all at once.) If you'd be interested in that, I can post a link here when I get around to uploading it.

Did you finish your mod?

 

I am sick and tired of tempering armor and weapons...

Link to comment
Share on other sites

I should mention that I finally got it to work. I've created a couple of simple macros, one for crafting and one for training weapons. I'll share them here, but keep in mind that I'm still learning my way around Autohotkey and am by no means an expert.

 

First, I wanted to be able to switch the macros on and off, so I set them to toggles. For the crafting one, I used:

Rctrl::Toggle := Toggle ? 0 : 1

However, you can designate whatever key you want that Skyrim or your mods don't already use.

 

The Alchemy section was the easiest, since I just wanted a way to hold down "R" to rapidly create hundreds of potions. This is a lot easier than having to tap the "R" key a thousand times when you've got a thousand units of home grown creep cluster, mora tapinella, and scaly pholiota. You can always set the sleep value lower if you want it to go even faster.

~R::
If Toggle = 1
Loop                
{
    GetKeyState, var, R, P
    If var = U
        Break
    Send R
    sleep 50
} 
Else
return

The next section is for Smithing, cooking, and anything else that requires you to hit "Enter" and "Y" in rapid succession. I found it especially helpful when grilling meat over the fire in Hunterborn with Campfire, since you can easily get over a thousand cuts after just one hunting expedition.

~Y::
If Toggle = 1
Loop
{
	GetKeyState, var, Y, P
	If var = U
		Break
	SetKeyDelay 0, 50, Play
	Send {Enter}{Y}
	sleep 50
}
Else
return

The one I came up with most recently is a very crude Enchanting macro. This does require SkyUI if you don't already have it, as well as a little preparation. Remove every blank item from your inventory except for the ones you want to enchant in bulk, and remove all filled soul gems except the ones you intend to use. Unfortunately, I could not figure out a way to get it to jump to or remember a specific enchantment, like Turn Undead, which would be useful to turn a profit early on. This macro will only use the first enchantment on the list, which in my case is Absorb Health. Still, it's useful for rapidly leveling up your skill, since the XP is not related to the total item value.

~X::
If Toggle = 1
Loop
{
	GetKeyState, var, X, P
	If var = U
		Break
	SetKeyDelay 50, Delay
	Send {R}
	sleep 50
	Send {Y}
	sleep 50
	Send {S}
	sleep 50
	Send {E}
	sleep 50
	Send {D}
	sleep 50
}
Else
return

I discovered it was necessary to treat each keypress separately when creating a key combo for games, otherwise it will try to produce the whole word at once, which will confuse Skyrim's crafting interface. If anyone does figure out a way to get it to select a specific enchantment, please feel free to share it.

 

Finally, here's the macro for a rapid clicker. I would make this a separate macro, instead of including it with the crafting one.

Rshift::Toggle := Toggle ? 0 : 1

~LButton::
If Toggle = 1
Loop
{
	SetMouseDelay 50
	Click down
	Click up
	If (GetKeyState("LButton","P")=0)
	Break
}
Else
return

This worked for me for one-handed and ranged weapons, but I got some weird delays with two-handed weapons, so it may be necessary to play around with the mouse delay to see what works best for you.

 

ETA: Here's a variant on the rapid-clicker if you just want to set it and forget it, so that you don't have to tape down the mouse button. I use this because I have Dynamic Things, which lets you train skills on practice dummies and archery targets. Just aim at a valid target, toggle the macro, left click once, and then walk away.

Rshift::Toggle := Toggle ? 0 : 1

~LButton::
If Toggle = 1
Loop
{
	SetMouseDelay 50
	Click down
	Click up
	If Toggle = 0
	Break
}
Else
return

To shut it off, just hit the toggle key again.

 

Thank you so much for doing all the hard work. I have modified the Macro to suit my needs:

 

 

#IfWinActive ahk_class Skyrim
Rctrl::Toggle := Toggle ? 0 : 1

~ö::
If Toggle = 1
Loop
{
	GetKeyState, var, ö, P
;	If var = U
	If Toggle = 0
		Break
	SetKeyDelay 10, 150, Play
	Send {E}
	sleep 150
	Send {R}
	sleep 150
	Send {Enter}
	sleep 150

}
Else
return

using ö as activator because I use a german keyboard, running the macro still deactivated, tempering all my armor in just the time it takes.

Link to comment
Share on other sites

I make no promises this will work perfectly or that it will work with the most recent version of Ordinator by EnaiSaion, but here's the link. Some quick notes: the idea behind this mod is that it adds a menu when you activate an enchanting table. If you answer yes (you want to do mass enchanting), then it will take a few seconds (several, in fact, it's the best that's possible, I think) to sort through your inventory. Then, when you enchant something, it'll ask how many more instances of that same enchantment you'd like to perform, up to the number you could actually manage.

 

However, this *only* works for enchanting. It doesn't have any system in place to handle smithing or tempering. I could definitely look into how to manage that in the same basic way, but it would be tricky.

 

https://docs.google.com/uc?export=download&id=0B-cZn2P5m-lYd1pGRTlOT0xYaGs

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...