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 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting -> Lua Extensions
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Tue Dec 20, 2016 10:42 am    Post subject: "Change Hotkey Keys" [WIP] Reply with quote

This extension adds "Change Hotkey Keys" window.
Status: WIP

Note:
If any bugs, please report.
For the first two persons who upload their CT trainer file here,
CT with custom form and working Lua script, I will re-post it back with needed changes, so we can treat them as "real world example".



Usage:
Code:
changeHotkeyKeys(hotkey, control OPTIONAL)
It will open "Change Hotkey Keys" window allowing you to change hotkey keys.
You can use GenericHotkey and MemoryRecordHotkey.
If control is provided it will update with current hotkeystring.



addChangeHotkeyKeysFunctionality(control,hotkey)
It will bind control and hotkey. Small button will be created on the left side of control.
If control is a CheatComponent (class "tcheat") button will be on next to description part.
Clicking this button will open "Change Hotkey Keys" window for hotkey.



hotkeysSettings(action)
Special function for all hotkeys registered with addChangeHotkeyKeysFunctionality

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



Example:
Code:
function CloseClick()
  hotkeysSettings('save')
  closeCE()
  return caFree
end


addChangeHotkeyKeysFunctionality(CETrainer.CHEAT0, memrec0_hotkey0)
addChangeHotkeyKeysFunctionality(CETrainer.CHEAT1, memrec1_hotkey0)
addChangeHotkeyKeysFunctionality(CETrainer.CHEAT2, memrec2_hotkey0)
addChangeHotkeyKeysFunctionality(CETrainer.CHEAT3, memrec3_hotkey0)

hotkeysSettings('mgr.inz.Player\\POP:SOT')
hotkeysSettings('load')







changeHotkeyKeys.lua
 Description:

Download
 Filename:  changeHotkeyKeys.lua
 Filesize:  6.6 KB
 Downloaded:  837 Time(s)


_________________
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Mon Jan 16, 2017 5:18 am    Post subject: Reply with quote

No feedback? Weird.
_________________
Back to top
View user's profile Send private message MSN Messenger
++METHOS
I post too much
Reputation: 75

Joined: 29 Oct 2010
Posts: 3672

PostPosted: Mon Jan 16, 2017 9:08 am    Post subject: Reply with quote

I've not had a chance to check this out yet. I did see your previous post regarding your changehotkey script. I think it's very useful. I am a loser with LUA, so some of these things take me a minute to figure out still. Very Happy

That said, if I ever get around to writing another trainer, I'd like to incorporate this feature.
Back to top
View user's profile Send private message
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 68

PostPosted: Tue Apr 18, 2017 8:19 am    Post subject: Reply with quote

Newbee like me don't know how to use this,where should I put it or thing something I need to copy? Question
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Tue Apr 18, 2017 3:59 pm    Post subject: Reply with quote

Just upload your trainer (as CT file) here. And I will reply. Then you can see the needed changes.
_________________
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Fri Apr 21, 2017 7:04 am    Post subject: Reply with quote

So, you are not interested at all Sad
_________________
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 68

PostPosted: Sat Apr 22, 2017 1:33 am    Post subject: Reply with quote

Sorry,got out a few days and forget to check the reply.

I'm so so sorry.

Here is my Cheat Table of Oxygen Not Included

Strange I can't upload ct file here?
But I can upload image file?Why?


====================

I am not familiar with too much of this,I upload to github

and this can be download with press that Big Green Clone or download Button
on the Middle RIght of the Page.Is it OK?

https://github.com/mindoff6502/CheatEngineStudy

and I still don't know how to use this CT file or your lua to recreate an exe trainer.
How should I use this CT file to create an exe Trainer if I may ask.



Thumb.png
 Description:
 Filesize:  11.53 KB
 Viewed:  13895 Time(s)

Thumb.png




Last edited by mindoff on Sun Apr 23, 2017 12:38 am; edited 4 times in total
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Sat Apr 22, 2017 6:39 am    Post subject: Reply with quote

Quote:
Can I just paste the txt here?

Not enough. Just create the trainer, customize it, then save it as CT file instead of EXE. You can upload it to mediafire or similar and then paste the link...

(you can edit your previous post, remove wall of text and paste the url)

_________________
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 68

PostPosted: Sun Apr 23, 2017 12:42 am    Post subject: Reply with quote

OK,try to upload the file to github.Will that be working?

Oh,by the way,I just got your thread form here pointed by DB.

http://forum.cheatengine.org/viewtopic.php?t=604173
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Sun Apr 23, 2017 2:47 am    Post subject: Reply with quote

From what I see, you are still using CE6.51. My script requires CE6.6 or above. If you are using "Lua extensions" better keep CE up to date.


Now, you have your CT file.

Open it with CE. Be sure that Lua script do not execute. So launch CE, go to settings, and check "Ask to run lua scripts from tables", then open CT file and choose "No" when confirmation window appears.

From menu Table click "show cheat table Lua script". Paste my script, from first post, above line --TRAINERGENERATORSTART--.

Then find CloseClick function. Add hotkeysSettings('save') above closeCE() line.

Then, look at onPostHotkey functions. There are two of them.

From your example, the first one:
Code:
function onPostHotkey0(Hotkey)
  --Executed after the "toggle*" cheat got executed
  local memrec=Hotkey.Owner
  local isActive=memrec.Active --get the state after the hotkey got triggered
  CETrainer.CHEAT0.setActive(isActive) --gui update, nothing else
  if gPlaySoundOnAction then
    if isActive then
      playSound(gActivateSound)
    else
      playSound(gDeactivateSound)
    end
  end
end

memrec62_hotkey0.onPostHotkey=onPostHotkey0


As you see from lines "CETrainer.CHEAT0.setActive(isActive)" and "memrec62_hotkey0.onPostHotkey=onPostHotkey0"

memrec62_hotkey0 is binded to onPostHotkey0, and that means it is also binded to CETrainer.CHEAT0 component.


So, read both. And you will get:

CETrainer.CHEAT0 is binded with memrec62_hotkey0
CETrainer.CHEAT1 is binded with memrec53_hotkey0


So, just above line --TRAINERGENERATORSTOP-- add those

Code:
addChangeHotkeyKeysFunctionality(CETrainer.CHEAT0,memrec62_hotkey0)
addChangeHotkeyKeysFunctionality(CETrainer.CHEAT1,memrec53_hotkey0)

hotkeysSettings('mindoff\\Oxygen Not Included')
hotkeysSettings('load')


That "mindoff\\Oxygen Not Included" can be anything. If you have other nick on other forum e.g. anonymous, and you made cheat table for other game, for example "Dead Space 3", you can use "anonymous\\Dead Space 3"

While your active window is Main CE (or window with Lua script) press CTRL+S to save your work. So you will have CT file you can work on (correcting typos, gui, etc)


Now, click "save as" from file menu. Select file type: CETRAINER and save.




Below a file edited with CE6.6, so you can compare with yours.
http://www.mediafire.com/file/q5gywm194x404qh/OxygenNotIncluded_Plus2_Trainer.ct





Quote:
How should I use this CT file to create an exe Trainer if I may ask.

Because you are using CE mono features, you have to take care of one extra step

How to:

Click "save as" from file menu. Select file type: EXE and save.

Add needed files, because you are using CE mono features:
autorun\monoscript.lua
autorun\forms\MonoDataCollector.frm

autorun\dlls\MonoDataCollector32.dll
or
autorun\dlls\MonoDataCollector64.dll

Choose a decent icon, set compression to whatever you like.

If your game is 64bit, select "target process is 64-bit", then click generate. Done.

_________________
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 68

PostPosted: Sun Apr 23, 2017 6:24 am    Post subject: Reply with quote

Thank you so much.It works now.
And it works only in CE6.6,not 6.5.1,don't know why,but I'm gonna update to 6.6.

The reason why I use 6.5.1 is because 6.6 have some font displaying change,does not look the same as 6.5.1,I'm used to the 6.5.1 font I guess.

But since your great lua script,I will have to update back to 6.6.

And finally got a little understand of lua script really is.Never thought there is another way to export exe trainer.
I will search more tutorial about this.

And thank you again for the great script and answer. Very Happy
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Sun Apr 23, 2017 6:54 am    Post subject: Reply with quote

About fonts:
http://forum.cheatengine.org/viewtopic.php?p=5703321#5703321


About EXE trainers:
Always save your trainer as CT file. Also make a backup of this file. You can always create EXE file from CT file or unprotected CETRAINER file.

If you want to check how it will act as trainer, just change file name extension from CT to CETRAINER. After tests, you can change back file name extension to CT


When you want to release a trainer, release it as:
- CETRAINER, protected (compressed with simple encryption) or unprotected (file is just plain text)
- Tiny EXE
- Huge EXE, keep in mind that you have to add few files when using CE mono feature.

_________________
Back to top
View user's profile Send private message MSN Messenger
scarface010305
How do I cheat?
Reputation: 0

Joined: 15 Jun 2017
Posts: 9

PostPosted: Mon Jun 19, 2017 4:46 am    Post subject: Reply with quote

Hey,

is it possible to use your Code in an user created trainer (manually designed) ?

I am working on a Trainer which has Checkboxes and i added some Buttons too, which should be able to define new hotkeys for these Checkboxes.

Hope u can help me.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Mon Jun 19, 2017 7:36 am    Post subject: Reply with quote

Yes. You can use any "control object" (which has 'text' or 'caption' property) instead of tcheat. It can be label, edit, etc.

My extension adds 'redefine hotkey' button automatically on the left side of label(or edit, or etc.)

example
Code:
function CloseClick()
  hotkeysSettings('save')
  closeCE()
  return caFree
end

addChangeHotkeyKeysFunctionality(CETrainer.Label1, memrec0_hotkey0)

hotkeysSettings('mgr.inz.Player\\GameNameHere')
hotkeysSettings('load')



You can paste link to your trainer, just save it as CT file, not EXE file. Then I will add needed lines. So you can compare what's changed.

_________________
Back to top
View user's profile Send private message MSN Messenger
scarface010305
How do I cheat?
Reputation: 0

Joined: 15 Jun 2017
Posts: 9

PostPosted: Mon Jun 19, 2017 5:10 pm    Post subject: Reply with quote

Thanks for your quick reply.

Here you can find my .ct File (just a little Version of my Trainer).

workuploadDOTcom/file/WjvFufW
or
megaDOTnz/#!l8wxlRQb

I tried to get it to work by my own.
But i get errors:
Code:
Error:[string "local changeHotkeyKeysForm
..."]:201: hotkeys settings path not defined
Error:[string "local changeHotkeyKeysForm
..."]:240: attempt to index a nil value (global 'memrec1_hotkey0')


And i dont see the auto created Buttons. Sad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting -> Lua Extensions All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 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