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 Address with Lua Script

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

Joined: 16 Aug 2013
Posts: 26

PostPosted: Sun Oct 09, 2016 2:09 pm    Post subject: How to change Address with Lua Script Reply with quote

I want to edit address that I add using memoryrecord_setAddress(). This is my current logic
Code:
ms=createMemScan()
memscan_firstScan(ms, soValueBetween, vtDword, rtRounded,
      12345 , 12345 , 0, 0xffffffffffffffff, "+W-C",
      fsmAligned, "4", false, false, false, false) --change the last true to false if you do not wish case sensitivity
memscan_waitTillDone(ms)


fl=createFoundList(ms)
foundlist_initialize(fl)
local count=foundlist_getCount(fl)

if (count>0) then
   local i
    for i=0,fl.Count-1 do
        local saddress=foundlist_getAddress(fl, i)
        print("This Address"..saddress.." is going to the list")

        local al=getAddressList()
        local mr=addresslist_createMemoryRecord(al)

        memoryrecord_setAddress(mr, saddress)
    end
else
  print("No addresses found")
end


object_destroy(fl)
object_destroy(ms)

Now when I run this script this added adress "0E6B7E28". Now I want that Added address should be Add 0E6B7E3A. That I got using Change Address so u can see image 1.png in which i change that Adrees and wanted the required address like in 2.png



2.PNG
 Description:
 Filesize:  37.84 KB
 Viewed:  10410 Time(s)

2.PNG



1.PNG
 Description:
 Filesize:  70.97 KB
 Viewed:  10410 Time(s)

1.PNG




Last edited by azamalvi on Wed Oct 12, 2016 4:45 am; edited 2 times in total
Back to top
View user's profile Send private message
usernotfound
Expert Cheater
Reputation: 0

Joined: 21 Feb 2016
Posts: 115

PostPosted: Sun Oct 09, 2016 4:44 pm    Post subject: Reply with quote

Yes you can use writeInteger along with some other write functions, check main.lua for parameters: https://raw.githubusercontent.com/cheat-engine/cheat-engine/master/Cheat%20Engine/bin/main.lua
Back to top
View user's profile Send private message
azamalvi
Cheater
Reputation: 0

Joined: 16 Aug 2013
Posts: 26

PostPosted: Tue Oct 11, 2016 3:57 am    Post subject: Reply with quote

Hi Black Mage!
I did not find any function that use it for Address changing
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue Oct 11, 2016 7:39 am    Post subject: Reply with quote

Get a change of address forum for the country you reside in and fill it out. CE can't help you change the address you live at.

I'm assuming you're not talking about an address in a process's virtual address space since that doesn't make any sense. I suppose you could mess around with the page table, but I don't know why you would want to.

If you're talking about changing a pointer, use writeInteger / writeQword.

_________________
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
azamalvi
Cheater
Reputation: 0

Joined: 16 Aug 2013
Posts: 26

PostPosted: Wed Oct 12, 2016 4:47 am    Post subject: Reply with quote

Hi ParkourPenguin!

Sorry my way of explanation was not right. I updated my question. Now u can get better understanding what I actually want.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Wed Oct 12, 2016 5:26 am    Post subject: Reply with quote

memoryrecord_setAddress(mr, saddress+0x12)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Oct 12, 2016 7:46 am    Post subject: Reply with quote

Minor note: you shouldn't be using those old functions.
Code:
ms = createMemScan()
-- firstScan(scantype, vartype, round, input1, input2, startAddr, stopAddr, protection, align, alignParam, hex, binary, unicode, caseSensitive)
ms.firstScan(soValueBetween, vtDword, 0, "12345", "12345", 0x0, 0xffffffffffffffff, "+W-C", fsmAligned, "4", false, false, false, false)
ms.waitTillDone()

fl = createFoundList(ms)
fl.initialize()

local al = getAddressList()

for i=0, fl.Count-1 do
  local mr = al.createMemoryRecord()
  mr.Address = fl.Address[i]  .. "+12"
end

fl.deinitialize()
fl.destroy()

ms.destroy()

If you don't want the +12 in there and would like the script to automatically calculate the resulting address, do as predprey suggested (but try to avoid the old functions).

_________________
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
azamalvi
Cheater
Reputation: 0

Joined: 16 Aug 2013
Posts: 26

PostPosted: Wed Oct 12, 2016 9:50 am    Post subject: Reply with quote

Very thanks predprey and ParkourPenguin.
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