Aziixz Cheater Reputation: 0
Joined: 26 Oct 2021 Posts: 31 Location: Earth
|
Posted: Fri Jul 15, 2022 9:56 am Post subject: Smooth transition float values |
|
|
Hi, So I've got a script with hotkeys set up using floats, everything works fine, I am just wondering how to go about smothly transition between values, so right now i've got a hotkey set up where it changes the number to 2 from 5 only when the right mouse button is pressed down,
Only problem is jumps to that value instantly which is quite jarring, is there anyway to setup a transition so the value would descend in increments say 0.50 every few milliseconds so it would make the transition smooth instead of from 5 to 2 it would go 5, 4.8 , 4.6 etx to 2 over say a second or so, thanks I've attached the script for reference
[ENABLE]
{$lua}
-- don't run when editing script
if syntaxcheck then return end
-- ignore hotkey stuff if not trigged by first hotkey
if not (memrec.HotkeyCount > 0 and memrec.Hotkey[0].Keys[1] and isKeyPressed(memrec.Hotkey[0].Keys[1])) then return end
local t = createTimer()
t.Interval = 100
t.OnTimer = function(t)
-- sanity check to prevent errors
if not (memrec.HotkeyCount > 0 and memrec.Hotkey[0].Keys[1]) then
t.destroy()
return
end
-- if key not pressed then disable script
if not isKeyPressed(memrec.Hotkey[0].Keys[1]) then
memrec.Active = false
t.destroy()
end
end
{$asm}
MW2CR.exe+1BC1510:
db 4C 1B 10 40 C9 29 BE 3F
MW2CR.exe+1BC1514:
db E1 CE 24 3F
MW2CR.exe+1BC1518:
db D7 B3 5D 40 C9 29 BE 3F
MW2CR.exe+1BC151C:
db 0C 8D 7D 3F
[DISABLE]
MW2CR.exe+1BC1510:
db E1 46 A6 40 C9 29 BE 3F
MW2CR.exe+1BC1514:
db C9 29 BE 3F
MW2CR.exe+1BC1518:
db E1 46 A6 40 C9 29 BE 3F
MW2CR.exe+1BC151C:
db C9 29 BE 3F
|
|