Torchlight 2 Auto Potion

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

Torchlight 2 Auto Potion

14 Mar 2020, 08:27

Script made for the game configured with the health and magic original orbs in the center(UI Scale: 90%)(Display Option in: windowed fullscreen), sorry.
More instructions inside the script.
Updated to v.9

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.

SetTimer, Button_Pressed, 100
return

;hp position color with normal screen: 0x1426C2
;hp position color with paused screen: 0x0E1C88
;hp position color with screen on the "mapworks" map machine: 0x050A31
;hp position color with  waypoint screen: 0x08124E
;position on the right side of the HP orb at about 60% of the MAX HP: 397, 708
;hp position color with choose character screen: 0x000000
;hp position color with screen to remove spells: 0x081050
;hp position color with menu screen: 0x071044
;hp position color with act change screen: 0x0A1561
;hp position color with "LAN" screen: 0x000400
;hp position color with "INTERNET" screen: 0x000100
;hp position color with "CONTROL" menu screen: 0x020711
;hp position color with "ITEM DISPLAY" menu screen: 0x040A22
;hp position color with "LOADING" screen (a letter of random information maybe): 0xF9F9F9
;hp position color with "LOADING" screen (another letter of random information maybe): 0xFFFFFF
;hp position color with "LOADING" screen (another letter of random information maybe): 0x00B9FE
;hp position color with "LOADING" screen (another letter of random information maybe): 0x00BAFF

Button_Pressed:

if WinActive("Torchlight II")
{

	;keeping the position color in the variable
	PixelGetColor, OutputVar, 397, 708 ,
	
	;deciding whether to use potion
	if (OutputVar = 0x1426C2)
	{}
	else
	{
		if (OutputVar = 0x0E1C88)
		{}
		else
		{
			if (OutputVar = 0x050A31)
			{}
			else
			{
				if (OutputVar = 0x08124E)
				{}
				else
				{
					if (OutputVar = 0x000000)
					{}
					else
					{
						if (OutputVar = 0x081050)
						{}
						else
						{
							if (OutputVar = 0x071044)
							{}
							else
							{
								if (OutputVar = 0x0A1561)
								{}
								else
								{
									if (OutputVar = 0x000400)
									{}
									else
									{
										if (OutputVar = 0x000100)
										{}
										else
										{
											if (OutputVar = 0x020711)
											{}
											else
											{
												if (OutputVar = 0x040A22)
												{}
												else
												{
													if (OutputVar = 0xF9F9F9)
													{}
													else
													{
														if (OutputVar = 0xFFFFFF)
														{}
														else
														{
															if (OutputVar = 0x00B9FE)
															{}
															else
															{
																if (OutputVar = 0x00BAFF)
																{}
																else
																{
																	;will only send the button if the alt key has not been held (so as not to disturb the change of window)
																	GetKeyState, state, alt
																	if state = D
																	{}
																	else
																	{
																		;it will only send the button if the win key has not been held (so as not to disturb the leave game window)
																		GetKeyState, state, Lwin
																		if state = D
																		{}
																		else
																		{
																			;below, send the potion button:
																			Send 1
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}
Torchlight 2 Auto Potion v.9.ahk
(3.64 KiB) Downloaded 78 times
EDITED:
And my monitor resolution is 1366x768, I don't know if that part makes any difference.
Last edited by Hajin on 30 Mar 2020, 07:56, edited 15 times in total.
User avatar
Hajin
Posts: 48
Joined: 13 May 2016, 09:16

Re: Torchlight 2 Auto Potion

14 Mar 2020, 09:06

There is a mod called "auto consume" that uses potion automatically,
but in this mod you cannot choose one of the numeric keys of the game action interface.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 8 guests