View previous topic :: View next topic |
Author |
Message |
DarkWolfModding How do I cheat? Reputation: 0
Joined: 23 Sep 2014 Posts: 5
|
Posted: Fri Oct 10, 2014 12:32 pm Post subject: Cheat engine timer - How to use? |
|
|
How do you use the cheat engine timer in a form Including code. I have some static addresses for the game Left 4 Dead 2 and one of those addresses is to enable server cheats. When I make the trainer I want a timer on the trainer to check if the checkbox is checked and if it is it will set the value of the static address to 1 if its not then it will set the value to 0.
NOTE: I want the timer to constantly run so it can check when the checkbox check state is changed and almost imediately change the value of the static address.
PS: the static values aren't pointers because the values are a console commands in the game and therefore static addresses. Will this still work or does it have to be a pointer? If it does have to be a pointer how do I make static addresses a pointer. (If possible)
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 941
|
Posted: Fri Oct 10, 2014 1:52 pm Post subject: |
|
|
You can set 'OnChange' event callback to handle the state change, instead of using timer.
if CheckBox123 is the checkbox control, the callback can be set as:
Code: | CheckBox123.OnChange = function(sender) ... end |
or
Code: | CheckBox123.onChange(function(sender) ... end) |
or
link the event to a function from ui designer.
doc: Code: |
CheckBox Class: (Inheritance: ButtonControl->WinControl->Control->Component->Object)
createCheckBox(owner): Creates a CheckBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
properties
Checked: boolean - True if checked
AllowGrayed: boolean - True if it can have 3 states. True/False/None
State: checkboxstate - The state. (cbUnchecked=0, cbChecked=1, cbGrayed=2)
OnChange: function - Function to call when the state it changed
methods
getAllowGrayed()
setAllowGrayed(boolean)
getState(): Returns a state for the checkbox. (cbUnchecked, cbChecked, cbGrayed)
setState(boolean): Sets the state of the checkbox
onChange(function) |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Fri Oct 10, 2014 1:58 pm Post subject: |
|
|
Assign a function to the OnTimer property and set the interval pretty low (eg 100)
Then in the function check if the checkbox.Checked propert is true. If so, write 1, else 0
As long as you have a method to find the address you wish to write to it should work
_________________
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 |
|
|
DarkWolfModding How do I cheat? Reputation: 0
Joined: 23 Sep 2014 Posts: 5
|
Posted: Fri Oct 10, 2014 4:23 pm Post subject: |
|
|
My if statement doesn't seem to work. Help. this is what it looks like
Code: | function CECheckbox1Change(sender)
cb1State = UDF1.CECheckbox1.getState()
if UDF1.CECheckbox1.state == 1 then
writeInteger('left4dead2.exe+52B8E6D8', 1)
else if UDF1.CECheckbox1.state == 0 then
writeInteger('left4dead2.exe+52B8E6D8', 0)
end
end
end |
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 941
|
Posted: Fri Oct 10, 2014 5:12 pm Post subject: |
|
|
Lua is case sensitive, it is .State, not .state.
btw,it is helpful to insert print statment during debug.
Code: | local debug_print= not TrainerOrigin -- dp stop print when in trainer mode
local function dp(...) if debug_print then print(...) end end
function CECheckbox1Change(sender)
if sender then
local s = sender.State -- or sender.getState()
if s == cbUnchecked then dp('unchecked') end
if s == cbChecked then dp('checked') end
if sender.getAllowGrayed() and s == cbGrayed then dp('Grayed') end
end
end
UDF1.FindComponentByName('CECheckbox1').setAllowGrayed(true)
UDF1.show() |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Fri Oct 10, 2014 5:47 pm Post subject: |
|
|
I recommend UDF1.CECheckbox1.Checked (or sender.Checked) as that returns a simple true/false
In ce 6.4 ce isn't that finicky about case of the first character.
Is CE attached to the process?
and yes, do as panraven suggests and add some prints to see how your path goes.
_________________
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 |
|
|
DarkWolfModding How do I cheat? Reputation: 0
Joined: 23 Sep 2014 Posts: 5
|
Posted: Fri Oct 10, 2014 6:09 pm Post subject: |
|
|
yeah its all attached to the game. Got it working.
quick unrelated question how would I get a value from an address and display it on a label. and also how would I get a value from a slider control and print it to a label
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 941
|
Posted: Fri Oct 10, 2014 6:23 pm Post subject: |
|
|
To read a value, depending on the value type and reading from an opened process or the trainer/ce memory, should be using,
readInteger(address) / readIntegerLocal(address)
readFloat(address)/ readFloatLocal(address)
etc.
you can find description of these functions from the main.lua in your ce installation folder.
For slider/Track Bar, the .Position is the number value you wanted, it is the 'pointer' position between .Min and .Max, which you can be set.
For label, it is .Caption the text displayed, for edit box, it is .Text.
eg.
TrackBar1.OnChange = function(sender)
Label1.Caption = sender.Position
end
|
|
Back to top |
|
|
|