View previous topic :: View next topic |
Author |
Message |
moon1 How do I cheat? Reputation: 0
Joined: 11 Apr 2022 Posts: 5
|
Posted: Mon Apr 11, 2022 4:07 am Post subject: Basic Button help |
|
|
hello,
I'm fairly new to cheat engine. I generated my own trainer and need help with the ff:
I got the scan already which has 2 hotkey functions:
1st: MB5 Set Value to: 1750
2nd: MB4 Set Value to: 43a
Now, I added a button that says "On" and "Off" (basic button). Basucally, I want the function of the "On" button when clicked to be the "MB5" and the "Off" button to be the "MB4".
Thank you in advance. |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Mon Apr 11, 2022 4:36 am Post subject: |
|
|
Declare a function that executes the logic based on the keypress for example:
Code: |
--VK_XBUTTON1 0x05 X1 mouse button
--VK_XBUTTON2 0x06 X2 mouse button
-- X1 Mouse Button
if isKeyPressed(0x05) then
local mr = AddressList.getMemoryRecordByDescription('script_description')
mr.value = 1750
end
|
|
|
Back to top |
|
|
moon1 How do I cheat? Reputation: 0
Joined: 11 Apr 2022 Posts: 5
|
Posted: Mon Apr 11, 2022 9:40 am Post subject: |
|
|
Hello, thank you for your response.
I tried your code however, it didn't do anything. Here's the code that I have inside the buttons.
Code: | function CETrainer_CHEATPANELClick(sender)
end
function CETrainer_CEButton1Click(sender)
if isKeyPressed(0x06) then
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = 2000
end
end
function CETrainer_CEButton2Click(sender)
if isKeyPressed(0x05) then
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = '43a'
end
end
|
attached below is the previous of my simple trainer |
|
Back to top |
|
|
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Mon Apr 11, 2022 11:06 am Post subject: |
|
|
well somebody will not have any side buttons in mouse, and the code below that LeFiXER written need to be created in timer and interval which you choose _________________
void(__cdecl *Haxing)(HWND hGameWindow) |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1250
|
Posted: Mon Apr 11, 2022 11:43 am Post subject: |
|
|
Make sure the key is correct.
Here is a code you can use.
Code: | function MB5()
sleep(100)
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = 2000
end
function MB4()
sleep(100)
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = '43a'
end
CETrainer.CEButton1.OnClick=function()
MB5()
end
CETrainer.CEButton2.OnClick=function()
MB4()
end
if mb5 then mb5.Destroy() mb5=nil end
mb5=createHotkey(MB5, VK_XBUTTON1) --0x05 ?
if mb4 then mb4.Destroy() mb4=nil end
mb4=createHotkey(MB4, VK_XBUTTON2) |
For single button, 2 keys, double action:
Code: | local index=2
CETrainer.CEButton1.Caption="ON"
function MB5()
local mr = AddressList.getMemoryRecordByDescription('AOE')
sleep(100)
if index==1 then
mr.value = '43a'
CETrainer.CEButton1.Caption="ON"
index=2
else
mr.value = 2000
index=1
CETrainer.CEButton1.Caption="OFF"
end
end
CETrainer.CEButton1.OnClick=function()
MB5()
end
if mb5 then mb5.Destroy() mb5=nil end
mb5=createHotkey(MB5, VK_XBUTTON1) --0x05 ?
if mb4 then mb4.Destroy() mb4=nil end
mb4=createHotkey(MB5, VK_XBUTTON2) |
_________________
|
|
Back to top |
|
|
moon1 How do I cheat? Reputation: 0
Joined: 11 Apr 2022 Posts: 5
|
Posted: Mon Apr 11, 2022 12:15 pm Post subject: |
|
|
Hello, thank you for the codes @AylinCE. It really works and I appreciate the help.
However, if I want it to be simple for example clicking the button "On" makes the 'AOE' value change from 43a to 3000 and when I click on the "Off" button, it makes the 'AOE' value change back to 43a. |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1250
|
Posted: Mon Apr 11, 2022 1:36 pm Post subject: |
|
|
I think the first code is suitable for this situation.
Code: | function MB5()
sleep(100)
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = '43a'
end
function MB4()
sleep(100)
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = 3000
end
CETrainer.CEButton1.OnClick=function() --ON
MB5()
end
CETrainer.CEButton2.OnClick=function() --OFF
MB4()
end
if mb5 then mb5.Destroy() mb5=nil end
mb5=createHotkey(MB5, VK_XBUTTON1) --ON key..
if mb4 then mb4.Destroy() mb4=nil end
mb4=createHotkey(MB4, VK_XBUTTON2) --OFF key |
_________________
|
|
Back to top |
|
|
moon1 How do I cheat? Reputation: 0
Joined: 11 Apr 2022 Posts: 5
|
Posted: Mon Apr 11, 2022 1:50 pm Post subject: |
|
|
AylinCE wrote: | I think the first code is suitable for this situation.
Code: | function MB5()
sleep(100)
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = '43a'
end
function MB4()
sleep(100)
local mr = AddressList.getMemoryRecordByDescription('AOE')
mr.value = 3000
end
CETrainer.CEButton1.OnClick=function() --ON
MB5()
end
CETrainer.CEButton2.OnClick=function() --OFF
MB4()
end
if mb5 then mb5.Destroy() mb5=nil end
mb5=createHotkey(MB5, VK_XBUTTON1) --ON key..
if mb4 then mb4.Destroy() mb4=nil end
mb4=createHotkey(MB4, VK_XBUTTON2) --OFF key |
|
Thank you for clarifying this one and providing with a functional code.
How do I create another 2 buttons without the hotkey functions and the scan is labelled as “AS”, what function/s should I use? Or do you have a sample code that I can play with? As in a plain button that does 1 function.
Overview:
(NO HOTKEYS)
scan description: ‘AS’
button 1 is labeled as level 1 and button 2 is labelled as level 2
Level 1 function : if clicked, set AS to 15 and print “Level 1 activated”
Level 2 function:if clicked, set AS to 30 and print “Level 2 activated”
Thank you again in advance! |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1250
|
Posted: Mon Apr 11, 2022 2:45 pm Post subject: |
|
|
Code: | CETrainer.CEButton1.OnClick=function() --Button 3 ..
local mr1 = AddressList.getMemoryRecordByDescription('AS')
mr1.value = 15
print("Level 1 Active!")
end
CETrainer.CEButton2.OnClick=function() --Button 4 etc.
local mr1 = AddressList.getMemoryRecordByDescription('AS')
mr1.value = 30
print("Level 2 Active!")
end |
_________________
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
|
Back to top |
|
|
moon1 How do I cheat? Reputation: 0
Joined: 11 Apr 2022 Posts: 5
|
Posted: Mon Apr 11, 2022 11:41 pm Post subject: |
|
|
Very thankful for this one! Great help!
Last question, is there a way that a Memo can be linked to the button? For example, when I click the button 3 the Memo will display as "Level 1 Activated". If button 4, the Memo will display as "Level 2"
Thank you! |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1250
|
Posted: Tue Apr 12, 2022 2:29 am Post subject: |
|
|
A memo box might take up too much space for that.
My advice is to put a label at the bottom of the Trainer form.
Here is your code for both label, note and edit.
(I assume the trainer name is the same)
Edit and use the samples as you wish.
Code: | CETrainer.CEButton1.OnClick=function() --Button 3 ..
local mr1 = AddressList.getMemoryRecordByDescription('AS')
mr1.value = 15
CETrainer.CELabel1.caption="Level 1 Active!"
--CETrainer.CEMemo1.Add("Level 1 Active!") --Appends to the continuation of the current line.
--CETrainer.CEMemo1.Lines.Text=("Level 1 Active!") --Clears previous records.
--CETrainer.CEEdit1.Text="Level 1 Active!"
end |
_________________
|
|
Back to top |
|
|
moon1 How do I cheat? Reputation: 0
Joined: 11 Apr 2022 Posts: 5
|
Posted: Tue Apr 12, 2022 3:47 am Post subject: |
|
|
This is very useful! Thank you very much AylinCE!!! |
|
Back to top |
|
|
|