Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


"Change Hotkey Keys" [WIP]
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 206

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Jun 21, 2017 11:52 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
scarface010305
Newbie cheater
Reputation: 0

Joined: 15 Jun 2017
Posts: 22

PostPosted: Wed Jun 21, 2017 4:07 pm    Post subject: Reply with quote

Thank you so much !!

It looks so amazing. Shocked
Thank you for your time and help.

This Feature is so nice Very Happy
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 1

Joined: 05 Sep 2020
Posts: 141

PostPosted: Sat Feb 06, 2021 7:00 am    Post subject: This post has 1 review(s) Reply with quote

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
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 63

Joined: 10 Apr 2015
Posts: 1553

PostPosted: Thu Feb 11, 2021 9:12 pm    Post subject: Reply with quote

Make it 200
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Aylin
Grandmaster Cheater
Reputation: 10

Joined: 16 Feb 2017
Posts: 658

PostPosted: Fri Feb 12, 2021 2:23 pm    Post subject: Reply with quote

Corroder wrote:
Make it 200


I'm waiting for this too. Hopefully it can pass 200. It deserves it. Cool

_________________
Hi Hitler Take control of your trainer
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites