Titan Quest Anniversary Edition - Auto Move, Attack and Pickup + Auto Buy Potions

Post gaming related scripts
User avatar
Hajin
Posts: 48
Joined: 13 May 2016, 09:16

Titan Quest Anniversary Edition - Auto Move, Attack and Pickup + Auto Buy Potions

18 Nov 2020, 08:58

My old topic:
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=18039
The new game(in its 2.9 version with the Ragnarok and Atlantis expansions) came with control improvements, my script is only if you want to decrease the frequency of using the left mouse button to move the character, attack the monsters and pick up the items.
The script basically in its main function (Auto MoveAttackPickup) uses the left mouse button repeatedly for you and in this case you just need to move the cursor to the target.
Usually the script solves that problem of the player getting tired of using the left mouse button, in some cases it can even avoid tendonitis.
I think this script is more useful to characters that attack in short range but can be used with characters in long distance too, with characters that attack only using pets I don't even use the "Auto Move Attack and Pickup" function to attack.



Here the script in its simple mode(in case you for some reason don't want to worry about customizing the script or just want something simple for example), in this mode it is usually necessary to turn off the "AutoMoveAttackPickup" function to use the skills on the other buttons and there are no organized customization areas but you can change the buttons if you know how to modify the script, this script also doesn't use the game's "Quick Pickup":

Code: Select all

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;CONTROLING THE SCRIPT:

;Mouse wheel up on battleground = Turn on Auto Attack Move Pickup (Does not work well with "stationary attack" of the game, do not need)
;Mouse wheel down = Turn off Auto Attack Move Pickup
;Holding "q" pointing in the potion in the shop = Auto buy potions
;Holding "g" pointing in the skill or attribute = Auto points in skill
;F10 = Close the script

;ADDITIONAL FUNCTION OF "AutoAttackMovePickup":
;This function can also be used to place and reset skill points quickly (although it is not advisable), after all this function uses the left mouse button repeatedly.
;The reason this is not advisable is because it works very fast and once I lost a skill point because of this
;I apparently managed to recover the lost point with the TQ Defiler which luckily still works in this version of the game in this case
;Another function was created just to this case in the script, "AutoPointInSkill".

;ADDITIONAL FUNCTIONS OF "AutoBuyPotions":
;Can be used to sell many items at once in the inventory too, just hold the function button while moving the mouse cursor on the various items you want to sell.
;In this same way you can send several items from the inventory to your bank or vice versa as well, after all this function uses the right mouse button repeatedly.
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;THE SCRIPT:

var_AttackMovePickup = 0

SetTimer, Button_Pressed, 1
return

Button_Pressed:

	if WinActive("Titan Quest Anniversary Edition")
	{
		if (var_AttackMovePickup = 1)
		{
			Send {LButton down}
			Sleep, 10
			Send {LButton up}
			Sleep, 10
		}
		else{}

		GetKeyState, state, q
		if state = D
		{
			Send {RButton Down}
			Sleep, 1
			Send {RButton Up}
			Sleep, 1
		}
		else
		{}
		
		GetKeyState, state, g
		if state = D
		{
			Send {LButton Down}
			Sleep, 50
			Send {LButton Up}
			Sleep, 50
		}
		else
		{}

	}
	
return

if WinActive("Titan Quest Anniversary Edition")
{
	WheelUp::
	var_AttackMovePickup = 1
	return

	WheelDown::
	var_AttackMovePickup = 0	
	return
}

F10::
ExitApp
Return
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



Here the script in its extended mode, this mode has two areas of customization in the script(one near the beginning and one near the end, if you have trouble changing the buttons, the AutoHotKey help file may be able to help), in this mode of the script it is possible to use the other skill buttons while the "AutoAttackMovePickup" function is active(the "AutoAttackMovePickup" function is automatically paused while you hold the other skill buttons), this script can use the "Quick Pickup" function of the game if you want, it may be mandatory to change the buttons in the script before starting to use it depending on your buttons configuration in the game:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent ; Keeps a script permanently running (that is, until the user closes it or ExitApp is encountered).
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#Singleinstance, ignore

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;SCRIPT PERSONALIZATION AREA 1, CHANGE IN THIS AREA THE BUTTONS AND FUNCTIONS THAT CONTROL THE SCRIPT:

;_______________________________________________________
;SCRIPT ONLY IN THE GAME WINDOW
;This script is initially designed to work only in the game window of the GOG version, if for some reason the script doesn't work (I don't know if the STEAM version of the game has a different window name), 
;you can turn this function off in this part and leave the script works anywhere.
;If you want the script to work only in the game window, put 1 after the "=" below, if you want it to work anywhere, put 0(zero) after the "=" below:

Only_In_Window_Game = 1

;And if your game has a different window name you can also try adapting the script to work in your game window, in this case you simply change the title of the game in this command in the script:
;if WinActive("Titan Quest Anniversary Edition")
;There are only two of that command in the entire script below, the one above is not valid to change :)  the title is in quotes

;_______________________________________________________
;AUTO BUY POTIONS
;Auto buy potion holding the button, you can change the button after "=" below:

AutoBuyPotion = q 

;Additional functions of "AutoBuyPotions":
;Can be used to sell many items at once in the inventory too, just hold the function button while moving the mouse cursor on the various items you want to sell.
;In this same way you can send several items from the inventory to your bank or vice versa as well, after all this function uses the right mouse button repeatedly.

;_______________________________________________________
;TRUE PICKUP
;This function uses the "Quick Pickup" of the game that makes the script more complete.
;If you are going to use it you must turn on the function and check if the button of this function in the game is the same one chosen here in the script
;Put 0(zero) after the "=" below to not use the function in the script and put 1 after the "=" below to use:

True_Pickup = 0

;Quick Pickup button of the game(default is "a") to be activated with "Auto Attack Move Pickup", you can change the button after "=" below:

QuickPickup = a

;_______________________________________________________
;AUTO POINT IN SKILL
;Created to put or reset skill or attributes points while you hold a button, it was taken out of "AutoAttakMovePickup" because of the reason 
;explained in that other function in the second area of ​​script customization, here they work more slowly but it seems to be safer.
;Auto points in skill holding the button, you can change the button after "=" below:

AutoPointInSkill = g

;_______________________________________________________
;OTHER SKILLS WITH THE OTHER BUTTONS TOGETHER WITH THE "AutoMoveAttackPickup" FUNCTION
;Skill slots buttons to work with "AutoMoveAttackPickup", just hold the skill button, check if the buttons in the game are the same ones chosen here, you can change the buttons here after "=" below:
Slot_1_Button = 1
Slot_2_Button = 2
Slot_3_Button = 3
Slot_4_Button = 4
Slot_5_Button = 5
Slot_6_Button = 6
Slot_7_Button = 7
Slot_8_Button = 8

;_______________________________________________________
;A NOTE ABOUT USING THE RIGHT MOUSE BUTTON WITH THE FUNCTION  "AutoMoveAttackPickup":
;For the animated character action on RButton to work with "auto AttackMovePickup", the "RButton" uses one of the skill slots where the "RButton" slot should be
;with the same action as the chosen skill slot, for example, if you want to use the skill "Regrowth" on the right mouse button, put the skill on the right button and 
;also in the slot skill 8, to use the skill just hold the right mouse button.
;But if you are not going to use a character action with animation, such as the health potion on the right mouse button, it may be better to turn off this function from the script below:
;After the "=" below, leave "1" to use skill with the right mouse button or leave "0" (zero) to use non-skill action such as potions

RbuttonWithSkill = 0

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;THE REST OF SCRIPT:

var_pause_1 = 0
var_pause_2 = 0
var_pause_3 = 0
var_pause_4 = 0
var_pause_5 = 0
var_pause_6 = 0
var_pause_7 = 0
var_pause_8 = 0
var_AttackMovePickup = 0

SetTimer, Button_Pressed, 1
return

Button_Pressed:
if (Only_In_Window_Game = 1)
{
	if WinActive("Titan Quest Anniversary Edition")
	{
		Goto, Label_1
	}
	else
	{
		Goto, Label_2
	}
}
else
{
	Goto, Label_1
}

Label_1:
	
		GetKeyState, state, %Slot_1_Button%
		if state = D
		{
			var_pause_1 = 1
		}
		else
		{
			var_pause_1 = 0
		}
		
		GetKeyState, state, %Slot_2_Button%
		if state = D
		{
			var_pause_2 = 1
		}
		else
		{
			var_pause_2 = 0
		}
		
		GetKeyState, state, %Slot_3_Button%
		if state = D
		{
			var_pause_3 = 1
		}
		else
		{
			var_pause_3 = 0
		}
		
		GetKeyState, state, %Slot_4_Button%
		if state = D
		{
			var_pause_4 = 1
		}
		else
		{
			var_pause_4 = 0
		}
		GetKeyState, state, %Slot_5_Button%
		if state = D
		{
			var_pause_5 = 1
		}
		else
		{
			var_pause_5 = 0
		}
		
		GetKeyState, state, %Slot_6_Button%
		if state = D
		{
			var_pause_6 = 1
		}
		else
		{
			var_pause_6 = 0
		}
		
		GetKeyState, state, %Slot_7_Button%
		if state = D
		{
			var_pause_7 = 1
		}
		else
		{
			var_pause_7 = 0
		}
		
		GetKeyState, state, %Slot_8_Button%
		if state = D
		{
			var_pause_8 = 1
		}
		else
		{
			var_pause_8 = 0
		}
		
		if (var_AttackMovePickup = 1)
		{
			if (var_pause_1 = 0)
			{
			if (var_pause_2 = 0)
			{
			if (var_pause_3 = 0)
			{
			if (var_pause_4 = 0)
			{
			if (var_pause_5 = 0)
			{
			if (var_pause_6 = 0)
			{
			if (var_pause_7 = 0)
			{
			if (var_pause_8 = 0)
			{
				Send {LButton down}
				if (True_Pickup = 1)
				{
					Send {%QuickPickup% down}
				}
				Sleep, 10
				Send {LButton up}
				if (True_Pickup = 1)
				{
					Send {%QuickPickup% up}
				}
				Sleep, 10
			}
			}
			}
			}
			}
			}
			}
			}
		}
		else{}

		;For the animated character action on RButton to work with "auto AttackMovePickup" the "RButton" uses one of the skill slots where the "RButton" slot should be
		;with the same action as the chosen skill slot, for example, if you want to use the skill "Regrowth" on the right mouse button, put the skill on the right button and also in the slot
		;skill chosen as in this case slot 8 placed below:
		if (RbuttonWithSkill = 1)
		{
			GetKeyState, state, RButton
			if state = D
			{
				if (var_AttackMovePickup = 1)
				{
					Send {%Slot_8_Button% down}
				}
			}
			else
			{
				if (var_AttackMovePickup = 1)
				{
					Send {%Slot_8_Button% up}
				}
			}
		}
		else{}

		GetKeyState, state, %AutoBuyPotion%
		if state = D
		{
			Send {RButton Down}
			Sleep, 1
			Send {RButton Up}
			Sleep, 1
		}
		else
		{}
		
		GetKeyState, state, %AutoPointInSkill%
		if state = D
		{
			Send {LButton Down}
			Sleep, 50
			Send {LButton Up}
			Sleep, 50
		}
		else
		{}

Label_2:
		
return

if (Only_In_Window_Game = 1)
{
	if WinActive("Titan Quest Anniversary Edition")
	{
		Goto, Label_3
	}
	else
	{
		Goto, Label_4
	}
}
else
{
	Goto, Label_3
}

Label_3:

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;SCRIPT PERSONALIZATION AREA 2, CHANGE IN THIS AREA THE BUTTONS THAT CONTROL THE SCRIPT:

;_______________________________________________________
;AUTO ATTACK MOVE PICKUP "ON"
;Turn on Auto Attack Move Pickup on battleground, you can change the button before the "::" below:
;Does not work well with "stationary attack" of the game, I didn't even try to make it work, after all in the "stationary attack" of the game you just need to hold the chosen button of the game function together with the mouse button
WheelUp::
var_AttackMovePickup = 1
return

;AUTO ATTACK MOVE PICKUP "OFF"
;Turn off Auto Attack Move Pickup, you can change the button before the "::" below:
WheelDown::
var_AttackMovePickup = 0	
return

;ADDITIONAL FUNCTION OF "AutoAttackMovePickup":
;This function can also be used to place and reset skill points quickly (although it is not advisable), after all this function uses the left mouse button repeatedly.
;The reason this is not advisable is because it works very fast and once I lost a skill point because of this
;I apparently managed to recover the lost point with the TQ Defiler which luckily still works in this version of the game in this case
;Another function was created just to this case in the script, "AutoPointInSkill".

;_______________________________________________________
;Do not touch this label :)
Label_4:

;_______________________________________________________
;CLOSE SCRIPT
;Close Script button, you can change the button before the "::" below:
F10::
ExitApp
Return

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



If the main functions of the simple script do not appear in the game with you activating them, maybe the game window has a different name, here are other mode of the simple script that work anywhere, not only in the window placed in the normal scripts above.
The normal scripts above were made to work in the GOG version game window, I don't know if the name of the STEAM version window is different.
Note that this script work anywhere, if you accidentally turn on some function it might be better to close the script, dangerous things can happen with the script running anywhere.
The extended mode of the script already has this detail in a customizable way.

Code: Select all

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;CONTROLING THE SCRIPT:

;Mouse wheel up on battleground = Turn on Auto Attack Move Pickup (Does not work well with "stationary attack" of the game, do not need)
;Mouse wheel down = Turn off Auto Attack Move Pickup
;Holding "q" pointing in the potion in the shop = Auto buy potions
;Holding "g" pointing in the skill or attribute = Auto points in skill
;F10 = Close the script

;ADDITIONAL FUNCTION OF "AutoAttackMovePickup":
;This function can also be used to place and reset skill points quickly (although it is not advisable), after all this function uses the left mouse button repeatedly.
;The reason this is not advisable is because it works very fast and once I lost a skill point because of this
;I apparently managed to recover the lost point with the TQ Defiler which luckily still works in this version of the game in this case
;Another function was created just to this case in the script, "AutoPointInSkill".

;ADDITIONAL FUNCTIONS OF "AutoBuyPotions":
;Can be used to sell many items at once in the inventory too, just hold the function button while moving the mouse cursor on the various items you want to sell.
;In this same way you can send several items from the inventory to your bank or vice versa as well, after all this function uses the right mouse button repeatedly.
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;THE SCRIPT:

var_AttackMovePickup = 0

SetTimer, Button_Pressed, 1
return

Button_Pressed:

	if (var_AttackMovePickup = 1)
	{
		Send {LButton down}
		Sleep, 10
		Send {LButton up}
		Sleep, 10
	}
	else{}

	GetKeyState, state, q
	if state = D
	{
		Send {RButton Down}
		Sleep, 1
		Send {RButton Up}
		Sleep, 1
	}
	else
	{}
	
	GetKeyState, state, g
	if state = D
	{
		Send {LButton Down}
		Sleep, 50
		Send {LButton Up}
		Sleep, 50
	}
	else
	{}
	
return

WheelUp::
var_AttackMovePickup = 1
return

WheelDown::
var_AttackMovePickup = 0	
return

F10::
ExitApp
Return
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Instructions for use are in the scripts, happy gameplay ;)



UPDATES

??/??/???? :thumbup: :
Added "Skill in Rbutton" customization in extended scripts
Added information about additional "AutoBuyPotions" functions in all scripts

30/12/2020:
All extended version scripts have become one with all functions together
Added information about additional "AutoAttackMovePickup" function in all scripts
The speed of the "AutoBuyPotions" function has been increased slightly in all scripts

v.2 26/01/2021:
Improvement of additional function information of "Auto Attack Move Pickup" in all scripts
Another function added in all scripts: "Auto Points In Skill"

v.2.1 28/01/2021:
Improvement of additional function information of "Auto Attack Move Pickup" in all scripts

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 8 guests