 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
C9Angelo How do I cheat?
Reputation: 0
Joined: 01 Apr 2020 Posts: 8
|
Posted: Mon Apr 06, 2020 4:13 pm Post subject: how do i link a cheat table to a gui? |
|
|
asdf.png shows what i'm talking about
basically, i want to be able to link those drop down options from slippery-off ball into a drop down menu on a cetrainer. how would i go about doing that?
| Description: |
| example of what i'm talking about |
|
| Filesize: |
26.85 KB |
| Viewed: |
30031 Time(s) |

|
|
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Tue Apr 07, 2020 7:31 am Post subject: |
|
|
This may not what you want, but maybe you can kidnap the AddressList (the memory record entries collective) into your trainer form?
origin: https://forum.cheatengine.org/viewtopic.php?p=5743590
In cetrainer/exe custom trainer mode originate from a *.ct,
the script in Menu/Table/[Show Cheat Table Lua Script] will be automatic run on start.
Normally, CE Mainform UI, where AddressList located, will be hidden in trainer mode.
By setting Parent property of AddressList as a container ui (wincontrol class) in your custom form, most if not all functionality of memory record will be available in your form.
The container ui can be the form, panel in your form, or tabsheet on a page control etc.
In your *.ct, may put a script line to assign AddressList's parent, may be at last line, or when the correct process is opened etc:
| Code: |
GetAddressList().Parent = <you container ui>
|
It may not need in trainer mode, but the AddressList can be restore to its original parent like:
| Code: |
GetAddressList().Parent = GetMainForm().Panel1 -- <- the original parent
|
After tested as *.ct,
you can save the *.ct [Menu/Save as] as *.cetrainer or *.exe to see how custom trainer mode work.
think TRAINER, as TABLE ref
_________________
- Retarded. |
|
| Back to top |
|
 |
C9Angelo How do I cheat?
Reputation: 0
Joined: 01 Apr 2020 Posts: 8
|
Posted: Tue Apr 07, 2020 10:15 am Post subject: |
|
|
| panraven wrote: | This may not what you want, but maybe you can kidnap the AddressList (the memory record entries collective) into your trainer form?
In cetrainer/exe custom trainer mode originate from a *.ct,
the script in Menu/Table/[Show Cheat Table Lua Script] will be automatic run on start.
Normally, CE Mainform UI, where AddressList located, will be hidden in trainer mode.
By setting Parent property of AddressList as a container ui (wincontrol class) in your custom form, most if not all functionality of memory record will be available in your form.
The container ui can be the form, panel in your form, or tabsheet on a page control etc.
In your *.ct, may put a script line to assign AddressList's parent, may be at last line, or when the correct process is opened etc:
| Code: |
GetAddressList().Parent = <you container ui>
|
It may not need in trainer mode, but the AddressList can be restore to its original parent like:
| Code: |
GetAddressList().Parent = GetMainForm().Panel1 -- <- the original parent
|
After tested as *.ct,
you can save the *.ct [Menu/Save as] as *.cetrainer or *.exe to see how custom trainer mode work.
|
i don't know that this is exactly what i need. i probably should elaborate more so i can actually receive help.
if you can see the theory.PNG, the idea is that a change in the items (they would go from Off -> Bronze -> Silver -> Gold -> HOF would correlate to those in my CT. i don't know how to set that up.
| Description: |
|
| Filesize: |
13.15 KB |
| Viewed: |
29982 Time(s) |

|
|
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Tue Apr 07, 2020 12:38 pm Post subject: |
|
|
Sample for change in ui -> change in memory
| Code: |
local ff = createForm()
ff.Name,ff.OnClose = 'testcombo',function()return caFree end
------- sample combobox setup
local cbs = createComboBox(ff)
cbs.Align = clClient
cbs.Items.Text = [[
--select badge--
0:off
1:Bronze
2:Silver
3:Gold
4:HoF
]]
cbs.ItemIndex = cbs.ItemIndex<0 and 0 or cbs.ItemIndex -- initial selection
cbs.Hint, cbs.ShowHint = 'choose Slippy-off-ball badge', true -- optional, some older ce may not work
cbs.OnChange = function(me) -- do something if selection changed
local idx = me.ItemIndex
if idx<0 then return end -- no select yet?
local item = me.Items[idx] -- only work if number 0-4 is in items.Text above
local val = item:match'^%d+' -- ^^ ditto
local mr = GetAddressList().getMemoryRecordByDescription'-Slippy-off-ball-description'
if mr then
mr.Value = val -- set value to corresponding memory record
else
print'debug:no memory record, check description'
end
end
-------
ff.Show()
|
the reverse, change in memory -> change in ui
| Code: |
badgeTimer = badgeTimer or createTimer(nil,true)
local t, prevValue = badgeTimer
t.Interval, t.OnTimer = 1000,function(tm)
local mr = GetAddressList().getMemoryRecordByDescription'-Slippy-off-ball-description'
if not prevValue or prevValue ~= mr.Value then
prevValue = mr.Value
-- find the corresponding index in combobox and set it
for i=0,cbs.Items.Count-1 do
if prevValue == cbs.Items[i]:match'^%d+'then
cbs.ItemIndex = i
break
end
end
end
end
|
To do all this in every different badges, you may need to refactor the code a bit, so that the 2 parts related in the same badge but not mixed with other badge.
Or, if you only need an ui for user to change Badge, it may be simpler by choosing 'which badge' with another combo box.
| Code: |
[combobox->select Badge Description in Memory Record]
[combobox->select Badge Value]
|
ie. change '-Slippy-off-ball-description' with content of 1st combo box
_________________
- Retarded. |
|
| Back to top |
|
 |
C9Angelo How do I cheat?
Reputation: 0
Joined: 01 Apr 2020 Posts: 8
|
Posted: Tue Apr 07, 2020 1:27 pm Post subject: |
|
|
| panraven wrote: | Sample for change in ui -> change in memory
| Code: |
local ff = createForm()
ff.Name,ff.OnClose = 'testcombo',function()return caFree end
------- sample combobox setup
local cbs = createComboBox(ff)
cbs.Align = clClient
cbs.Items.Text = [[
--select badge--
0:off
1:Bronze
2:Silver
3:Gold
4:HoF
]]
cbs.ItemIndex = cbs.ItemIndex<0 and 0 or cbs.ItemIndex -- initial selection
cbs.Hint, cbs.ShowHint = 'choose Slippy-off-ball badge', true -- optional, some older ce may not work
cbs.OnChange = function(me) -- do something if selection changed
local idx = me.ItemIndex
if idx<0 then return end -- no select yet?
local item = me.Items[idx] -- only work if number 0-4 is in items.Text above
local val = item:match'^%d+' -- ^^ ditto
local mr = GetAddressList().getMemoryRecordByDescription'-Slippy-off-ball-description'
if mr then
mr.Value = val -- set value to corresponding memory record
else
print'debug:no memory record, check description'
end
end
-------
ff.Show()
|
the reverse, change in memory -> change in ui
| Code: |
badgeTimer = badgeTimer or createTimer(nil,true)
local t, prevValue = badgeTimer
t.Interval, t.OnTimer = 1000,function(tm)
local mr = GetAddressList().getMemoryRecordByDescription'-Slippy-off-ball-description'
if not prevValue or prevValue ~= mr.Value then
prevValue = mr.Value
-- find the corresponding index in combobox and set it
for i=0,cbs.Items.Count-1 do
if prevValue == cbs.Items[i]:match'^%d+'then
cbs.ItemIndex = i
break
end
end
end
end
|
To do all this in every different badges, you may need to refactor the code a bit, so that the 2 parts related in the same badge but not mixed with other badge.
Or, if you only need an ui for user to change Badge, it may be simpler by choosing 'which badge' with another combo box.
| Code: |
[combobox->select Badge Description in Memory Record]
[combobox->select Badge Value]
|
ie. change '-Slippy-off-ball-description' with content of 1st combo box |
This works, the issue is that I wouldn't be able to link that to a CETrainer. So if I already had a CETrainer fully setup, how would I make it so that I can just add a part of the script, change the description, and then have it work?
|
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 958
|
Posted: Tue Apr 07, 2020 3:02 pm Post subject: |
|
|
ok, I combine the 2 part into one function, which is for the scenario of using another 'which badge' combo.
So, if you have an existing [badge value] combo box UDF1.CEComboBox1 , and
[mr description] combo box UDF1.CEComboBox2,
Put this at end of Lua script,
| Code: | | linkCbs(UDF1.CEComboBox1, UDF1.CEComboBox2) |
should assign the interactions between the two combo box and corresponding memory record .
(set list of mr description in UDF1.CEComboBox2)
Try understand the code so that you can expand it if need.
| Code: |
local cbs = createComboBox(ff)
local cbm = createComboBox(ff)
cbm.Align = clTop
cbs.Left = cbm.Width + 10
cbm.Items.Text = [[
BITVal
BITVal2
]]
--- ^ my list of mr description for test
function linkCbs(cbs, desc_cbs)
-- ui2memory
cbs.Items.Text = [[
--select badge--
0:off
1:Bronze
2:Silver
3:Gold
4:HoF
]]
cbs.ItemIndex = cbs.ItemIndex<0 and 0 or cbs.ItemIndex -- initial selection
-- cbs.Hint, cbs.ShowHint = 'choose Slippy-off-ball badge', true -- optional, some older ce may not work
cbs.OnChange = function(me) -- do something if selection changed
local idx = me.ItemIndex
if idx<0 then return end -- no select yet?
local item = me.Items[idx] -- only work if number 0-4 is in items.Text above
local val = item:match'^%s*(%d+)' -- ^^ ditto
local mrIdx = desc_cbs.ItemIndex
local mrdesc = mrIdx>=0 and desc_cbs.Items[mrIdx]:match'^%s*(.-)%s*$'
local mr = GetAddressList().getMemoryRecordByDescription(mrdesc)
if mr then
mr.Value = val -- set value to corresponding memory record
elseif not TrainerOrigin then -- not displayed in trainer mode
print'debug:no memory record, check description'
end
end
-- memory to ui
cbs.badgeTimer = cbs.badgeTimer or createTimer(cbs,true)
local t, prevValue = cbs.badgeTimer
t.Interval, t.OnTimer = 200,function(tm)
local mrIdx = desc_cbs.ItemIndex
local mrdesc = mrIdx>=0 and desc_cbs.Items[mrIdx]:match'^%s*(.-)%s*$'
local mr = mrdesc and GetAddressList().getMemoryRecordByDescription(mrdesc)
if mr and (not prevValue or prevValue ~= mr.Value) then
prevValue = mr.Value
-- find the corresponding index in combobox and set it
for i=0,cbs.Items.Count-1 do
if prevValue == cbs.Items[i]:match'^%s*(%d+)'then
cbs.ItemIndex = i
break
end
end
end
end
-- end linkCbs
end
linkCbs(cbs, cbm)
|
_________________
- Retarded. |
|
| Back to top |
|
 |
|
|
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
|
|