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 


CE background through Lua

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mack_b_nibble
How do I cheat?
Reputation: 0

Joined: 08 May 2025
Posts: 3

PostPosted: Thu May 08, 2025 1:07 pm    Post subject: CE background through Lua Reply with quote

hey guys, im trying to develop a custom theme for my CE through lua files but im having a few issues trying to get everything working.

So far ive got most of the main bits accomplished but im having issues with a few small things like replacing the logo and such. if anyone has any suggestions id be immensely grateful as im brand new to lua so its been slow going

Ive uploaded a mock table so theres a visual. please feel free to download it and rip the script out of it to manipulate

i keep trying to add the table that ive made as a visual test but CE wiki says its an empty file and i dont understand why so sorry for that.and CE wiki also wont allow me to post url to have it at mega so fuck me i guess


Last edited by mack_b_nibble on Fri May 09, 2025 12:10 am; edited 1 time in total
Back to top
View user's profile Send private message
mack_b_nibble
How do I cheat?
Reputation: 0

Joined: 08 May 2025
Posts: 3

PostPosted: Fri May 09, 2025 12:10 am    Post subject: Reply with quote

ive since updated my script to better handle the logo as well as added some options for the settings form text color. If anyone know how i can properly reload a form i need to be able to reload my mainform gui with some authors tables due to initial loading. If a table is defaulted to compact mode it breaks the initial laying of images so I need an easy way to reload the form withough having to reinject my lua file over and over


SharingBackground.lua
 Description:

Download
 Filename:  SharingBackground.lua
 Filesize:  4 KB
 Downloaded:  190 Time(s)

Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1486

PostPosted: Sat May 10, 2025 4:01 pm    Post subject: Re: CE background through Lua Reply with quote

mack_b_nibble wrote:
.and CE wiki also wont allow me to post url to have it at mega so fuck me i guess


Maybe proving that you are a serious user (15-20 posts, replies etc.) can unlock features like uploading images, sharing URLs and more.

Also, I think you can be a bit more gentle.
--============================--

Here is the method for uploading an image for the first step, implementing it and playing it back on subsequent CE form openings.

You can expand the save and restore content, add colors or whatever you want for other controls (FoundList, AddressList).

--============================--
Put the code in a .lua file and drop the file in the CE>>autorun folder. Start using it from the menu at the end of the code.

Menu usage:
If an image is selected, it is loaded and the image is saved in the CE autorun folder.
If the image is not selected (if the "Cancel" button is clicked), it returns to its original state.

Code:
scriptFile = getAutorunPath()
mf = getMainForm()
p5= mf.Panel5

imgsett=getSettings('test22')
local mfbck1 = 0
local mfbck2 = ""

function SaveClr11()
  imgsett.Value['mfbck1'] = mfbck1
  imgsett.Value['mfbck2'] = mfbck2
end

function p5Load(link, opt)
  if opt==1 then
     if mfb then mfb.Destroy() mfb=nil end
     mfb = createImage(mf)
     mfb.Left = p5.Left
     mfb.Top = p5.Top
     mfb.Width = mf.Width
     mfb.Height = p5.Height
     mfb.Anchors = "akLeft, akTop, akRight"
     mfb.Stretch = true
     p = createPicture()
     p.loadFromFile(link)
     b = p.getBitmap()
     mfb.Picture = b
     p.Destroy()
  elseif opt==0 then
     if mfb then mfb.Destroy() mfb=nil end
  end
end

function LoadClr11()
  if imgsett.Value['mfbck1']~=nil then
     mfbck1 = imgsett.Value['mfbck1']
     mfbck2 = imgsett.Value['mfbck2']
     if mfbck1=="1" then
        file = scriptFile..mfbck2
        p5Load(file, 1)
     else
        p5Load("", 0)
     end
  end
end

function slctImage()
load_dialog = createOpenDialog()
load_dialog.InitalDir = os.getenv('%USERPROFILE%')
load_dialog.execute()
  if load_dialog.FileName~=nil then
    file = load_dialog.FileName
    wrt4 = "mf_background.png" --extractFileName(file)
    --print(file) print(wrt4) print(scriptFile)
    p = createPicture()
    p.loadFromFile(file)
    p.saveToFile(scriptFile..wrt4)
    p.Destroy()
    p5Load(scriptFile..wrt4, 1)
    mfbck1 = 1
    mfbck2 = wrt4
    SaveClr11()
  else
    p5Load("", 0)
    mfbck1 = 0
    wrt4 = "mf_background.png"
    os.remove(scriptFile..wrt4)
    SaveClr11()
  end
end

LoadClr11()
--==============================================--
local mainMenu = mf.Menu.Items
if mibckmn then mibckmn.Destroy() mibckmn=nil end
mibckmn = createMenuItem(mf.MainMenu)
mibckmn.Name = 'mibckmn'
mibckmn.Caption = 'CE_EFC'
mainMenu.insert(mainMenu.Count-1,mibckmn)

mibck1 = createMenuItem(mibckmn)
mibck1.Caption = 'MainForm Back'
mibck1.onClick = slctImage
mibckmn.add(mibck1)
--==============================================--

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mack_b_nibble
How do I cheat?
Reputation: 0

Joined: 08 May 2025
Posts: 3

PostPosted: Sat May 10, 2025 5:40 pm    Post subject: Reply with quote

awesome, thank you for the pointers! and i apologize for the harshness i was sleepy and frustrated and im not usually one to interact on websites id rather just lurk unless absolutely necessary lol so the post limit is hard for me to actually hit, ive been using this site for a while but only recently made the account to make this post. Either way Ill definitely take a look into your method with the menus for sure, but at the moment i was just trying to get a solid concept together that looks good and functions. ultimately i want them to all be table files so i can have multiple custom tables for my games that just load when i open the saved cheat table file. i currently have 2 versions that im building. one loads table files the other loads from my autorun path. one is for individual tables and one is basically a universal. im also pretty green in terms of scripting and anything programming related so my understanding of some functions in nonexistent XD this is my unfortunately complicated learning project. i have a "semi updated" file that is nothing like yours but its all a learning curve


SharingBackground.lua
 Description:

Download
 Filename:  SharingBackground.lua
 Filesize:  6.88 KB
 Downloaded:  188 Time(s)

Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1486

PostPosted: Sat May 10, 2025 7:45 pm    Post subject: Reply with quote

In this case, create a single loading code without a menu and for 2 different versions (Game table, Autorun) and put it in the autorun folder.

Leave a clear sign at the end of the table names to understand which table you are opening and have the code read it.

For example;
For game tables: "gamename_table.CT"
For automatic running: "tablename_auto.CT"

So a code that reads the opened table name can follow the situation and do the necessary loading.

Don't bother adding images to the tables. Put them in the autorun folder and load them from there. Adding images to each created table can take time.

Of course, if each table requires a different game and a different image, add the image to the table, add "_game" to the end of the table name and use "loadFromStream(findTableFile())" in the code.

For this, an autorun code that will read the names of the opened tables you need and load them according to the appropriate name:

Code:
mf = getMainForm()

if titleTmr then titleTmr.Destroy() titleTmr=nil end
titleTmr = createTimer(mf)
titleTmr.Interval = 2000

titleTmr.OnTimer=function()
title = mf.SaveDialog1.FileName or mf.OpenDialog1.FileName
--print(title)
titleCut = string.match(extractFileName(title), "_(.-).CT")
--print(1,titleCut)
 if titleCut=="table" then
    print(1,titleCut)
    -- load
    -- table images
    -- table colors
 elseif titleCut=="auto" then
    print(2,titleCut)
    -- load
    -- table images
    -- table colors
 end
titleTmr.Destroy()
end

titleTmr.Enabled=true

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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