Append Custom Tab to current Assembler Window

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
S1N74X
Cheater
Cheater
Posts: 39
Joined: Wed Sep 15, 2021 4:25 pm
Reputation: 4

Append Custom Tab to current Assembler Window

Post by S1N74X »

As the Description says, the code will add a Custom Tab to the current edited Assembler Script.
This is useful if you have your own library and dont want do remember every functionname and its parameters.
Just copy the code into a script and put the script under CEs Autorun Folder.


Spoiler

Code: Select all

function bla(msg)
print(msg)
end

local fncNamesWithDescription = { -- the functions to call and their descriptions
{'bla','-- (msg)'},
}

local function createDynamicMenuItems(form) -- dynamically creates the new Assembly Tab
if form then
local GlobalFunctions = createMenuItem(form.Menu)
GlobalFunctions.Caption = 'GlobalFunctions'
form.Menu.Items.insert(form.Menu.Items.Count, GlobalFunctions)

for i=1,#fncNamesWithDescription do
FunctionsMenuItem = createMenuItem(GlobalFunctions)
FunctionsMenuItem.Caption = fncNamesWithDescription[i][1] .. ' ' .. fncNamesWithDescription[i][2]
FunctionsMenuItem.OnClick = function ()

writeToClipboard('\n' .. fncNamesWithDescription[i][1]..'() ' .. fncNamesWithDescription[i][2]) -- copy the selected content of the table line to the clipboard

local paste = form.findComponentByName('miPaste') -- paste the selected content to the currently edited script
if paste then
paste.doClick()
end
end

GlobalFunctions.Add(FunctionsMenuItem)
end
end
end

local function formCreateNotify(form)
  if form.ClassName~="TfrmAutoInject" then return end

  local timer=createTimer()
  timer.Interval=100
  timer.OnTimer = function (t)
                    if (form.Menu==nil) then return end
                    t.destroy()
                    timer.destroy()
                    createDynamicMenuItems(form)
                  end
end

registerFormAddNotification(formCreateNotify)

Maybe its usefull for someone.

Post Reply

Who is online

Users browsing this forum: No registered users