|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Dec 19, 2021 8:08 am Post subject: |
|
|
use print to see if it's even executed
also, make sure you're using CE 7.3 or later
_________________
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 |
|
|
dharmang1910 Expert Cheater Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Sun Dec 19, 2021 9:46 am Post subject: |
|
|
Dark Byte wrote: | use print to see if it's even executed
also, make sure you're using CE 7.3 or later |
Thank you very much Dark Byte for your reply,
Yes, I have confirmed my version is 7.3.
I have modified script as per your reply as below. I got "This is executed. genaddr=caf3ae0 " as a result in lua engine. And [caf3ae0+10] is address of time.
Code: |
{$luacode genaddr=esi}
if readString(readPointer(readPointer(genaddr))) == 'Time played' then
--local tme = genaddr
--registerSymbol(tme, genaddr, true)
printf("This is executed. genaddr=%x",genaddr)
end
{$asm} |
Edit:
I have modified script as below and this time it worked. I don't know what happened this time. I have done same thing before but this time I have just changed variable name. Is lua requires a bit long variable name length??
Code: |
{$luacode genaddr=esi}
if readString(readPointer(readPointer(genaddr))) == 'Time played' then
playTime = genaddr
registerSymbol(playTime)
--printf("This is executed. genaddr=%x",genaddr)
end
{$asm}
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Dec 19, 2021 9:55 am Post subject: |
|
|
try
Code: |
registerSymbol("xxx", genaddr)
|
and then use the symbol xxx
_________________
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 |
|
|
dharmang1910 Expert Cheater Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Sun Dec 19, 2021 10:05 am Post subject: |
|
|
Dark Byte wrote: | try
Code: |
registerSymbol("xxx", genaddr)
|
and then use the symbol xxx |
Thank you for quick reply.
This also works same as my modified script in my previous post. I am really confused but anyway my problem is solved. I just want to ask that is there any way to auto add found address to the table where Address' description is "string value" , address is "genaddr + 0x10" and type is "double"? This is very useful in shared opcode with too much results. And that also shorten the table coding.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Sun Dec 19, 2021 1:03 pm Post subject: |
|
|
dharmang1910 wrote: | I have tried above "local tme = genaddr" to put value of ESI into tme symbol as above code but it does not worked so I have comment out that line to check if it is disturbing registerSymbol or not. First I have used time as a variable but it shows kernalbase32.time as a address so I have changed it to "tme".
Even "local tme = readInteger(genaddr)" did not worked. | "local tme = genaddr" won't work: again, the first argument to registerSymbol must be a string. tme isn't a symbol: it's a Lua variable. If a Lua variable holds a string and you pass it to registerSymbol, then that string becomes a registered symbol. For example:
Code: | {$luacode genaddr=esi}
if readPointer(genaddr) ~= 0 and readInteger(genaddr + 0x10) == 0 then
local gname = readString(readPointer(readPointer(genaddr)))
local gsymbol = 'gen_'..gname
registerSymbol(gsymbol, genaddr + 0x10, true)
end
{$asm} | Here, the variable gsymbol contains a string. When you pass it to registerSymbol, the string that variable holds becomes a registered symbol.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
dharmang1910 Expert Cheater Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Mon Dec 20, 2021 7:51 am Post subject: |
|
|
ParkourPenguin wrote: | "local tme = genaddr" won't work: again, the first argument to registerSymbol must be a string. tme isn't a symbol: it's a Lua variable. If a Lua variable holds a string and you pass it to registerSymbol, then that string becomes a registered symbol. |
Thank you so much for your valuable guidance , I will remember it. Btw I have modified my previous working script to auto add memrec to the table with help of EpicBirdi's script he has shared on fearless forum. If I am add commented part of script then my game hangs and if I am not then it continuously add same memrec again and again whenever it is accessed by game. I want your suggestion in this script so I can complete this whole script. This topic went longer then my expectation.
Code: |
{$lua}
--EpicBirdi's script shared here "fearlessrevolution.com/viewtopic.php?t=17103"
function createMemrec(memDesc, memAdd, memOffCount, memType, memColor, memOffs, memAAScript, memActive, memHex, memSigned)
local al=getAddressList()
local newMemRec = al.createMemoryRecord()
newMemRec.setAddress(memAdd)
newMemRec.setDescription(memDesc)
newMemRec.setOffsetCount(memOffCount)
newMemRec.Type = memType
if newMemRec.Type == 11 then
newMemRec.Script = memAAScript
end
newMemRec.Color = memColor
local OC = newMemRec.getOffsetCount()
if OC > 0 then
for i=0, OC-1 do
local CO = memOffs[i+1]
newMemRec.setOffset(i,CO)
end
end
if memActive ~= true then
newMemRec.Active = false
else
newMemRec.Active = true
end
if memHex ~= true then
newMemRec.ShowAsHex = false
else
newMemRec.ShowAsHex = true
end
if memSigned ~= true then
newMemRec.ShowAsSigned = false
else
newMemRec.ShowAsSigned = true
end
end
{$asm}
[ENABLE]
aobscanmodule(genbase,TOD.exe,46 10 C7 46 10 00 00 00 00) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
newmem:
{$luacode genaddr=esi}
if readPointer(genaddr) ~= 0 and readInteger(genaddr + 0x10) == 0 then
local gname = readString(readPointer(readPointer(genaddr)))
local gaddr = genaddr + 0x10
--local i
--for i=0, al.Count-1 do
-- if al[i].Description ~= gname then
createMemrec(gname,gaddr,0,vtDouble)
-- end
--end
end
{$asm}
code:
mov [esi+10],00000000
jmp return
genbase+02:
jmp newmem
nop 2
return:
registersymbol(genbase)
[DISABLE]
genbase+02:
db C7 46 10 00 00 00 00
unregistersymbol(genbase gsymbol)
dealloc(newmem) |
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Mon Dec 20, 2021 2:02 pm Post subject: |
|
|
The {$lua} block is missing "if syntaxcheck then return end" at the top, but since it's only defining a function, it shouldn't cause any issue.
The variable "al" isn't defined in the {$luacode} block. CE defines a global AddressList variable: use that instead.
And again, {$luacode} blocks are run on a different thread than CE's main thread. You really shouldn't be accessing the GUI at all from a different thread.
The function createTimer should execute the provided function in the main thread. If that doesn't work for whatever reason, the synchronize function will work (see celua.txt and search for examples), but it's a blocking operation.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
dharmang1910 Expert Cheater Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Wed Dec 22, 2021 9:39 am Post subject: |
|
|
ParkourPenguin wrote: | The {$lua} block is missing "if syntaxcheck then return end" at the top, but since it's only defining a function, it shouldn't cause any issue.
The variable "al" isn't defined in the {$luacode} block. CE defines a global AddressList variable: use that instead.
And again, {$luacode} blocks are run on a different thread than CE's main thread. You really shouldn't be accessing the GUI at all from a different thread.
The function createTimer should execute the provided function in the main thread. If that doesn't work for whatever reason, the synchronize function will work (see celua.txt and search for examples), but it's a blocking operation. |
Thank you ParkourPenguin for tips. You are right, "al" is defined in function and not in general. After defining in luacode script works fine and I have changed it like below. One problem is that all address are being added just below of script so, Is there any way to add them as children of the script, so they are hidden when script is disabled by choosing "Hide children when deactivated".
Code: |
{$luacode genaddr=esi}
if readPointer(genaddr) ~= 0 and readInteger(genaddr + 0x10) == 0 then
local gname = readString(readPointer(readPointer(genaddr)))
local gaddr = genaddr + 0x10
local al=getAddressList()
local gmemrec = al.getMemoryRecordByDescription(gname)
if gmemrec == nil then
createMemrec(gname,gaddr,0,vtDouble)
else
gmemrec.setAddress(gaddr)
end
end
{$asm} |
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Wed Dec 22, 2021 1:48 pm Post subject: |
|
|
Use MemoryRecord.appendToEntry. Read celua.txt for documentation, and use a search engine to find examples. Information might also be on the CE wiki.
The variable memrec isn't passed to {$luacode} like it is to {$lua}, so you'll need to copy it like I do in this post:
https://forum.cheatengine.org/viewtopic.php?p=5775576#5775576
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
dharmang1910 Expert Cheater Reputation: 0
Joined: 09 May 2010 Posts: 102
|
Posted: Mon Dec 27, 2021 8:07 am Post subject: |
|
|
ParkourPenguin wrote: | Use MemoryRecord.appendToEntry. Read celua.txt for documentation, and use a search engine to find examples. Information might also be on the CE wiki. |
Thank you very much for all your valuable help. "MemoryRecord.appendToEntry" command worked. Actually I don't know command for children records, but with your and Dark byte's help, I have completed my table for this game successfully. Actually this game is GameMaker Studio game and so making table for this engine's game is not so easy compare to other game engine but somehow with help of yours and DB I have made it. I really appreciate that you have introduced me about newly added Luacode feature.
|
|
Back to top |
|
|
|
|
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
|
|