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 automate a process

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

Joined: 01 Jan 2012
Posts: 7

PostPosted: Sat Mar 28, 2020 8:01 am    Post subject: How to automate a process Reply with quote

I have 30 different item slots and each one has 11 different properties that I want to edit.
The offsets for each slot is exactly the same and the offsets for each property from the base address of each slot is exactly the same. Like below

Each slot is offset by 11D0
The property offsets are as such.
Prop 1 - +0
Prop 2 - +8
Prop 3 - +4
Prop 4 - +C
Prop 5 - +28
Prop 6 - +20
Prop 7 - +18
Prop 8 - +5C8
Prop 9 - +5CC
Prop 10 - +5D0
Prop 11 - +5D4

Is there a way I can automate finding all 30 slots and all 11 properties within each of the slots so that I don't have to manually add each property?

I also want to be able to set each property to the exact same value as the ones I set in slot 1.

Eg
Slot 1 - Prop 1 Value 100 <- When I set this
Slot 2 - Prop 1 Value 100 <- this and all subsequent prop 1 values get set.

is there a way to automate this as well?



cap.png
 Description:
 Filesize:  17.95 KB
 Viewed:  1164 Time(s)

cap.png




Last edited by Chamkey on Sat Mar 28, 2020 10:35 am; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Sat Mar 28, 2020 10:35 am    Post subject: Reply with quote

Code:
local firstSlot = getAddress('00AAA300')
local propOffset = { 0, 8, 4, 12, 40, 32, 24, 1480, 1484, 1488, 1492 }

for slot = 1, 30 do
  local header = AddressList.createMemoryRecord()
  header.IsGroupHeader = true
  header.Description = 'Slot '..slot
  for prop = 1, 11 do
    local memrec = AddressList.createMemoryRecord()
    memrec.appendToEntry(header)
    memrec.Description = 'Prop '..prop
    memrec.Type = vtDword
    memrec.Address = getNameFromAddress(firstSlot + (slot - 1) * 4556 + propOffset[prop])
  end
end
(using decimal literals b/c cloudfare seems to get annoyed if you use hexadecimal literals)
Code:
function setAllProperties(prop_i, value)
  local desc = 'Prop '..prop_i
  value = assert(tostring(value))

  for i = 0, AddressList.Count - 1 do
    if AddressList[i].Description == desc then
      AddressList[i].Value = value
    end
  end
end

-- usage: setAllProperties(1, 80)
--        sets all memory records with description "Prop 1" to the value "80"

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Chamkey
How do I cheat?
Reputation: 0

Joined: 01 Jan 2012
Posts: 7

PostPosted: Sat Mar 28, 2020 10:58 am    Post subject: Reply with quote

My word, you're a star.
Hours of work on my side and i couldn't find this solution... I was just about ready to start with a trainer that used for loops...

Edit: Yes, i know i could've set them all by hand in that time but why pass up the opportunity to learn something?
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