Jump to content

How to bind lag compensation on/off to hotkeys?


Recommended Posts

Put in customcommands.lua

TheInput:AddKeyUpHandler(91, function()

	if not (
		Profile
		and TheFrontEnd
		and TheFrontEnd:GetActiveScreen()
		and TheFrontEnd:GetActiveScreen().name == "HUD"
	) then
		return
	end

	local movepred = not Profile:GetMovementPredictionEnabled()

	Profile:SetMovementPredictionEnabled(movepred)

	if not ThePlayer then
		return
	end

	ThePlayer:EnableMovementPrediction(movepred)

	if ThePlayer.components.talker then
		ThePlayer.components.talker:Say(
			"Lag Compensation: "..(
				movepred and "Enabled" or "Disabled"
			),
			1
		)
	end

end)

Press your [ key to toggle

If you want to use a different key then replace 91 with something else

Link to comment
Share on other sites

2 hours ago, cezarica said:

And where exactly to put this customcommands.lua file?

for Windows: Documents\Klei\DoNotStarveTogether\customcommands.lua

for Linux: you can put it in ~/.klei/DoNotStarveTogether/customcommands.lua but the game wont read it at all so it won't work because klei hates you in particular

for Mac: ~/Documents/Klei/DoNotStarveTogether/customcommands.lua

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...