Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local AutoLagTolerance = CreateFrame( "Frame", "AutoLagTolerance" )
- local currentTolerance = GetCVar( "SpellQueueWindow" )
- local lastUpdateTime = 0
- local function AutoLagTolerance_OnUpdate ( self, elapsed )
- lastUpdateTime = lastUpdateTime + elapsed
- -- Update once per second.
- if lastUpdateTime < 1.0 then
- return
- else
- lastUpdateTime = 0
- end
- -- Retrieve the world latency.
- local newTolerance = select( 4, GetNetStats() )
- -- Ignore an empty value.
- if newTolerance == 0 then
- return
- end
- -- Prevent update spam.
- if newTolerance == currentTolerance then
- return
- else
- currentTolerance = newTolerance
- end
- -- Adjust the "Lag Tolerance" slider.
- SetCVar( "SpellQueueWindow", newTolerance )
- end
- local function AutoLagTolerance_OnEvent ( self, event, arg1, arg2, ... )
- if event == "PLAYER_ENTERING_WORLD" then
- SetCVar( "SpellQueueWindow", 1 )
- end
- end
- AutoLagTolerance:SetScript( "OnUpdate", AutoLagTolerance_OnUpdate )
- AutoLagTolerance:SetScript( "OnEvent", AutoLagTolerance_OnEvent )
- AutoLagTolerance:RegisterEvent( "PLAYER_ENTERING_WORLD" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement