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 


How to change an address value through script?

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

Joined: 25 Feb 2016
Posts: 3

PostPosted: Mon Dec 26, 2016 5:22 pm    Post subject: How to change an address value through script? Reply with quote

So guys, what I need is something I think it's pretty simple, basically I want to make a new header on an Cheat Engine table and through a script added to this header, change the value of an address that is on the same table. That's basically it.

But if that could make it easier for you, I'm trying to "update" something from an old cheat table that I have here to a new version of this same game I used it for...
So, there are 2 teams, the home and away team (this table I have got is for the offline mode so please don't think it's for the "bad" purposes), and basically there are 13 different stats for what you can do with each team (like points, assists, etc...) so, with the old table, there were 3 headers, 1 called "Away team wins", "Home team wins" and "End Game".
What would happen if I checked one of the away/home boxes, is the values from the respective addresses for each stat in-game would change once I would check the box, and when I would check the "End Game" box, once again, the table would change some addresses' values and the match would instantly be over.

So, I made a new table from nothing and I have got all the addresses I need. The only thing left for me to do are the "Away/Home Win" and "End Game" boxes, but the problem is that I don't know how to create a script to change a value of an address once the header box is checked.

These were the scripts from the old table:

Home Wins:
"[ENABLE]

{$LUA}

local CheatTable=getAddressList();

for i=8000,8013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end
for i=9000,9013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end

-- // Away Stats
writeInteger(CheatTable.getMemoryRecordByID(8000).Address, 0) -- // Points
writeInteger(CheatTable.getMemoryRecordByID(8001).Address, 0) -- // Assists
writeInteger(CheatTable.getMemoryRecordByID(8002).Address, 0) -- // 3 Pointers Made
writeInteger(CheatTable.getMemoryRecordByID(8003).Address, 0) -- // 3 Pointers Attempted
writeInteger(CheatTable.getMemoryRecordByID(8004).Address, 0) -- // Free Throws Made
writeInteger(CheatTable.getMemoryRecordByID(8005).Address, 0) -- // Free Throws Attempted
writeInteger(CheatTable.getMemoryRecordByID(8006).Address, 0) -- // Fast Break Points
writeInteger(CheatTable.getMemoryRecordByID(8007).Address, 0) -- // Second Chance Points
writeInteger(CheatTable.getMemoryRecordByID(8008).Address, 0) -- // Points in the paint
writeInteger(CheatTable.getMemoryRecordByID(8009).Address, 0) -- // Dunks
writeInteger(CheatTable.getMemoryRecordByID(8010).Address, 0) -- // Offensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(8011).Address, 0) -- // Defensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(8012).Address, 0) -- // Steals
writeInteger(CheatTable.getMemoryRecordByID(8013).Address, 0) -- // Blocks

-- // Home Stats
writeInteger(CheatTable.getMemoryRecordByID(9000).Address, 195) -- // Points
writeInteger(CheatTable.getMemoryRecordByID(9001).Address, 40) -- // Assists
writeInteger(CheatTable.getMemoryRecordByID(9002).Address, 45) -- // 3 Pointers Made
writeInteger(CheatTable.getMemoryRecordByID(9003).Address, 45) -- // 3 Pointers Attempted
writeInteger(CheatTable.getMemoryRecordByID(9004).Address, 60) -- // Free Throws Made
writeInteger(CheatTable.getMemoryRecordByID(9005).Address, 60) -- // Free Throws Attempted
writeInteger(CheatTable.getMemoryRecordByID(9006).Address, 90) -- // Fast Break Points
writeInteger(CheatTable.getMemoryRecordByID(9007).Address, 60) -- // Second Chance Points
writeInteger(CheatTable.getMemoryRecordByID(9008).Address, 45) -- // Points in the paint
writeInteger(CheatTable.getMemoryRecordByID(9009).Address, 45) -- // Dunks
writeInteger(CheatTable.getMemoryRecordByID(9010).Address, 30) -- // Offensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(9011).Address, 40) -- // Defensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(9012).Address, 35) -- // Steals
writeInteger(CheatTable.getMemoryRecordByID(9013).Address, 30) -- // Blocks

for i=8000,8013,1
do
memoryrecord_freeze(CheatTable.getMemoryRecordByID(i))
end
for i=9000,9013,1
do
memoryrecord_freeze(CheatTable.getMemoryRecordByID(i))
end

{$ASM}

[DISABLE]

{$LUA}

local CheatTable=getAddressList();

for i=8000,8013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end
for i=9000,9013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end

{$ASM}
"

Away Wins:
"[ENABLE]

{$LUA}

local CheatTable=getAddressList();

for i=8000,8013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end
for i=9000,9013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end

-- // Away Stats
writeInteger(CheatTable.getMemoryRecordByID(8000).Address, 195) -- // Points
writeInteger(CheatTable.getMemoryRecordByID(8001).Address, 40) -- // Assists
writeInteger(CheatTable.getMemoryRecordByID(8002).Address, 45) -- // 3 Pointers Made
writeInteger(CheatTable.getMemoryRecordByID(8003).Address, 45) -- // 3 Pointers Attempted
writeInteger(CheatTable.getMemoryRecordByID(8004).Address, 60) -- // Free Throws Made
writeInteger(CheatTable.getMemoryRecordByID(8005).Address, 60) -- // Free Throws Attempted
writeInteger(CheatTable.getMemoryRecordByID(8006).Address, 90) -- // Fast Break Points
writeInteger(CheatTable.getMemoryRecordByID(8007).Address, 60) -- // Second Chance Points
writeInteger(CheatTable.getMemoryRecordByID(8008).Address, 45) -- // Points in the paint
writeInteger(CheatTable.getMemoryRecordByID(8009).Address, 45) -- // Dunks
writeInteger(CheatTable.getMemoryRecordByID(8010).Address, 30) -- // Offensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(8011).Address, 40) -- // Defensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(8012).Address, 35) -- // Steals
writeInteger(CheatTable.getMemoryRecordByID(8013).Address, 30) -- // Blocks

-- // Home Stats
writeInteger(CheatTable.getMemoryRecordByID(9000).Address, 0) -- // Points
writeInteger(CheatTable.getMemoryRecordByID(9001).Address, 0) -- // Assists
writeInteger(CheatTable.getMemoryRecordByID(9002).Address, 0) -- // 3 Pointers Made
writeInteger(CheatTable.getMemoryRecordByID(9003).Address, 0) -- // 3 Pointers Attempted
writeInteger(CheatTable.getMemoryRecordByID(9004).Address, 0) -- // Free Throws Made
writeInteger(CheatTable.getMemoryRecordByID(9005).Address, 0) -- // Free Throws Attempted
writeInteger(CheatTable.getMemoryRecordByID(9006).Address, 0) -- // Fast Break Points
writeInteger(CheatTable.getMemoryRecordByID(9007).Address, 0) -- // Second Chance Points
writeInteger(CheatTable.getMemoryRecordByID(9008).Address, 0) -- // Points in the paint
writeInteger(CheatTable.getMemoryRecordByID(9009).Address, 0) -- // Dunks
writeInteger(CheatTable.getMemoryRecordByID(9010).Address, 0) -- // Offensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(9011).Address, 0) -- // Defensive Rebounds
writeInteger(CheatTable.getMemoryRecordByID(9012).Address, 0) -- // Steals
writeInteger(CheatTable.getMemoryRecordByID(9013).Address, 0) -- // Blocks

for i=8000,8013,1
do
memoryrecord_freeze(CheatTable.getMemoryRecordByID(i))
end
for i=9000,9013,1
do
memoryrecord_freeze(CheatTable.getMemoryRecordByID(i))
end

{$ASM}

[DISABLE]

{$LUA}

local CheatTable=getAddressList();

for i=8000,8013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end
for i=9000,9013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end

{$ASM}"

End Game:
"[ENABLE]

{$LUA}

local CheatTable=getAddressList();

for i=7000,7002,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end

writeInteger(CheatTable.getMemoryRecordByID(7000).Address, 4)
writeDouble(CheatTable.getMemoryRecordByID(7001).Address, 0)
writeDouble(CheatTable.getMemoryRecordByID(7002).Address, 0)

{$ASM}

[DISABLE]

{$LUA}

local CheatTable=getAddressList();

for i=7000,7002,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end
for i=7014,7015,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end
for i=8000,8013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end
for i=9000,9013,1
do
memoryrecord_unfreeze(CheatTable.getMemoryRecordByID(i))
end

{$ASM}"

Please help me on this guys, I believe it's not that hard but I can't seem to find anything about this, thanks for everyone that answers!!
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