Torchlight 2 Attack, move and pick up items almost automatically

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

Torchlight 2 Attack, move and pick up items almost automatically

08 Mar 2020, 11:41

This topic is almost a copy of my other topic in another forum:
https://gamefaqs.gamespot.com/boards/604445-torchlight-ii/78453551

I made an script for me to move the character and attack automatically:

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.

var_g = 0

SetTimer, Button_Pressed, 1
return

Button_Pressed:

GetKeyState, state, w
if state = D
{	
	var_g = 0
	send {Lbutton up}
	sleep, 50
	return
}
else
{}

GetKeyState, state, e
if state = D
{	 	
	var_g = 1
	sleep, 50
	return
}
else
{
	if (var_g = 1)
	{
		GetKeyState, state, Rbutton
		if state = D
		{
			send {Lbutton up}
			sleep, 75
		}
		else
		{
			send {Lbutton down}
			sleep, 75
			send {Lbutton up}
			sleep, 75			
		}
	}
	else
	{}
}

return

F9::
{
	var_g = 0
	send {Lbutton up}
	ExitApp
}
Torchlight 2 Auto Move Attack.ahk
(931 Bytes) Downloaded 78 times
You just need to move the mouse to move the character and he will automatically attack the monsters on the way and the character will also pick up the items on the way that are shown, making the activity less tiring.

Script instructions:
-When the script is working with you inside the game the system is activated with the "e" key and turned off with "w"
-The script works with the game function "Move/Attack" and "Cast Active Skill" selected with the left and right mouse buttons in the game
-The keys for turning the system on and off(and others) can be changed by editing the script with a text program such as the common "notepad"
(if you have trouble editing the script it might be better to learn a little about the "AutoHotKey" program in the help file)
-Just turn on the system with the chosen keys while in the game, if you turn on the system outside the game and have problems, turn off the script with the "F9" key

I made a version of the script that will only turn on the system while 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.

var_g = 0

SetTimer, Button_Pressed, 1
return

Button_Pressed:
if WinActive("Torchlight II")
{
	GetKeyState, state, w
	if state = D
	{	
		var_g = 0
		send {Lbutton up}
		sleep, 50
		return
	}
	else
	{}

	GetKeyState, state, e
	if state = D
	{	 	
		var_g = 1
		sleep, 50
		return
	}
	else
	{
		if (var_g = 1)
		{
			GetKeyState, state, Rbutton
			if state = D
			{
				send {Lbutton up}
				sleep, 75
			}
			else
			{
				send {Lbutton down}
				sleep, 75
				send {Lbutton up}
				sleep, 75			
			}
		}
		else
		{}
	}
}
return

F9::
{
	var_g = 0
	send {Lbutton up}
	ExitApp
}
Torchlight 2 Auto Move Attack Only in The Game.ahk
(1002 Bytes) Downloaded 83 times
I kept what works out of the game because maybe it can be adapted for other games with similar functioning.

Some in-game skills cannot normally be used with the game's "Move/Attack" function(left button by default), but someone has made a mod that makes this possible.
Mod link:
https://steamcommunity.com/sharedfiles/filedetails/?id=149464234
http://steamworkshop.download/download/view/149464234
But a few skills may not work properly in this role in this mod.
Last edited by Hajin on 08 Mar 2020, 15:24, edited 1 time in total.
User avatar
Hajin
Posts: 48
Joined: 13 May 2016, 09:16

Re: Torchlight 2 Attack, move and pick up items almost automatically

08 Mar 2020, 14:51

I improved the script thanks to this guy:
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=72315 :clap:

We now have a script for the mouse buttons:

Code: Select all

#IfWinActive, Torchlight II
SetTimer, Smash, 75

;keys chosen here
e::t1 := !t1 ;Auto LClicks
t::t2 := !t2 ;Hold LClick			
y::t3 := !t3 ;Hold RClick

Smash:
	If t1
	{
		Send {Click}
	}
	If t2
	{
		Send {Click down}
	}
	If t3
	{
		Send {RButton down}
	}
	Return
	
~w:: ;stop system
	t1 := 0, t2 := 0, t3 := 0
	Send {LButton up}
	Send {RButton up}
Return
Torchlight 2 Auto Attack, Move, Pickup Items.ahk
(384 Bytes) Downloaded 96 times
Instructions:
key "e" = Auto LClicks
key "t" = Hold LClick
key "y" = Hold RClick
key "w" = Stop System

And another for the numeric buttons normally used for "buffs" and the like:

Code: Select all

#IfWinActive, Torchlight II
SetTimer, Smash, 200

;key chosen here
r::t1 := !t1 ;buffs			

Smash:
	If t1
	{
;down here put "Send (the number of the button of your buff)"
		Send 4
		Send 5
	}
	Return

~w:: ;stop system
	t1 := 0
Return
Torchlight 2 Buffs.ahk
(255 Bytes) Downloaded 86 times
Instructions:
key "r" = Auto buffs
key "w" = Stop System

More instructions within the scripts.
The two scripts must work separately at the same time because they must work at different speeds already chosen to work correctly in this case.
Dramorian
Posts: 2
Joined: 18 Oct 2020, 16:44

Re: Torchlight 2 Attack, move and pick up items almost automatically

19 Oct 2020, 20:17

Hajin wrote:
08 Mar 2020, 14:51
I improved the script thanks to this guy:
https://www.autohotkey.com/boards/viewtopic.php?f=19&t=72315 :clap:

We now have a script for the mouse buttons:

Code: Select all

#IfWinActive, Torchlight II
SetTimer, Smash, 75

;keys chosen here
e::t1 := !t1 ;Auto LClicks
t::t2 := !t2 ;Hold LClick			
y::t3 := !t3 ;Hold RClick

Smash:
	If t1
	{
		Send {Click}
	}
	If t2
	{
		Send {Click down}
	}
	If t3
	{
		Send {RButton down}
	}
	Return
	
~w:: ;stop system
	t1 := 0, t2 := 0, t3 := 0
	Send {LButton up}
	Send {RButton up}
Return
Torchlight 2 Auto Attack, Move, Pickup Items.ahk
Instructions:
key "e" = Auto LClicks
key "t" = Hold LClick
key "y" = Hold RClick
key "w" = Stop System

How to make it work for Titan Quest? It doesn't react. Only the one with SendMode Input works.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 4 guests