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 


Increase value with time

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
danishdanish
Newbie cheater
Reputation: 0

Joined: 15 Mar 2016
Posts: 23

PostPosted: Thu Aug 02, 2018 11:11 am    Post subject: Increase value with time Reply with quote

I want add a specif value (suppose 1) to the base address after every 3 seconds. And I don't have any idea about Lua Scripting and how to do that (sorry). If someone could help me out would be really appreciated. Thank you Smile
Base address is 10940148
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Aug 02, 2018 11:27 am    Post subject: Reply with quote

https://forum.cheatengine.org/viewtopic.php?t=608159

Code:
DoneState = false
local addr = 0x10940148
local val = 1
local function timer_tick(timer)
  writeInteger(addr, val + readInteger(addr))
  -- writeFloat(addr, val + readFloat(addr))
  if DoneState == true then
    timer.destroy()
  end
end
local someTimer = createTimer(MainForm)
someTimer.Interval = 3000
someTimer.OnTimer = timer_tick

https://wiki.cheatengine.org/index.php?title=Lua:Class:Timer
https://wiki.cheatengine.org/index.php?title=Lua#Memory

_________________
Back to top
View user's profile Send private message Visit poster's website
danishdanish
Newbie cheater
Reputation: 0

Joined: 15 Mar 2016
Posts: 23

PostPosted: Thu Aug 02, 2018 7:51 pm    Post subject: Reply with quote

Thank you very very very very much:* its working Smile
but I have two problems, it don't stop whether the game is paused or not, Second, after executing it, how to stop it permanently?
Thank you in Advance, You are the great man Smile :*
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Thu Aug 02, 2018 10:13 pm    Post subject: Reply with quote

Timers don't stop for the game, you'd need to find some way to know in the script if the game is paused.

To stop the timer:
Code:
DoneState = true

Just put that in the disable section, and the other in the enable section.

_________________
Back to top
View user's profile Send private message Visit poster's website
danishdanish
Newbie cheater
Reputation: 0

Joined: 15 Mar 2016
Posts: 23

PostPosted: Thu Aug 02, 2018 11:05 pm    Post subject: Reply with quote

I want it to not add nothing when the value becomes 100 and if it is not 100 then continue adding 1 at every 3 secs. and if you don't mind can I ask this question to others by posting your code? In other thread.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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