View previous topic :: View next topic |
Author |
Message |
ghjbm !BEWARE! Deletes post on answer Reputation: 0
Joined: 08 Aug 2021 Posts: 2
|
Posted: Sun Aug 08, 2021 2:04 pm Post subject: CEButton function not working |
|
|
Hey, the function "CEButton1Click(sender)" in my script doesn't work (it doesn't print anything when I click the button), I also tried using checkboxes with "function CECHeckbox1Change(sender), also didn't work. Sorry if there are some stupid mistakes in my code but I'm a beginner at both cheat engine and lua. Plese help.
My Code:
local address1 = "[[[[[[[GameAssembly.dll+01C81784]+5C]+8]+2C]+C]+4C]+34]+2C"
local address2 = "[[[[[[[GameAssembly.dll+01C65CB0]+20]+5C]+0]+2C]+C]+DC]+224"
local address3 = "[[[[[[[GameAssembly.dll+01C85200]+2C]+20]+5C]+8]+18]+14]+8"
local address4 = "[[[[[[[GameAssembly.dll+01C2CC54]+140]+C]+5C]+10]+98]+84]+B8"
local address5 = "[[[[[[[UnityPlayer.dll+014487A8]+4]+8]+10]+80]+D0]+2C]+328"
local address6 = "[[[[[[[UnityPlayer.dll+01425DC0]+398]+10]+18]+AC]+10]+9C]+3F0"
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
local mr2=AddressList.getMemoryRecordByDescription('Timer1')
local mr3=AddressList.getMemoryRecordByDescription('Timer2')
local mr4=AddressList.getMemoryRecordByDescription('Timer3')
function CETrackBar1Change(sender)
local sliderValue=trackbar_getPosition(TRAINERFORM_CETrackBar1)
writeFloat("[[[[[[[GameAssembly.dll+01C71C08]+20]+4C]+AC]+C]+5C]+58]+14",sliderValue)
val = readFloat("[[[[[[[GameAssembly.dll+01C71C08]+20]+4C]+AC]+C]+5C]+58]+14")
control_setCaption(TRAINERFORM_CELabel2,val)
--print(val)
end
if TRAINERFORM_CECheckbox1.Checked == true then
writeInteger(address1, 1)
else writeInteger(address1, 0)
end
if TRAINERFORM_CECheckbox2.Checked == true then
writeInteger(address2, 0)
mr2.Active = true
else mr2.Active = false
end
if TRAINERFORM_CECheckbox3.Checked == true then
writeInteger(address3, 0)
mr3.Active = true
else mr3.Active = false
end
if TRAINERFORM_CECheckbox4.Checked == true then
writeInteger(address4, 0)
mr4.Active = true
else mr4.Active = false
end
function CEButton1Click(sender)
print("...")
end
TRAINERFORM.OnClose = function(sender)
t.Enabled = false
t.destroy()
end
form_show(TRAINERFORM)
end
t.Enabled=true
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Sun Aug 08, 2021 3:32 pm Post subject: |
|
|
Code: |
function [UDF_FORM_NAME]_CEButton1Click(sender)
end
|
Place your UDF form name minus the square brackets.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Sun Aug 08, 2021 5:01 pm Post subject: |
|
|
If you don't give an "OnClick" control (Events) in the form edit window, try this:
Samle form name myTrainer or UDF1
Code: | UDF1.CEButton1.OnClick=function(sender)
print("Hello")
end
UDF1.CECHeckbox1.OnChange=function(sender)
if sender.checked==true then
print("True")
else
print("False")
end
end |
_________________
|
|
Back to top |
|
|
ghjbm !BEWARE! Deletes post on answer Reputation: 0
Joined: 08 Aug 2021 Posts: 2
|
Posted: Mon Aug 09, 2021 3:58 am Post subject: |
|
|
Thanks a lot. I have another problem, when I close the trainer it says "Error: Access Violation"
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Mon Aug 09, 2021 4:17 am Post subject: |
|
|
Potentially there is an object which has not been destroyed upon closing.
Here you haven't assigned a parent for the timer. If you place your Lua form name between the parentheses it will make sure that the timer is destroyed when you close your Lua form, or if you don't want to do that you can pass Cheat Engine as the parent like so:
Code: |
t=createTimer(getMainForm())
...
|
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1253
|
Posted: Mon Aug 09, 2021 11:54 am Post subject: |
|
|
In my case too Timer should be standalone and ordinary.
Kill him on start and exit..
Code: | -- kill
if mytm1 then mytm1.Destroy() mytm1=nil end
--create
mytm1=createTimer() mytm1.Interval=1000 mytm1.Enabled=false --- or true |
Timer and "TFont" sometimes overlap, I prefer standalone rendering rather than form designer.
opps!
Code: | TRAINERFORM.OnClose = function(sender)
closeCE()
return cafree
end |
_________________
|
|
Back to top |
|
|
|