|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
jeff.artik Guest
|
Posted: Sun Jun 11, 2017 5:21 am Post subject: Loop until entry can be applied then auto close trainer |
|
|
Hi! I started a little CT for TEKKEN7 that starts the game, then I press F1 and it switch to 21:9 mode. Actually this function works perfectly, but I want to improve the automate the tasks, till I reach the perfect trainer. Here is my LUA script:
Code: | <LuaScript>shellExecute('C:\\Program Files (x86)\\Steam\\steamapps\\common\\TEKKEN 7\\TekkenGame\\Binaries\\Win64\\TekkenGame-Win64-Shipping.exe')
function myattach(timer)
if getProcessIDFromProcessName("TekkenGame-Win64-Shipping.exe") ~= nil then
object_destroy(timer)
openProcess("TekkenGame-Win64-Shipping.exe")
end
end
f=createForm(false) --create an invisible window
t=createTimer(f);
timer_setInterval(t,1000) --10 might have been too fast for xp...
timer_onTimer(t,myattach)
function changevalues(timer)
getAddressList().getMemoryRecordByDescription("Black_Bars").Active=true
getAddressList().getMemoryRecordByDescription("FOV").Active=true
end
f=createForm(false) --create an invisible window
t=createTimer(f);
timer_setInterval(t,50000) --10 might have been too fast for xp...
timer_onTimer(t,changevalues)
</LuaScript> |
The problem here is I need to wait the game starts to apply both values. I tried with a timer, boxes auto check at the end of the timer, but I don't know why it's not applied during the game. When I manually press F1, it works. As soon as they're applied, I don't need to use F1 anymore.
My first question is:
1. How to create a check that loop these 2 values until they can be applied? Sometimes I stay on the TEKKEN main menu for 3minutes until I start a first game, sometimes 20 secondes.
The goal would be to loop till it's applied then stop. My second one is:
2. How to auto-close trainer when both values are applied?
I think you understood, I would love to get the perfect trainer that:
- Launch the game
- Auto apply values when i start the game (timing is always differ)
- Close the trainer when values are applied, like this no need to do it manually each time I quit TEKKEN.
Many thanks for your help
|
|
Back to top |
|
|
atom0s Moderator Reputation: 199
Joined: 25 Jan 2006 Posts: 8518 Location: 127.0.0.1
|
Posted: Sun Jun 11, 2017 1:10 pm Post subject: |
|
|
When Cheat Engine opens a target process, Lua has a callback function for it:
Code: | function onOpenProcess(procid) |
You can use this to tell if CE is attached to your process. procid is the process id that it is attached to. You can validate the process doing something like this:
Code: | ----------------------------------------------------------------------------------------------------
-- func: CheckValidProcess
-- desc: Ensures the process selected is our target process by its name.
----------------------------------------------------------------------------------------------------
local function CheckValidProcess(pid, name)
local procs = getProcesslist();
for k, v in pairs(procs) do
if (k == pid) then
if (tostring(v):lower() == name:lower()) then
return true;
end
end
end
return false;
end
----------------------------------------------------------------------------------------------------
-- func: onOpenProcess
-- desc: Callback invoked when a process is opened by Cheat Engine.
----------------------------------------------------------------------------------------------------
function onOpenProcess(procid)
-- Ensure the correct process is selected..
if (not CheckValidProcess(procid, 'YourProcessNameHere.exe')) then
error('Attached to the wrong process.');
return;
end
-- Force the open process to complete..
reinitializeSymbolhandler();
-- Do your code here..
end |
At the end where I put the comment 'do your code here' is where you would want to do your personal cheat stuff for what you are doing.
_________________
- Retired. |
|
Back to top |
|
|
jeff.Artik Guest
|
Posted: Sun Jun 11, 2017 6:22 pm Post subject: |
|
|
Ok, So I adapted the script with your help. I have now:
Code: | shellExecute('C:\\Program Files (x86)\\Steam\\steamapps\\common\\TEKKEN 7\\TekkenGame\\Binaries\\Win64\\TekkenGame-Win64-Shipping.exe')
function myattach(timer)
if getProcessIDFromProcessName("TekkenGame-Win64-Shipping.exe") ~= nil then
object_destroy(timer)
openProcess("TekkenGame-Win64-Shipping.exe")
end
end
f=createForm(false) --create an invisible window
t=createTimer(f);
timer_setInterval(t,1000) --10 might have been too fast for xp...
timer_onTimer(t,myattach)
----------------------------------------------------------------------------------------------------
-- func: CheckValidProcess
-- desc: Ensures the process selected is our target process by its name.
----------------------------------------------------------------------------------------------------
local function CheckValidProcess(pid, name)
local procs = getProcesslist();
for k, v in pairs(procs) do
if (k == pid) then
if (tostring(v):lower() == name:lower()) then
return true;
end
end
end
return false;
end
----------------------------------------------------------------------------------------------------
-- func: onOpenProcess
-- desc: Callback invoked when a process is opened by Cheat Engine.
----------------------------------------------------------------------------------------------------
function onOpenProcess(procid)
-- Ensure the correct process is selected..
if (not CheckValidProcess(procid, 'TekkenGame-Win64-Shipping.exe')) then
error('Attached to the wrong process.');
return;
end
-- Force the open process to complete..
reinitializeSymbolhandler();
getAddressList().getMemoryRecordByDescription("Black_Bars").Active=true
getAddressList().getMemoryRecordByDescription("FOV").Active=true
end
</LuaScript> |
I launch the game, and when I quit it, both boxed are checked, but it was not applied during the game. Maybe too early, I really don't know. F1 still works
|
|
Back to top |
|
|
jeff.artik Guest
|
Posted: Sun Jun 11, 2017 6:27 pm Post subject: |
|
|
I targeted what I tought, the activation of the cheats are effective even before the game has started. So in this case I don't think the memory can be changed.
Is there any possibility of an error return if the value still doesn,'t exists in the memory ? And loop till it appears and being applied ?
I know starts to be complicated
|
|
Back to top |
|
|
|
|
You can post new topics in this forum You can 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
|
|