|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
otb Advanced Cheater Reputation: 2
Joined: 27 Jan 2015 Posts: 70
|
Posted: Wed Sep 02, 2015 7:17 pm Post subject: Is it possible to set Address based on Process name? |
|
|
There are multiple interpreters for a game, each have different EXE names and addresses, but the cheat offsets are the same between all engines.
Currently I have it set up as groups of Pointers with the Address (File.exe+ABCD, same across all groups) and one file for each of the engines. Is there a way I could simplify this into one file with an LUA script that sets the Address based on the attached process name?
I don't know LUA, so everything I have (which isn't much) has been (poorly) cobbled from other posts, but I'm stuck with finishing it up: Code: | function onOpenProcess(ProcessID)
--Need a way to convert ProcessID to ProcessName and/or path
--Two similar process names... Maybe look at path, and use if in pathname
if ProcessName="wingit.exe" --Gargoyle
MyAddress="git.exe+161CC"
else if ProcessName="Git.exe" --WinGit
MyAddress="Git.exe+1B1E8"
else if ProcessName="Glulxe.exe" --WinGlulxe
MyAddress="Glulxe.exe+10238"
else
showMessage("Unknown Interpreter.")
end
--Unsure of how to set MyAddress as the pointer's address
end |
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Sep 02, 2015 8:55 pm Post subject: |
|
|
Conditional if statements require two equal signs to test equality
If statements end with a "then"
"elseif" is a single command
Can use various functions to determine if the given module name is accessible to CE
Code: | -- setup a hash to help you organize the names and their offset
offset_list = {
["wingit.exe"] = "161CC",
["Git.exe"] = "1B1E8",
["Glulxe.exe"] = "10238"
}
function onOpenProcess(ProcessID)
for i,v in pairs(offset_list) do -- loop through each item in the hash
local size = getModuleSize(i) -- check if the module name exists
if size ~= nil then -- if it doesn't exist, the function returns nil
-- we found it, combine the name, '+', and offset strings to
-- register a symbol that you can reference within your table
registerSymbol("MyPointer", i.."+"..v, true)
return -- module found, exit function
end
end
showMessage("Unknown Interpreter.") -- nothing found, alert user
end |
|
|
Back to top |
|
|
otb Advanced Cheater Reputation: 2
Joined: 27 Jan 2015 Posts: 70
|
Posted: Thu Sep 03, 2015 12:14 am Post subject: |
|
|
Thanks a ton for the help, and the explination of what I did wrong.
But now I've run into two problems... First, when I attach CE to the program it always tells me Unkown, but it works once I reattach. Second, I mistyped my exe names, they should be "git.exe" and "Git.exe", which I have fixed in the script, but is causing a problem since it will only selects the first entry of "git.exe+161CC"
I see what it's doing now, it's using the Process name to read the offset amount, but I need it to compare the offset and get process name. I'll look more into how to do that.
Not sure what the Size variable is, I'll spend some time today reading up on LUA. Thanks again for the help, I feel like I'm really close, just need to know more of the actual codes to progress.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Sep 03, 2015 11:15 am Post subject: |
|
|
Code: | -- list of process names with their corresponding offsets
offset_list = {
["wingit.exe"] = "161CC",
["Git.exe"] = "1B1E8",
["Glulxe.exe"] = "10238"
}
-- function to retrieve process name from id
function GetProcessNameFromId(processId)
local processName = nil
local list = createStringlist()
getProcesslist(list)
for i = 0, list.Count-1 do
local id, name = list.String[i]:match("(.*)-(.*)")
if processId == tonumber(id, 16) then
processName = name
break
end
end
return processName
end
-- function to call when attached
function onOpenProcess(processId)
-- find our process name
local processName = GetProcessNameFromId(processId)
-- find our offset
local offset = nil
if processName ~= nil then
offset = offset_list[processName]
end
if offset == nil then
-- name or offset was not found
showMessage("Unknown Process: " .. processName)
else
-- register our table variable
registerSymbol("MyPointer", processName.."+"..offset, true)
end
end |
|
|
Back to top |
|
|
otb Advanced Cheater Reputation: 2
Joined: 27 Jan 2015 Posts: 70
|
Posted: Wed Sep 16, 2015 7:02 pm Post subject: |
|
|
Sorry to bother you again, but I'm getting an error when I attach Cheatengine to the proper process: Quote: | Error:Failure determining what <process>+<offset> means |
It does not happen to "unknown" processes, which helped me tracked the error down to this line: Code: | registerSymbol("MyPointer", processName.."+"..offset, true) |
Specifically the registering of text, the processName variable, since having just the offset variable gives me no errors, and properly sets MyPointer to a(n incorrect) value.
Possibly as a conciquence of this, I think the script just breaks/quits at this point, the values do not load and I have to re-attach CE to the process which works without an issue.
I've been working to fix a problem with this for a while now, and I just can't figure it out. I've gone through and "echo"'d all the variables (via showMessage), ripped out all the code and added it back line-by-line to get a better feel for how it works. I have tried adding literal quotes around the processName variable, but still got the same error. I have a better understanding of the code, and probably a slighty better understanding of LUA in general, but still not enough to fully troubleshoot or fix this beyond what I have tried.
Thank you again for all your help.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Sep 16, 2015 8:17 pm Post subject: |
|
|
Did you copy the code exactly as is or did you make some changes to it?
That is an odd error. It sounds like your code somewhere sets:
processName = "<process>"
offset = "<offset>"
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 54
Joined: 01 Oct 2008 Posts: 941
|
Posted: Wed Sep 16, 2015 11:04 pm Post subject: |
|
|
otb wrote: | Sorry to bother you again, but I'm getting an error when I attach Cheatengine to the proper process: Quote: | Error:Failure determining what <process>+<offset> means |
It does not happen to "unknown" processes, which helped me tracked the error down to this line: Code: | registerSymbol("MyPointer", processName.."+"..offset, true) |
Specifically the registering of text, the processName variable, since having just the offset variable gives me no errors, and properly sets MyPointer to a(n incorrect) value.
Possibly as a conciquence of this, I think the script just breaks/quits at this point, the values do not load and I have to re-attach CE to the process which works without an issue.
I've been working to fix a problem with this for a while now, and I just can't figure it out. I've gone through and "echo"'d all the variables (via showMessage), ripped out all the code and added it back line-by-line to get a better feel for how it works. I have tried adding literal quotes around the processName variable, but still got the same error. I have a better understanding of the code, and probably a slighty better understanding of LUA in general, but still not enough to fully troubleshoot or fix this beyond what I have tried.
Thank you again for all your help. |
Probably the symbol is not ready (ce not knowing "wingit.exe" as an address at that specific moment) when the registersymbol is executed. Read note 2 below from main.lua@ce dir. Put reinitializeSymbolhandler() before registersymbol should fix it~
Code: | function onOpenProcess(processid):
If this function is defined it will be called whenever cheat engine opens a process.
Note: The the same process might be opened multiple times in a row internally
Note 2: This function is called before attachment is fully done. You can call reinitializeSymbolhandler() to force the open to complete, but it will slow down process opens. Alternatively, you could launch a timer which will run when the opening has finished
|
_________________
- Retarded. |
|
Back to top |
|
|
otb Advanced Cheater Reputation: 2
Joined: 27 Jan 2015 Posts: 70
|
Posted: Wed Sep 16, 2015 11:50 pm Post subject: |
|
|
panraven wrote: | Probably the symbol is not ready (ce not knowing "wingit.exe" as an address at that specific moment) when the registersymbol is executed. Read note 2 below from main.lua@ce dir. Put reinitializeSymbolhandler() before registersymbol should fix it~ | Worked like a charm, thanks!
|
|
Back to top |
|
|
Palpatin How do I cheat? Reputation: 0
Joined: 16 Aug 2016 Posts: 3
|
Posted: Sat Aug 20, 2016 5:52 am Post subject: Character window |
|
|
If you want a wonderfuller characer window in drawn version/ -> which is only
in alpha build, add another value (3) to character window list.
(set/change dropdown ...)
so it will look like this
0:Off
2:Danaume
1:Keriax
3:Taurus
|
|
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
|
|