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 


LUA: Create item and set hotkey

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Ultraplayer
Newbie cheater
Reputation: 0

Joined: 06 Apr 2019
Posts: 20

PostPosted: Sat Apr 06, 2019 3:29 pm    Post subject: LUA: Create item and set hotkey Reply with quote

Is it a way to create an item and set hotkey to it?
This is my script, but I can’t figure out how to set hotkeys:
Code:

  local addressList = getAddressList()
  local memRec = addressList.createMemoryRecord()
  memRec.CustomTypeName = "Float Big Endian"
  memRec.Type=vtCustom
  memRec.Description= 'My Description'
  memRec.Address='12345' 
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Apr 06, 2019 9:23 pm    Post subject: Reply with quote

Example :

Code:
local addressList = getAddressList()
local memRec = addressList.createMemoryRecord()
memRec.CustomTypeName = "Float Big Endian"
memRec.Type=vtCustom
memRec.Description= 'My Description'
memRec.Address='12345'

function hack1()
 local mr1 = addressList.getMemoryRecordByDescription("My Description")
 --- add what you want to with'the address' here
 mr1.Active = true
end

key1 = createHotkey(hack1, VK_Z)  --- Z as key



Another example, use hotkey as a toggle on/off

Code:
keyp = true

function samehotkey_show_hide()
 if keyp then
    keyp = false
    showMessage("I'll be back")
 else
    keyp = true
    showMessage('Hi,I am back')
 end
end

if key1 then key1.destroy(); key1=nil end
key1 = createHotkey(samehotkey_show_hide, VK_Z)
key1.DelayBetweenActivate = 300

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Ultraplayer
Newbie cheater
Reputation: 0

Joined: 06 Apr 2019
Posts: 20

PostPosted: Sun Apr 07, 2019 2:07 am    Post subject: Reply with quote

Corroder wrote:


Code:

...
function hack1()
 local mr1 = addressList.getMemoryRecordByDescription("My Description")
 --- add what you want to with'the address' here
 mr1.Active = true
end

key1 = createHotkey(hack1, VK_Z)  --- Z as key


Thanks, but it still do not create hotkey for an item, and item's hotkey list is empty:



empty.png
 Description:
 Filesize:  3.49 KB
 Viewed:  3968 Time(s)

empty.png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 465

Joined: 09 May 2003
Posts: 25565
Location: The netherlands

PostPosted: Sun Apr 07, 2019 2:55 am    Post subject: Reply with quote

the celua.txt is wrong about the memrec createHotkey function (or I need to make it more accepting I guess)

but one way to make it work is:
Code:

mrhk=memRec.createHotkey({VK_Z},mrhToggleActivation,'','Hotkey description')

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Ultraplayer
Newbie cheater
Reputation: 0

Joined: 06 Apr 2019
Posts: 20

PostPosted: Sun Apr 07, 2019 3:42 am    Post subject: Reply with quote

Dark Byte wrote:

Code:

mrhk=memRec.createHotkey({VK_Z},mrhToggleActivation,'','Hotkey description')

It Works! Many thanks!!!
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 All times are GMT - 6 Hours
Page 1 of 1

 
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