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 


Auto-Load Corresponding Cheat Table On Attach

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
Game Hacking Dojo
Master Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 250

PostPosted: Wed May 08, 2024 5:11 am    Post subject: Auto-Load Corresponding Cheat Table On Attach Reply with quote

This script will auto-load your cheat table once you attach CE to the process.
It will prompt you with a dialogue if it finds more than two files matching the description.
It will search for your cheat table in the specified folder.

Tip: Make a directory for all game hacks and subdirectories for each title.

All automated and GL HF

Code:
local lfs = require("lfs")
local file = ""
local foundFile = ""
local foundFilePath = ""
local fileDir = ""
local searchDirectory = "D:\\myDirectory\\mySubDirectory\\Game Hacks"
local fileExtension = ".ct"

function getCTfile()
   local foundFileCount = 0
   local processName = process:gsub("%.exe$", "")
   for _,filePath in ipairs(getFileList(searchDirectory, '*.ct', true)) do
     --print(file)
     if string.find(string.lower(filePath), string.lower(processName), 1, true) then
        foundFileCount = foundFileCount + 1

        --print("Found file full path: "..filePath)
        file = extractFileName(filePath)
        --print("Found file name: "..file)
        fileDir = extractFilePath(filePath)
        --print("Found file directory: "..fileDir)
        foundFile = file
        foundFilePath = filePath

       if foundFileCount > 1 then
          --Load Dialog
         loadCTDialog = createOpenDialog()
         loadCTDialog.Title = "Load Cheat Table"
         loadCTDialog.FileName = foundFile
         loadCTDialog.InitialDir = fileDir
         loadCTDialog.DefaultExt = ".ct"
         loadCTDialog.Filter = "Cheat Table Files (*.ct)|*.ct"
         loadCTDialog.Options = "[ofOverwritePrompt, ofHideReadOnly, ofEnableSizing]"
           --print("Found more than one file matching the description")

         if loadCTDialog.Execute() then
            loadTable(loadCTDialog.FileName)
         else
            return
         end
        end
     end
   end
     if foundFileCount == 1 then
      loadTable(foundFilePath)
      --ShowMessage("*** Cheat table has been load ***\n *** "..foundFile.." ***")
   end
end

MainForm.OnProcessOpened = function()
   createThread(function()   getCTfile() end)
end
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions 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