Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Smooth transition float values

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Aziixz
Cheater
Reputation: 0

Joined: 26 Oct 2021
Posts: 31
Location: Earth

PostPosted: Fri Jul 15, 2022 9:56 am    Post subject: Smooth transition float values Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites