Auto AFK Kick Script - Minecraft

Get help with using AutoHotkey and its commands and hotkeys
Superman785
Posts: 2
Joined: 20 Jun 2018, 05:50

Auto AFK Kick Script - Minecraft

20 Jun 2018, 05:58

Hello,
I was just wondering how I'd make a Minecraft Script that will run the command "/tempban [My username] 1s Reason: AFK" if my Minecraft Character hasn't moved in 10 minutes.

Kind regards,
Connor.
swagfag
Posts: 1386
Joined: 11 Jan 2017, 17:59

Re: Auto AFK Kick Script - Minecraft

20 Jun 2018, 08:01

Added missing close paren

Code: Select all

#NoEnv
#SingleInstance Force
#Persistent
#InstallKeybdHook
#InstallMouseHook
SetBatchLines -1
SendMode Input

minecraft := "ahk_exe notepad.exe"
message := "/tempban [My username] 1s Reason: AFK"
MAX_MINUTES_AFK := 10
TIMER_PERIOD_MS := 2000

SetTimer, MonitorMinecraft, % TIMER_PERIOD_MS
Return

MonitorMinecraft:
	timeIdle := (A_TimeIdlePhysical // 1000) / 60 ;in mins
	if (timeIdle > MAX_MINUTES_AFK && (WinActive(minecraft) || WinExist(minecraft)))
	{
		WinActivate
		WinWaitActive
		Send {Enter}
		Send % "{Text}" message
		Send {Enter}
		SetTimer, , Off
		SetTimer, MonitorForActivity, % TIMER_PERIOD_MS / 10
	}
Return


MonitorForActivity:
	if (A_TimeIdlePhysical < 200)
	{
		SetTimer, , Off
		SetTimer, MonitorMinecraft, % TIMER_PERIOD_MS
	}
Return
Superman785
Posts: 2
Joined: 20 Jun 2018, 05:50

Re: Auto AFK Kick Script - Minecraft

21 Jun 2018, 02:40

Hello, I was just wondering how I fix this issue.

http://i67.tinypic.com/6omuk6.png

Kind regards,
Connor.

Return to “Ask For Help”

Who is online

Users browsing this forum: Relayer, Sabestian Caine and 62 guests