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 


Changing a Value's Address Using script?

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

Joined: 04 Jan 2015
Posts: 136

PostPosted: Sun Jan 04, 2015 6:52 am    Post subject: Changing a Value's Address Using script? Reply with quote

Hey Everyone So This Is my first post around here hopefully someone would help me Very Happy

i was wondering if i can change a value's address (stored in the ct table description is health for example) constantly or at least after a fight is over using lua

if you ask why is that needed just find a pointer?
then the game (actually ps2 game emulated through ps2 emulator) has no pointer for a value so Confused
every single address for every single fighter in every single chapter Evil or Very Mad
that means atleast 100 addresses lol

i found a semi-pointer thingy (aob scan result)+offset= current character health so a lua script to change/update result?

edit: after some searching i did this but its not adding the address to the list?
Code:
function aobs()
dh=createMemScan()
memscan_firstScan(dh,soExactValue,vtByteArray,rtTruncated,"4F 50 52 54 0? 00","" , "21860000", "21A2FFFF", "", fsmNotAligned, "", true, false, false, false)
memscan_waitTillDone(dh)
dhfl=createFoundList(dh)
foundlist_initialize(dhfl)
local count=foundlist_getCount(dhfl)
if (count<1) then
local p1static=foundlist_getAddress(dhfl, 0)
local p2static=foundlist_getAddress(dhfl, 1)
local p1slot=p1static.."+ac+2f4"
local p2slot=p2static.."+ac+2f4"
print("Adding Health Address to the list")
end
local al=getAddressList()
local mr=addresslist_createMemoryRecord(al)
memoryrecord_setDescription(mr,"Health P1")
memoryrecord_setAddress(mr, p1static.."+ac+a4*"..p1slot)
memoryrecord_setType(mr, vtDword)
end

no errors but no address is added to the list
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sun Jan 04, 2015 2:28 pm    Post subject: Reply with quote

1: that's really old syntax (it's now dh.firstScan(soExactValue,..... etc...)
2: you're checking if count is smaller than 1 (so 0). You probably want >
3: you do +ac+2f4 why not +3a0 ?
Did you intend on using it like a pointer ?
If so, you may want to set the record up as a pointer instead
Code:

mr=getAddressList().createMemoryRecord()
mr.Address=p1static
mr.OffsetCount=2
mr.Offset[1]=0xac
mr.Offset[2]=0x2f4
mr.Description="Health P1"


It may be easier to just have a pre-existing entry in the addresslist where you just edit the baseaddress. (just change mr.Address to the new p1static)

if it is a dynamic offset, you may want to use readInteger to read the value (or readBytes if it's a 2 byte)

4: You declare the function aobs. Do you call it as well ?

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Alamer99
Expert Cheater
Reputation: 1

Joined: 04 Jan 2015
Posts: 136

PostPosted: Tue Jan 06, 2015 4:32 am    Post subject: Reply with quote

[after reading your comment and main.lua Razz]

1.updated code in attachments
2.removed if since result is always 2 addresses
3.most of my offsets are ac+xx+xx*p1fslot so ac+2f4 or 3a0 same i just want to get its value Razz

3.answer1/ no its not a pointer a single stage have atleast 3 fighters in your team and 1 enemy (some stages have 3 enemies and more) and every fighter no matter if enemy or in my team have 27 addresses(for my table) thats why i do the offsets and p1fslot to get the character slot
p1static.."+xx*"..p1fslot
p1static helps giving the addresses as well p1 slot the first character is in slot 0 that mean offsets * p1slot(0) will give me its details (energy,...etc) if p1slot is 0 then character #1 if p1 slot is 1 then character #2's data and so on

3.answer2/ if i use it like a pointer how would i change the address continuously and offset as p1fslot and some offsets in minus "-"

4.yes i want it to get called when activating story mode cheats (normal fighting mode have a p1static that doesnt change yes its easier since p1static is "static")

i uplaoded my table (code in cheat table lua) but i still have some questions

1/how to use lua script to get executed while activating header? (lua script to auto assembly script?)

2/how to get the addresses to update themselves if character is different
(changed character)? i have the value to get the character playing with but idk how to get it to compare itself by itself? itself0 (value stored from itself1 (unchangable) while itself1 is a changable value, then if changed itsleft0=itself1's value and repeat/reactivate script?
[thats headache Laughing ]

EDIT: you misunderstood something
Code:
mr=getAddressList().createMemoryRecord()
mr.Address=p1static
mr.OffsetCount=2
mr.Offset[1]=0xac
mr.Offset[2]=0x2f4
mr.Description="[i]Health P1[/i] P1 Slot"

this code is p1 slot not health
if health it should be like this
Code:
mr=getAddressList().createMemoryRecord()
mr.Address=p1static
mr.OffsetCount=3 //or count 2
mr.Offset[1]=+ac //offset 1 = ac+a4 = 150 the same :D the offset 2 =*..p1slot
mr.Offset[2]=+a4
mr.offset[3]=*..p1fslot
mr.Description="Health P1"

i wrote the "+" sign because i have some offsets in "-" too
example damage bonus p1 = p1static +ac-30+a4* p1fslot



pcsx2-r5875.CT
 Description:

Download
 Filename:  pcsx2-r5875.CT
 Filesize:  41.88 KB
 Downloaded:  845 Time(s)

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