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 


Create a Button in the Main Form

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 211

PostPosted: Sat May 11, 2024 12:55 pm    Post subject: Create a Button in the Main Form Reply with quote

I'm trying to make a button right next to the existing button "memory view". Could you please help me with it?

it's a child of MainForm.Panel5

For the dimensions and functionality, I'll figure out I suppose.
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Sat May 11, 2024 1:15 pm    Post subject: Reply with quote

Try the code or focus on the button created at the end of the code:

https://forum.cheatengine.org/viewtopic.php?t=617942

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 211

PostPosted: Sat May 11, 2024 2:46 pm    Post subject: Reply with quote

Thank you that worked but I couldn't figure out how to launch Lua Engine.
I tried

Code:
getLuaEngine().Show()
getLuaEngine().DoClick()
CreateLuaEngine()


This's my code:

Code:
if btnLuaEngine then btnLuaEngine.Destroy() btnLuaEngine = nil end
btnLuaEngine = createButton(getMainForm().Panel5)
btnLuaEngine.Height = getMainForm().btnMemoryView.Height
btnLuaEngine.Top = getMainForm().btnMemoryView.Top
btnLuaEngine.Width = getMainForm().btnMemoryView.Width - 50
btnLuaEngine.Left = getMainForm().btnMemoryView.Width + 10
btnLuaEngine.Caption = "Lua Engine"
btnLuaEngine.OnClick = getLuaEngine().doClick()
btnLuaEngine.ShortCut = "Ctrl+L"
getMainForm().OnResize = function()
btnLuaEngine.Left=getMainForm().btnMemoryView.Width + 10
end



Thank you for helping "Tesekkur ederim)"
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Sat May 11, 2024 2:58 pm    Post subject: Reply with quote

Code:
getLuaEngine().cbShowOnPrint.Checked=true
--getLuaEngine().hide()
getLuaEngine().show()

print(11)
sleep(3000)
getLuaEngine().MenuItem5.doClick() --lua engine clear output

print(12)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 211

PostPosted: Sat May 11, 2024 3:12 pm    Post subject: Reply with quote

Thank you it works )

Last edited by Game Hacking Dojo on Sat May 11, 2024 3:17 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Sat May 11, 2024 3:15 pm    Post subject: Reply with quote

In my case this code works just fine.

Code:
if btnLuaEngine then btnLuaEngine.Destroy() btnLuaEngine = nil end
btnLuaEngine = createButton(getMainForm().Panel5)
btnLuaEngine.Height = getMainForm().btnMemoryView.Height
btnLuaEngine.Top = getMainForm().btnMemoryView.Top
btnLuaEngine.Width = getMainForm().btnMemoryView.Width - 50
btnLuaEngine.Left = getMainForm().btnMemoryView.Width + 10
btnLuaEngine.Caption = "Lua Engine"

btnLuaEngine.OnClick = function() getLuaEngine().show() end

btnLuaEngine.ShortCut = "Ctrl+L"
getMainForm().OnResize = function()
btnLuaEngine.Left=getMainForm().btnMemoryView.Width + 10
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 211

PostPosted: Sat May 11, 2024 3:18 pm    Post subject: Reply with quote

thx a lot
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Sat May 11, 2024 3:32 pm    Post subject: Reply with quote

Edited;

The button may not have a shortcut assignment (ShortCut).
Create as below.
Also, when Lua Script is open, "Ctrl+L" may conflict with another function that will load a library.

Think about these again.

Code:
--getLuaEngine().show()

if btnLuaEngine then btnLuaEngine.Destroy() btnLuaEngine = nil end
btnLuaEngine = createButton(getMainForm().Panel5)
btnLuaEngine.Height = getMainForm().btnMemoryView.Height
btnLuaEngine.Top = getMainForm().btnMemoryView.Top
btnLuaEngine.Width = getMainForm().btnMemoryView.Width - 50
btnLuaEngine.Left = getMainForm().btnMemoryView.Width + 10
btnLuaEngine.Caption = "Lua Engine"

btnLuaEngine.OnClick = function() getLuaEngine().show() end

if leBtnKey then leBtnKey.Destroy() end
leBtnKey=createHotkey(function() sleep(200) getLuaEngine().show() end, VK_LCONTROL,VK_G)
--btnLuaEngine.ShortCut = "CTRL+L"

getMainForm().OnResize = function()
btnLuaEngine.Left=getMainForm().btnMemoryView.Width + 10
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 211

PostPosted: Sat May 11, 2024 3:57 pm    Post subject: Reply with quote

there's one last thing I guess. The button appears and works fine. However, the button stays where it is and doesn't change or move accordingly with the form.
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 34

Joined: 16 Feb 2017
Posts: 1418

PostPosted: Sat May 11, 2024 4:16 pm    Post subject: Reply with quote

That's fine.

Since it is indexed to the "Memory Wiev" button, it maintains equal spacing and remains in the same position as it.

Otherwise, the "Memory Wiev" button should also move and this will upset the balance.

This version of the code provides a balanced representation.

What do you want it to do?

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
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 Visit poster's website MSN Messenger
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 211

PostPosted: Sat May 11, 2024 4:21 pm    Post subject: Reply with quote

When I resize the window the button remains in the exact place and doesn't move dynamically with "memory view" button


I used this but it didn't help in that regard

Code:
getMainForm().OnResize = function()
btnLuaEngine.Left = getMainForm().btnMemoryView.Width + 10
btnLuaEngine.Top = getMainForm().btnMemoryView.Top
btnLuaEngine.Height = getMainForm().btnMemoryView.Height
end


Edit:
it only happens when I resize the table view. So probably I'll just do the same as this
Code:
getMainForm().OnResize = function()
using the table window class instead. I'll find it


Edit 2:
I worked by also adding the same for the table area (Panel1)

Code:
getMainForm().OnResize = function()
btnLuaEngine.Left = getMainForm().btnMemoryView.Width + 10
btnLuaEngine.Top = getMainForm().btnMemoryView.Top
btnLuaEngine.Height = getMainForm().btnMemoryView.Height
end

getMainForm().Panel1.OnResize = function()
btnLuaEngine.Left = getMainForm().btnMemoryView.Width + 10
btnLuaEngine.Top = getMainForm().btnMemoryView.Top
btnLuaEngine.Height = getMainForm().btnMemoryView.Height
end



Thank you ))
Back to top
View user's profile Send private message Visit poster's website
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