 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
mgr.inz.Player I post too much
Reputation: 221
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Wed Jun 21, 2017 11:52 am Post subject: |
|
|
You didn't create any hotkeys. You need them in the first place.
"Change Hotkey Keys" extension doesn't automatically create those. It allows to change already existing hotkey keys.
So, you have to add hotkeys yourself. In your case you can use Lua function createHotkey.
Then, instead of buttons with caption "Hotkey" just add another group of Labels or other controls with caption/text property.
I removed buttons, added labels. I made hotkeys like this:
(note: tr variable is another reference to MyTrainerV1,
just to make lines shorter and easier to read)
Code: | hk1=createHotkey(function () tr.CECheckBox1.Checked = not tr.CECheckBox1.Checked end, VK_CONTROL, VK_NUMPAD1)
...
hk14=createHotkey(function () tr.CECheckBox14.Checked = not tr.CECheckBox14.Checked end, VK_MENU, VK_NUMPAD4) |
and now you can use my extension functionality:
Code: | addChangeHotkeyKeysFunctionality( tr.CELabel_hotkeystring1 , hk1 )
...
addChangeHotkeyKeysFunctionality( tr.CELabel_hotkeystring14 , hk14 )
hotkeysSettings('scarface010305\\MyTrainer Version 1')
hotkeysSettings('load') |
and hotkeysSettings('save') inside FormClose function. Also it is a good idea to move form_show(MyTrainerV1) after last addChangeHotkeyKeysFunctionality line.
At the end I pasted my "Change Hotkey Keys" extension script at the very beginning of your script.
Here, your CT file: https://workupload.com/file/r6asaUN
your original file here: https://workupload.com/file/WjvFufW
my extension changes this
into this
_________________
|
|
Back to top |
|
 |
scarface010305 Newbie cheater
Reputation: 0
Joined: 15 Jun 2017 Posts: 22
|
Posted: Wed Jun 21, 2017 4:07 pm Post subject: |
|
|
Thank you so much !!
It looks so amazing.
Thank you for your time and help.
This Feature is so nice
|
|
Back to top |
|
 |
ByTransient Expert Cheater
Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Sat Feb 06, 2021 7:00 am Post subject: |
|
|
I tried to encode this with "InputQuery" for 8 hours.
I searched everywhere and could not find an example.
Again, I found the solution in your archive.
I'm waiting for a while for +1. I will return it after the deadline.
Thanks.
(I hope your score gets higher.)
An example for those who want to assign a user-defined hotkey in the trainer;
Code: | if f then f.Destroy() f=nil end
f = createForm(true)
f.Position = poDesktopCenter
f.Width = 220
f.Height = 160
l1=createLabel(f) l1.Left=70 l1.Top=60 l1.caption="key: "
l2=createCheckBox(f) l2.Left=70 l2.Top=20 l2.caption="hotkey change"
------------------------------------------------
local inputtext=([[
******************************************
******************************************
****** Set a hotkey or leave it blank (F8) ******
******************************************
******************************************
or Click 'Apply']])
local function userPressedKey(sender, key)
if userDefinedKeys[5]==0 then
for i=1,5 do
if userDefinedKeys[i]==0 then
userDefinedKeys[i]=key
break
else
if userDefinedKeys[i]==key then break end
end
end
end
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
return 0
end
local function clearHotkey()
userDefinedKeys={0,0,0,0,0}
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
changeHotkeyKeysForm.CEEdit1.setFocus()
end
local function formCreate()
changeHotkeyKeysForm=createForm() --false)
changeHotkeyKeysForm.Name = 'changeHotkeyKeysForm'
changeHotkeyKeysForm.Caption = 'Hotkey Manually Set'
changeHotkeyKeysForm.Width = 300
changeHotkeyKeysForm.Height = 170
changeHotkeyKeysForm.Position = poScreenCenter
changeHotkeyKeysForm.OnClose =
function ()
changeHotkeyKeysForm.CEEdit1.setFocus()
return caHide
end
local CELabel1=createLabel(changeHotkeyKeysForm)
CELabel1.Name='CELabel1' CELabel1.Left=10
CELabel1.Top=5 CELabel1.Caption=inputtext
CELabel1.Alignment="taCenter"
local CEEdit1=createEdit(changeHotkeyKeysForm)
CEEdit1.Name='CEEdit1' CEEdit1.Text='F8'
CEEdit1.Left=130 CEEdit1.Top=132
CEEdit1.Height=30 CEEdit1.Width=40
CEEdit1.Alignment="taCenter"
local clearButton=createButton(changeHotkeyKeysForm)
clearButton.Name='clearButton' clearButton.Left=10
clearButton.Top=130 clearButton.Height=28
clearButton.Width=100 clearButton.Caption='Clear'
local applyButton=createButton(changeHotkeyKeysForm)
applyButton.Name='applyButton' applyButton.Left=190
applyButton.Top=130 applyButton.Height=28
applyButton.Width=100 applyButton.Caption='Apply'
CEEdit1.OnKeyDown = userPressedKey
local mbtn={false,true,true,true}
CEEdit1.OnMouseDown = function (s,k) if mbtn[k] then s.OnKeyDown(s,k+2) end end
clearButton.OnClick = clearHotkey -- clear button
applyButton.ModalResult = mrYes -- apply button
end
function changeHotkeyKeys(hotkey)
if not changeHotkeyKeysFormCreated then
changeHotkeyKeysFormCreated = true
formCreate()
end
if hotkey==nil then return end
userDefinedKeys={0,0,0,0,0}
if hotkey.ClassName=='TGenericHotkey' then
for i,v in ipairs({hotkey.getKeys()}) do
userDefinedKeys[i]=v
end
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
if changeHotkeyKeysForm.showModal()==mrYes then
hotkey.setKeys(userDefinedKeys[1],userDefinedKeys[2],
userDefinedKeys[3],userDefinedKeys[4],
userDefinedKeys[5])
print("hotkey3: "..changeHotkeyKeysForm.CEEdit1.Text)
l1.caption="key: "..changeHotkeyKeysForm.CEEdit1.Text
end
elseif hotkey.ClassName=='TMemoryRecordHotkey' then
for i,v in ipairs(hotkey.Keys) do
userDefinedKeys[i]=v
end
object1.Hotkey = object2.HotkeyString
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
if changeHotkeyKeysForm.showModal()==mrYes then
hotkey.Keys = userDefinedKeysh
end
end
end
----------------------------------------------------------------
function texter()
print("hotkey click")
end
if hk1 then hk1.destroy() hk1=nil end
hk1=createHotkey(texter, nil)
l2.OnChange=function(sender)
if sender.checked==true then
hk1=createHotkey(texter, nil)
--addChangeHotkeyKeysFunctionality(l1, hk1)
changeHotkeyKeys(hk1)
else
if hk1 then hk1.destroy() hk1=nil end
print("Key Close!")
end
end
|
Again Thanks .. (Y)
EDIT: That's 170 now. The target is 200, isn't there anybody who raised it?
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Feb 11, 2021 9:12 pm Post subject: |
|
|
Make it 200
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1483
|
Posted: Fri Feb 12, 2021 2:23 pm Post subject: |
|
|
Corroder wrote: | Make it 200 |
I'm waiting for this too. Hopefully it can pass 200. It deserves it.
_________________
|
|
Back to top |
|
 |
bismult Cheater
Reputation: 0
Joined: 09 Mar 2022 Posts: 25
|
Posted: Sun May 18, 2025 6:08 pm Post subject: Re: "Change Hotkey Keys" [WIP] |
|
|
mgr.inz.Player wrote: | Code: | Depending on action you can:
hotkeysSettings('load') - load keys for each hotkey from the registry
hotkeysSettings('save') - save keys for each hotkey to the registry
hotkeysSettings('path\\to\\the\\settings') - you can define hotkeys settings path |
|
I know this is an old post, but this script is very helpful. I'm having trouble with saving, loading, and setting a path for the keybinds. How exactly does setting the path work?
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1483
|
Posted: Sun May 18, 2025 6:49 pm Post subject: Re: "Change Hotkey Keys" [WIP] |
|
|
bismult wrote: | mgr.inz.Player wrote: | Code: | Depending on action you can:
hotkeysSettings('load') - load keys for each hotkey from the registry
hotkeysSettings('save') - save keys for each hotkey to the registry
hotkeysSettings('path\\to\\the\\settings') - you can define hotkeys settings path |
|
I know this is an old post, but this script is very helpful. I'm having trouble with saving, loading, and setting a path for the keybinds. How exactly does setting the path work? |
If you used the following code, you can use "hotkeysSettings('save')" and "hotkeysSettings('load')" with the following methods:
Add the following line to the end of the trainer code;
Code: | hotkeysSettings('load') |
And add the following line to the Trainer closing function:
Code: | hotkeysSettings('save') |
Example usage:
Code: | TrainerName.OnClose=function()
hotkeysSettings('save')
closeCE()
return cafree
end |
Hotkey, key change script:
Code: | local changeHotkeyKeysForm
local hotkeys = {}
local userDefinedKeys = {}
local hotkeysKeysSettings
local function userPressedKey(sender, key)
if userDefinedKeys[5]==0 then
for i=1,5 do
if userDefinedKeys[i]==0 then
userDefinedKeys[i]=key
break
else
if userDefinedKeys[i]==key then break end
end
end
end
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
return 0
end
local function clearHotkey()
userDefinedKeys={0,0,0,0,0}
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
changeHotkeyKeysForm.CEEdit1.setFocus()
end
local function formCreate()
changeHotkeyKeysForm=createForm(false)
changeHotkeyKeysForm.Name = 'changeHotkeyKeysForm'
changeHotkeyKeysForm.Caption = 'Change Hotkey Keys'
changeHotkeyKeysForm.Width = 300
changeHotkeyKeysForm.Height = 120
changeHotkeyKeysForm.Position = poScreenCenter
changeHotkeyKeysForm.OnClose =
function ()
changeHotkeyKeysForm.CEEdit1.setFocus()
return caHide
end
local CELabel1=createLabel(changeHotkeyKeysForm)
CELabel1.Name = 'CELabel1'
CELabel1.Left = 20
CELabel1.Top = 20
CELabel1.Caption = 'Set hotkey:'
local CEEdit1=createEdit(changeHotkeyKeysForm)
CEEdit1.Name = 'CEEdit1'
CEEdit1.Text = ''
CEEdit1.AnchorSideLeft.Control = CELabel1
CEEdit1.AnchorSideTop.Control = CELabel1
CEEdit1.AnchorSideTop.Side = asrBottom
CEEdit1.Height = 25
CEEdit1.Width = 248
CEEdit1.BorderSpacing.Top = 4
local clearButton=createButton(changeHotkeyKeysForm)
clearButton.Name = 'clearButton'
clearButton.AnchorSideLeft.Control = CEEdit1
clearButton.AnchorSideTop.Control = CEEdit1
clearButton.AnchorSideTop.Side = asrBottom
clearButton.Height = 30
clearButton.Width = 80
clearButton.BorderSpacing.Top = 8
clearButton.Caption = 'Clear'
local applyButton=createButton(changeHotkeyKeysForm)
applyButton.Name = 'applyButton'
applyButton.AnchorSideLeft.Control = clearButton
applyButton.AnchorSideLeft.Side = asrBottom
applyButton.AnchorSideTop.Control = clearButton
applyButton.Height = 30
applyButton.Width = 80
applyButton.BorderSpacing.Left = 10
applyButton.Caption = 'Apply'
CEEdit1.OnKeyDown = userPressedKey
local mbtn={false,true,true,true}
CEEdit1.OnMouseDown = function (s,k) if mbtn[k] then s.OnKeyDown(s,k+2) end end
clearButton.OnClick = clearHotkey -- clear button
applyButton.ModalResult = mrYes -- apply button
end
local function updateControlWithHotkeyString(ctrl,hotkey)
local hotkeyString
if hotkey.ClassName=='TMemoryRecordHotkey' then
hotkeyString = convertKeyComboToString(hotkey.Keys)
else
hotkeyString = convertKeyComboToString{hotkey.getKeys()}
end
if ctrl.ClassName=='tcheat' then
ctrl.Hotkey = hotkeyString
else -- not a tcheat component
if ctrl.Text then
ctrl.Text = hotkeyString
elseif ctrl.Caption then
ctrl.Caption = hotkeyString
end
end
end
local function getHotkeyFromRegistry(hotkeyName,hotkey)
local str = hotkeysKeysSettings.Value[hotkeyName]
if str=='' then return end
local keys={0,0,0,0,0}
local i=1
for v in str:gmatch'[^,]+' do
keys[i] = tonumber(v)
i=i+1
end
if hotkey.ClassName=='TMemoryRecordHotkey' then
hotkey.Keys = keys
else
hotkey.setKeys(keys[1],keys[2],keys[3],keys[4],keys[5])
end
end
local function setHotkeyInRegistry(hotkeyName,hotkey)
if hotkey.ClassName=='TMemoryRecordHotkey' then
hotkeysKeysSettings.Value[hotkeyName] = table.concat(hotkey.Keys,',')
else
hotkeysKeysSettings.Value[hotkeyName] = table.concat({hotkey.getKeys()},',')
end
end
local function createUniqueHotkeyName(hotkey,index)
local name = ''..index
if hotkey.ClassName=='TMemoryRecordHotkey' then
name = name..'_'..hotkey.Owner.Description..'_'..hotkey.Description..'_'..
hotkey.Owner.ID..'_'..hotkey.ID
end
return name
end
function changeHotkeyKeys(hotkey,ctrl)
if not changeHotkeyKeysFormCreated then
changeHotkeyKeysFormCreated = true
formCreate()
end
if hotkey==nil then return end
userDefinedKeys={0,0,0,0,0}
local changed = false
if hotkey.ClassName=='TGenericHotkey' then
for i,v in ipairs({hotkey.getKeys()}) do
userDefinedKeys[i]=v
end
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
if changeHotkeyKeysForm.showModal()==mrYes then
hotkey.setKeys(userDefinedKeys[1],userDefinedKeys[2],
userDefinedKeys[3],userDefinedKeys[4],
userDefinedKeys[5])
changed = true
end
elseif hotkey.ClassName=='TMemoryRecordHotkey' then
for i,v in ipairs(hotkey.Keys) do
userDefinedKeys[i]=v
end
changeHotkeyKeysForm.CEEdit1.Text=convertKeyComboToString(userDefinedKeys)
if changeHotkeyKeysForm.showModal()==mrYes then
hotkey.Keys = userDefinedKeys
changed = true
end
end
if changed and (ctrl~=nil) then
updateControlWithHotkeyString(ctrl,hotkey)
end
end
function addChangeHotkeyKeysFunctionality(ctrl, hotkey)
if not ( inheritsFromControl(ctrl) and
inheritsFromObject(hotkey) and
( hotkey.ClassName=='TMemoryRecordHotkey' or hotkey.ClassName=='TGenericHotkey')
) then return end
local btn = createButton(ctrl.Owner)
btn.Parent = ctrl.Parent
btn.AnchorSideTop.Control = ctrl
btn.Height = ctrl.Height
btn.Width = 15
btn.Caption = '…'
if ctrl.ClassName=='tcheat' then
btn.AnchorSideLeft.Control = ctrl
btn.BorderSpacing.Left = ctrl.Descriptionleft - 20
else -- not a tcheat component
btn.Anchors = '[akTop, akRight]'
btn.AnchorSideRight.Control = ctrl
btn.BorderSpacing.Right = 5
end
hotkeys[1+#hotkeys] = {control=ctrl,hotkey=hotkey}
btn.OnClick = function () changeHotkeyKeys(hotkey,ctrl) end
end
function hotkeysSettings(action)
if action:lower()=='save' then
if hotkeysKeysSettings==nil then error'hotkeys settings path not defined' end
for i,v in ipairs(hotkeys) do
local name = createUniqueHotkeyName(v.hotkey,i)
setHotkeyInRegistry(name,v.hotkey)
end
elseif action:lower()=='load' then
if hotkeysKeysSettings==nil then error'hotkeys settings path not defined' end
for i,v in ipairs(hotkeys) do
local name = createUniqueHotkeyName(v.hotkey,i)
getHotkeyFromRegistry(name,v.hotkey)
updateControlWithHotkeyString(v.control,v.hotkey)
end
else
hotkeysKeysSettings=getSettings(action)
end
end |
_________________
|
|
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
|
|