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 


How to change background color of Cheat Table Lua Script?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Tue Mar 07, 2023 4:31 pm    Post subject: How to change background color of Cheat Table Lua Script? Reply with quote

Is it possible to change background color of Cheat Table Lua Script and Lua Engine?
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Wed Mar 08, 2023 12:32 am    Post subject: Reply with quote

You can do it like this:
Code:

local colour = 0x333333 -- 0xBBGGRR format
AddressList.Component[0].Color = colour


Older versions may require attaining the addresslist object:
Code:

local colour = 0x333333 -- 0xBBGGRR format
local addresslist = getAddressList()
addresslist.Component[0].Color = colour
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Wed Mar 08, 2023 5:54 am    Post subject: Reply with quote

LeFiXER wrote:
You can do it like this:

Thanks, but I need to change color of Cheat Table Lua Script and Lua Engine.
Found that Lua Engine color can be changed like this:
Code:
getLuaEngine().Component[1].Color =0xffff00
getLuaEngine().Component[11].Color =0xffff00

But the main question of the topic still remains. About how to change background color of Lua Script Cheat Table.
This code doesn't work:
Code:
MainForm.frmLuaTableScript.Component[0].Color =0xfff000
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Wed Mar 08, 2023 10:14 am    Post subject: Reply with quote

My apologies, this will do what you want.
Code:

-- Set colour here
local colour = 0x333333

function forEachAndFutureForm(classname, func)
  local i
  for i = 0,getFormCount() - 1 do
    local f = getForm(i)
    if f.ClassName == classname then
      func(f)
    end
  end

  registerFormAddNotification(function(f)
    if classname == f.ClassName then
      f.registerFirstShowCallback(function()
        func(f)
      end)
    end
  end)
end


forEachAndFutureForm('TfrmAutoInject', function(f)
                                        f.Assemblescreen.Color = colour
                                        end)

getLuaEngine().mScript.Color = colour

Note: the Cheat Table Lua Script and the Auto Assembler window is a shared form so it will affect both windows. You can save this as a Lua file and place it in the autorun directory within the Cheat Engine installation folder.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Wed Mar 08, 2023 10:26 am    Post subject: This post has 1 review(s) Reply with quote

Code:
if f1 then f1.Destroy() end
f1 = createForm()
f1.Position = 'poScreenCenter'
f1.Caption = 'Color Tester'

clrbox = createTrackBar(f1)
clrbox.Width = f1.Width - 20
clrbox.Left,clrbox.Top = 10,50
clrbox.Max = 1000
clrbox.Min = 0

edt1 = createEdit(f1)
edt1.Width = f1.Width - 200
edt1.Left,edt1.Top = 100,100
edt1.Font.Size = 14


clrbox.OnChange=function()
pst = clrbox.Position
 if pst==0 then
  MainForm.frmAutoInject.Assemblescreen.color = 0x000000
  elseif pst==1000 then
   MainForm.frmAutoInject.Assemblescreen.color = 0xFFFFFF
  else
   MainForm.frmAutoInject.Assemblescreen.color = pst * 1200
 end
 edt1.Text = MainForm.frmAutoInject.Assemblescreen.color
end

_________________
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
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Wed Mar 08, 2023 12:55 pm    Post subject: Reply with quote

LeFiXER wrote:
My apologies, this will do what you want.

Thanks
Quote:
Note: the Cheat Table Lua Script and the Auto Assembler window is a shared form so it will affect both windows. You can save this as a Lua file and place it in the autorun directory within the Cheat Engine installation folder.

We can change the colors in these windows independently of each other:
Code:

frmLuaTableScript = getMainForm().frmAutoInject
frmLuaTableScript.Assemblescreen.Color =0xA7A7A7
frmA = getMemoryViewForm().frmAutoInject_1
frmA.Assemblescreen.Color =0xA7A7A7


AylinCE wrote:
Code:
MainForm.frmAutoInject.Assemblescreen.color = 0x000000

This is what I needed, thanks.
It's also interesting to know how to change the color in the Auto Assembler script window.
The color can be changed like this:
Code:
frmA = getMemoryViewForm().frmAutoInject_1
frmA.Assemblescreen.Color =0xA7A7A7

But for some reason this code doesn't work:
Code:
MainForm.MemoryBrowser.frmAutoInject_1.Color = 0xA7A7A7
Can you help with this?
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Wed Mar 08, 2023 4:07 pm    Post subject: Reply with quote

It has a color designation. Because it does not display the new color. Maybe a timer fixes the color.

Or the DB may have an explanation.

Here are some examples;


Code:
dis1 = getMemoryViewForm().DisassemblerView
hex1 = getMemoryViewForm().HexadecimalView

dis1.Color = 0x00ff00
hex1.Color = 0x1111ff

print("1 - " .. dis1.color)
print("2 - " .. hex1.Color)

--for i = 0, dis1.ComponentCount - 1 do
--   dis1.Component[i].Color = 11200 * i
--    print(dis1.Component[i].Color)
--end

    print(dis1.SelectedAddress)

dis1.BackgroundColor = 0xffff00
hex1.BackgroundColor = 0x2200ff

print("3 - "..dis1.BackgroundColor)
print("4 - "..hex1.BackgroundColor)

--GetAddressList().Control[0].BackgroundColor=0xffff00

_________________
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
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Thu Mar 09, 2023 5:38 am    Post subject: Reply with quote

Razi wrote:

But for some reason this code doesn't work:
Code:
MainForm.MemoryBrowser.frmAutoInject_1.Color = 0xA7A7A7
Can you help with this?


This is because MemoryBrowser is not an object of MainForm, nor is frmAutoInject_1 an object of Memory Browser.
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Thu Mar 09, 2023 10:38 am    Post subject: Reply with quote

LeFiXER wrote:
This is because MemoryBrowser is not an object of MainForm, nor is frmAutoInject_1 an object of Memory Browser.

This is what I want to find out. How to call "frmAutoInject_1" referring to the correct objects.
Does anyone know how to call MemoryView Form in Lazarus? Can't find this Form.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Thu Mar 09, 2023 11:21 am    Post subject: Reply with quote

use;
https://github.com/imgits/cheat-engine/blob/master/Cheat%20Engine/MemoryBrowserFormUnit.lfm

_________________
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
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Thu Mar 09, 2023 11:58 am    Post subject: Reply with quote

Razi wrote:
This is what I want to find out. How to call "frmAutoInject_1" referring to the correct objects.
Does anyone know how to call MemoryView Form in Lazarus? Can't find this Form.


If by call you mean, open the memory viewer window via Lua alone. You can do this:
Code:

-- This creates a reference for you
local memoryView = getMemoryViewForm()

memoryView.Show()

-- Or you can simply do it like this without the reference
getMemoryViewForm().Show()
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Thu Mar 09, 2023 12:10 pm    Post subject: Reply with quote

@LeFiXER, @AylinCE: Thanks for answers.
Back to top
View user's profile Send private message
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