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 


Help please i don't know how to set value

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
dfirefist
How do I cheat?
Reputation: 0

Joined: 05 May 2017
Posts: 1

PostPosted: Fri May 05, 2017 11:58 pm    Post subject: Help please i don't know how to set value Reply with quote

i have an address that value is 1 (it a fishing value)
how to set value to 2 when it change to 1
i do not want to freze it just leave it run
(start fishing is 2 when you get fish is 1 i need to set it auto to 2 X
thank you for your help
sorry i'm bad english

edit

need more like how to set time like change value to 4 evey 7 seconds

ty very much
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 42

Joined: 09 Aug 2013
Posts: 1089

PostPosted: Sat May 06, 2017 9:03 am    Post subject: Reply with quote

A lua script like this should work

Code:
{$lua}
[ENABLE]
if syntaxcheck then return end
timer = createTimer()
script = al.getMemoryRecordByDescription("Name of this script")
address = al.getMemoryRecordByDescription("Name of value in address list")
al = getAddressList()

timer.onTimer = function(timer)
  -- stop timer when disabled
  if not script.Active then timer.destroy() end
  -- otherwise check if it's 1 and set it to 2
  if tonumber(address.Value) == 1 then
    address.Value = "2"
  end
end

timer.Interval = 100 -- 100 milliseconds, 1/10th of a second

[DISABLE]


It can be done in assembly using createThead (or typical hooking) but the code would change depending on the type of value (1 byte, 4 byte, float, double, etc) while this method should work for any. There's a way to do it in lua with just the script, but then you're back to changing the code based on the type of the value (writeInteger for 4 bytes, writeFloat, writeDouble, and writeBytes for nearly everything else).

as for setting the value every 7 seconds you can do essentially the same thing, just without the check and by changing the interval


Code:
{$lua}
[ENABLE]
if syntaxcheck then return end
timer = createTimer()
script = al.getMemoryRecordByDescription("Name of this script")
address = al.getMemoryRecordByDescription("Name of value in address list")
al = getAddressList()

timer.onTimer = function(timer)
  -- stop timer when disabled
  if not script.Active then timer.destroy() end
  -- set it to 4
  address.Value = "4"
end

timer.Interval = 7*1000 -- 7 seconds

[DISABLE]
Back to top
View user's profile Send private message
dfirefist
How do I cheat?
Reputation: 0

Joined: 05 May 2017
Posts: 1

PostPosted: Mon May 08, 2017 11:29 am    Post subject: Reply with quote

FreeER wrote:
A lua script like this should work

Code:
{$lua}
[ENABLE]
if syntaxcheck then return end
timer = createTimer()
script = al.getMemoryRecordByDescription("Name of this script")
address = al.getMemoryRecordByDescription("Name of value in address list")
al = getAddressList()

timer.onTimer = function(timer)
  -- stop timer when disabled
  if not script.Active then timer.destroy() end
  -- otherwise check if it's 1 and set it to 2
  if tonumber(address.Value) == 1 then
    address.Value = "2"
  end
end

timer.Interval = 100 -- 100 milliseconds, 1/10th of a second

[DISABLE]


It can be done in assembly using createThead (or typical hooking) but the code would change depending on the type of value (1 byte, 4 byte, float, double, etc) while this method should work for any. There's a way to do it in lua with just the script, but then you're back to changing the code based on the type of the value (writeInteger for 4 bytes, writeFloat, writeDouble, and writeBytes for nearly everything else).

as for setting the value every 7 seconds you can do essentially the same thing, just without the check and by changing the interval


Code:
{$lua}
[ENABLE]
if syntaxcheck then return end
timer = createTimer()
script = al.getMemoryRecordByDescription("Name of this script")
address = al.getMemoryRecordByDescription("Name of value in address list")
al = getAddressList()

timer.onTimer = function(timer)
  -- stop timer when disabled
  if not script.Active then timer.destroy() end
  -- set it to 4
  address.Value = "4"
end

timer.Interval = 7*1000 -- 7 seconds

[DISABLE]


Thank you very much Very Happy
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 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