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 


Open dissect data with struct and address

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting -> Lua Extensions
View previous topic :: View next topic  
Author Message
jgoemat
Expert Cheater
Reputation: 21

Joined: 25 Sep 2011
Posts: 217

PostPosted: Mon Jul 16, 2018 9:00 pm    Post subject: Open dissect data with struct and address Reply with quote

This function will use an existing structure dissect window with the specified structure or create one if one doesn't exist and add the specified address as a string:

Code:
function AddAddressToStructureForm(structName, addressString)
  local frm = nil
  for i,v in ipairs(enumStructureForms()) do
    local struct = v.MainStruct
    if struct ~= nil then
      if struct.Name == structName then
        frm = v
        break
      end
    end
  end
  if frm == nil then
    -- TODO: Create new form
    createStructureForm(addressString, nil, structName)
    return
  end
  local col = frm.addColumn()
  col.AddressText = addressString
  col.Focused = true
  return col
end


Here's a sample script I'm using it in so they can enable/disable for a 'Unit' structure I have and a pointer to the last unit that was manually moved in the game:

Code:
[ENABLE]
{$lua}
if syntaxcheck then return end
local addr = string.format('%x', getAddressSafe('[pLastManuallyMovedUnit]'))
AddAddressToStructureForm('Unit', addr)
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
local addr = string.format('%x', getAddressSafe('[pLastManuallyMovedUnit]'))
AddAddressToStructureForm('Unit', addr)
{$asm}
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 -> Lua Extensions 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