Torchlight 2 Attack, move and pick up items almost automatically

Post gaming related scripts
User avatar
Hajin
Posts: 51
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

Security:
If you use this script only for single player mode apparently there is no rule that prohibits its use.

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 363 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 341 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 26 Aug 2023, 19:23, edited 5 times in total.
User avatar
Hajin
Posts: 51
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:
viewtopic.php?f=19&t=72315

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 419 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 320 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.
Last edited by Hajin on 11 Jun 2023, 23:36, edited 1 time in total.
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.
erikurruti
Posts: 2
Joined: 30 Dec 2021, 14:31

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

30 Dec 2021, 14:43

@Hajin
Hey, how do I use this script? Do I need to download it and change the extension name, or is there a way to add it to AutoHotKey? Thx
User avatar
Hajin
Posts: 51
Joined: 13 May 2016, 09:16

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

19 Feb 2022, 14:51

erikurruti wrote:
30 Dec 2021, 14:43
@Hajin
Hey, how do I use this script? Do I need to download it and change the extension name, or is there a way to add it to AutoHotKey? Thx
@erikurruti
You must have AutoHotKey installed on your device, the script works in .ahk format (I uploaded some of these in this topic) after you have the file in .ahk format you can edit it with any text editor, for example, with one of these made for the game Torchlight in this topic you can put any other script inside the file through the text editor, so it will become another script, just make copies of the .ahk file.

Sorry for the late reply, I'm not very active on this forum.

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 12 guests