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 


Recalulating Addresses

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Mon Sep 26, 2016 2:00 pm    Post subject: Recalulating Addresses Reply with quote

So far I've put this together but I've been unable to find helpful information on how to get each node and update their address, could someone please show me roughly how to complete this
Code:

function myRecalcAddr(node,base)
  base = memoryrecord_getAddress(node)
  -- Don't bother trying if we don't have addr
  if ( addr == nil )
    return false
  end
  if ( base > addr )
    diff = base - addr
    -- Guessed the name and values here
    next = memoryrecord_getSibling(node,1)
  else
    diff = addr - base
  end
  -- Assume Failure
  return false
end
function updateMovementTree()
  -- Is suitable indicator of collision? address
  base = AOBScan("AC C5 27 37 00 00 00 40 00 00 00 00")
  -- This should be the first child of the tree we are going update
  node = getMemoryRecordByDescription("AC C5 27 37 00 00 00 40 00 00 00 00")
  return myRecalAddr( node, base )
end

_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Sep 26, 2016 5:33 pm    Post subject: Reply with quote

No clue what you're trying to do here.
You have so many variables that do absolutely nothing.
Back to top
View user's profile Send private message
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Tue Sep 27, 2016 4:28 am    Post subject: Reply with quote

That's because I can't find the information I need to actually complete the functions, also if you actually look at the names of the functions you should be able to see what I'm attempting to do.
_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Tue Sep 27, 2016 8:48 am    Post subject: Reply with quote

myRecalcAddr probably means you're trying to recalculate an address. Perhaps you should look on google maps first- it's pretty good at finding addresses.
updateMovementTree probably means you're updating a tree that's used for movement. I'm guessing it's not an apple tree since those tend to not move around that often.

Other than that, there's little semantic value with those names (that I can deduce). Just because you understand something doesn't mean other people will. If you describe what you want to accomplish, then others might be able to help you.

Look in main.lua for documentation on most functions, tables, and properties CE has available, and look online for more generic Lua tutorials that teach the syntax of the language if needed.

_________________
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
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Fri Sep 30, 2016 3:37 am    Post subject: Reply with quote

Putting aside your sarcasim the last bit there may have actually been helpful, I'll see if I can find this main.lua you spoke of

Edit 1: Well I corrected some of my mistakes (if not all) and I will test the script by the end of sunday, dunno when I'll feel like playing the game in that time so I won't give an exact time.

Edit 2: Turned I had made a lot of mistakes in the code so couldn't do a proper test, fixed a few then got lazy. I'll see how I feel tommorrow, I'm sure I will feel like trying again at some point during the day.

Edit 3: Eventually tried it, fixed a few more errors then hit a stumbling block, right now I'm not seeing the error so I will post the script and reported error and see if someone can work it out while I'm at work:

Code:
ct = getAddressList()
memoryrecord_recalcAddress = function(root,offset)
  if ( type(offset) ~= "number" ) then
    return false
  end
  local i
  for i = 0, root.Count, 1 do
      local node = root.Child[i]
      local base = tonumber("0x" .. node.Address)
      local addr = base + offset
      memoryrecord_setAddress( node, addr )
      if ( node.Count > 0 and
        memoryrecord_recalcAddress( node, offset ) == false ) then
        return false
      end
  end
  return true
end
function updateMovementTree()
  -- Is suitable indicator of collision? address
  local base = AOBScan("AC C5 27 37 00 00 00 40 00 00 00 00")
  if ( base.Count ~= 1 ) then return false end
  base = tonumber("0x" .. base[0])
  -- This is the tree we are goin to update
  local root = ct.getMemoryRecordByDescription("Movement")
  if ( root == nil ) then
    showMessage("Could not find Movement tree :(")
    return false
  end
  -- This should be the first child of the tree we are going update
  local node = ct.getMemoryRecordByDescription("AC C5 27 37 00 00 00 40 00 00 00 00")
  if ( node == nil ) then
    showMessage("Could not find required node :(")
    return false
  end
  local addr = tonumber( "0x" .. node.Address )
  local offset = addr - base
  -- This is to confirm we actually reached here, to be removed when script is fixed
  showMessage("Attempting to recalculate Movement tree")
  if ( addr > base ) then
    return memoryrecord_recalcAddress(root,addr-base)
  else
    return memoryrecord_recalcAddress(root,-(base-addr))
  end
end
updateMovementTree()

Error:[string "ct = getAddressList()..."]:9: attempt to index local 'node' (a nil value)

_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
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