Input Modal Form, Row based Layout

Section's for general approaches on hacking various options in games. No online-related discussions/posts OR warez!
Post Reply
User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1178
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 231
Contact:

Input Modal Form, Row based Layout

Post by TheyCallMeTim13 » Sun Apr 22, 2018 1:51 am

Input Modal Form, Row based Layout
Image
Image
https://wiki.cheatengine.org/index.php? ... ua#Classes

Code: Select all

local function showModalForm(address)
    local fW = 400 -- Form width
    local lPush = 90 -- Label width
    local sX = fW - (lPush + 10) -- Size X
    local sY = 23 -- Size Y
    local pX = 3 -- Position X
    local pY = 3 -- Position Y
    local bW = 75 -- Button Width
    local bH = 24 -- Button Hight
    local padF = 5 -- Form Padding

    local pad1 = 3
    local pad2 = 1
    local row = 0

    local frmHookSetup = createForm(false)
    frmHookSetup.centerScreen()
    frmHookSetup.setSize(fW, fH)
    frmHookSetup.Name = 'frmHookSetup'
    frmHookSetup.Caption = 'Hook Setup'

    local lblHookAddress = createLabel(frmHookSetup)
    lblHookAddress.Name = 'lblHookAddress'
    lblHookAddress.setPosition(pX, pY + sY * row + pad1)
    lblHookAddress.Caption = 'Address' .. ':'
    local edHookAddress = createEdit(frmHookSetup)
    edHookAddress.Name ='edHookAddress'
    edHookAddress.setSize(sX, sY)
    edHookAddress.setPosition(pX + lPush, pY + sY * row + pad2)
    edHookAddress.Text = addressStr or address
    row = row + 1

    local lblHookName = createLabel(frmHookSetup)
    lblHookName.Name = 'lblHookName'
    lblHookName.setPosition(pX, pY + sY * row + pad1)
    lblHookName.Caption = 'Hook Name' .. ':'
    local edHookName = createEdit(frmHookSetup)
    edHookName.Name = 'edHookName'
    edHookName.setSize(sX, sY)
    edHookName.setPosition(pX + lPush, pY + sY * row + pad2)
    edHookName.Text = ''
    row = row + 1

    local cbxGenerateAob = createCheckBox(frmHookSetup)
    cbxGenerateAob.Name = 'cbxGenerateAob'
    cbxGenerateAob.setSize(sX, sY)
    cbxGenerateAob.setPosition(pX + lPush, pY + sY * row + pad2)
    cbxGenerateAob.Caption = 'Generate AOB'
    row = row + 1

    local btnOk = createButton(frmHookSetup)
    btnOk.Name = 'btnOk'
    btnOk.Caption = 'OK'
    btnOk.setSize(bW, bH)
    btnOk.setPosition((fW / 3) - (bW / 2), pY + sY * row + pad2)
    btnOk.ModalResult = mrOK
    btnOk.Default = true
    local btnCancel = createButton(frmHookSetup)
    btnCancel.Name = 'btnCancel'
    btnCancel.Caption = 'Cancel'
    btnCancel.setSize(bW, bH)
    btnCancel.setPosition(((fW / 3) * 2) - (bW / 2), pY + sY * row + pad2)
    btnCancel.ModalResult = mrCancel
    btnCancel.Cancel = true
    row = row + 1

    frmHookSetup.setSize(fW, pY + sY * row + padF)

    local mr = frmHookSetup.showModal()
    local dt = {
        Result = mr,
        HookName = edHookName.Text,
        Address = edHookAddress.Text,
        GenerateAob = cbxGenerateAob.Checked,
    }
    return dt
end

local rdt = showModalForm('Game.exe+123ABC')
if rdt.Result == mrOK then
    print(rdt.HookName)
    print(rdt.Address)
    print(tostring(rdt.GenerateAob))
end
Last edited by TheyCallMeTim13 on Tue May 08, 2018 11:32 pm, edited 8 times in total.

User avatar
SunBeam
Trouble Makers
Trouble Makers
Posts: 1675
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 323

Input Modal Form, Row based Layout

Post by SunBeam » Tue May 08, 2018 10:10 pm

Would really help posting a screenshot of the result, where due, in your posts ;) This is one scenario.

Post Reply

Who is online

Users browsing this forum: No registered users