Hotkey to change AA/lua code font size (proof-of-concept)

A forum dedicated to use and support LUA for Cheat Engine.


Post Reply
User avatar
mece
Table Maker
Table Maker
Apprentice Hacker
Apprentice Hacker
Posts: 61
Joined: Sat Jul 23, 2022 9:21 am
Answers: 0
x 68
Contact:

Hotkey to change AA/lua code font size (proof-of-concept)

Post by mece »

I always wished that ctrl+scroll would increase/decrease font size in AA and Lua Engine

I made a proof-of-concept script that changes font size in AA and Lua Engine with standard memrec hotkeys (default Ctrl+/-).

SetEditorFontSize.CT
(2.65 KiB) Downloaded 105 times

Code: Select all

[ENABLE]
{$lua}
-- changes font size for all editor forms
local function ChangeFontSize(NewFontSize)
  for i = 0, getFormCount() - 1 do
    local frm = getForm(i)
    if frm.ClassName == 'TfrmAutoInject' then
      frm.Assemblescreen.Font.Size = NewFontSize
    end
  end
end

-- if memory record value changed then use it to change font
local mr = getAddressList().getMemoryRecordByDescription("FontSize")
local OldFontSize = nil
mr.OnGetDisplayValue=function(sender,displayedvalue)
  local changed = OldFontSize and (displayedvalue~=OldFontSize)
  OldFontSize = displayedvalue
  if changed then
    ChangeFontSize(displayedvalue)
  end
  return false,displayedvalue --false because you don't want to change the displayed value
end

-- local variable for memory record
local CEName="cheatengine-x86_64-SSE4-AVX2.exe"
openProcess(CEName)
registerSymbol("CELocal",CEName)
{$asm}
globalAlloc(FontSize, 0x4, CELocal)
FontSize:
  dd #10
[DISABLE]
dealloc(FontSize)
unregisterSymbol(FontSize)
unregisterSymbol(CELocal)

Post Reply