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 


Change the value when it is written

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

Joined: 01 Oct 2021
Posts: 8

PostPosted: Fri Oct 01, 2021 2:36 pm    Post subject: Change the value when it is written Reply with quote

I have a value that is written from the address when the layer is loaded. When I exit the level, the value is changed multiple times and if I lock it it creates bugs in other levels in the game. I need a script that when the value becomes 16, it automatically changes it to 21.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Fri Oct 01, 2021 3:19 pm    Post subject: Reply with quote

This should work just fine (paste it into an auto assembler script). It searches for the entry 'Entry_name_here' in the cheat table and if it exists then it will create a timer which runs the function checkValue every 50ms. The function will check the value of the entry in the table to see if it matches 16 and if it does, set it to 21.
Code:

[ENABLE]
{$LUA}
local al = getAddressList()
local mr = al.getMemoryRecordByDescription('Entry_name_here')

function checkValue()
  if mr.Value == 16 then
    mr.Value = 21
  end
end

if mr ~= nil then
  local t = createTimer(getMainForm())
  t.Interval = 50
  t.OnTimer = checkValue()
end
{$ASM}
[DISABLE]
{$LUA}
if t then
  t.destroy()
  t = nil
end


Last edited by LeFiXER on Sat Oct 02, 2021 8:29 am; edited 1 time in total
Back to top
View user's profile Send private message
IraFunesto
How do I cheat?
Reputation: 0

Joined: 01 Oct 2021
Posts: 8

PostPosted: Sat Oct 02, 2021 6:08 am    Post subject: Reply with quote

I receive this error


errore.PNG
 Description:
 Filesize:  23.64 KB
 Viewed:  1632 Time(s)

errore.PNG


Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Sat Oct 02, 2021 8:29 am    Post subject: Reply with quote

Below [DISABLE] type {$LUA}
Back to top
View user's profile Send private message
IraFunesto
How do I cheat?
Reputation: 0

Joined: 01 Oct 2021
Posts: 8

PostPosted: Sun Oct 03, 2021 4:33 am    Post subject: Reply with quote

I don't get any errors now, but nothing happens.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Mon Oct 04, 2021 4:10 am    Post subject: Reply with quote

Try this instead:
Code:

[ENABLE]
{$LUA}
function checkValue()
local al = getAddressList()
local mr = al.getMemoryRecordByDescription('Entry_name_here')

  if mr ~= nil then
  local x = readInteger(mr.address)
    if x == 16 then
      writeInteger(mr.address, 21)
    end
  end
end

local t = createTimer(getMainForm())
t.Interval = 50
t.OnTimer = checkValue()
t.Enabled = true
{$ASM}
[DISABLE]
{$LUA}
if t then
  t.destroy()
  t = nil
end
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