View previous topic :: View next topic |
Author |
Message |
sky88 How do I cheat?
Reputation: 0
Joined: 14 Oct 2023 Posts: 4
|
Posted: Sat Oct 14, 2023 2:14 pm Post subject: lua script as trainer |
|
|
hello all together. I am a beginner in cheat Engine and need help.
I take a lua script from a friend for a game. The code is something like this:
monster = 4392
monster1_address = 0x143497C40 + 0x4c
object1_id = readSmallInteger(monster1_address + 0x4) >> 3 & 0x3B
object1_address = 0x143499798 + (2 * object1_id) * 6
writeSmallInteger(monster1_address, monster); writeSmallInteger(object1_address, monster);
All the time i must open it and execute the table. Monster is a value which i can choose by my selfe.
I want make a trainer with cheat engine where i have a Textbox. In the Textbox i can give the number for the monster i want and activate it with a button.
Can anybody tell me how i could do that. Or a tutorial which can help me?
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Sun Oct 15, 2023 12:49 pm Post subject: |
|
|
Code: |
if testForm then testForm.Destroy() testForm=nil end
testForm=createForm()
testEdit1=createEdit(testForm)
testEdit1.Left=10 testEdit1.Top=10
testBtn1=createButton(testForm)
testBtn1.Left=testEdit1.Width + 20
testBtn1.Top=9
testBtn1.Caption="Enable"
testBtn1.OnClick=function()
if testEdit1.Text=="" then
print("Monster not found!")
else
monster = testEdit1.Text
monster1_address = 0x143497C40 + 0x4c
object1_id = readSmallInteger(monster1_address + 0x4) >> 3 & 0x3B
object1_address = 0x143499798 + (2 * object1_id) * 6
writeSmallInteger(monster1_address, monster);
writeSmallInteger(object1_address, monster);
end
end
|
It is a usage example. You can get ideas from this.
Copy the code and click CE >> Table >> Lua Table and paste it there, click the "Execute" button and test the created form.
(If you already know the steps in the description, that's okay.
Details are provided as archives for novices. )
_________________
|
|
Back to top |
|
 |
sky88 How do I cheat?
Reputation: 0
Joined: 14 Oct 2023 Posts: 4
|
Posted: Sun Oct 15, 2023 4:12 pm Post subject: |
|
|
Thanks its function .
But is boring with this style . So i do it with
,,Generate generic trainer lua script from table" and design maually
use a background and
3 edit box name : (CEEdit1,CEEdit2, CEEdit3) and
a button name: (CECustomButton1).
I can have three monsters in the game. But really can not must. So if the boxes are empty so it shall happen nothing. Otherwise i take many ,,Monster not found" Error .
But for the first time i use coding only for one editbox
Code: | function CETrainer_CECustomButton1Click(sender)
monster = CEEdit1.Text
monster1_address = 0x143497C40 + 0x4c
object1_id = readSmallInteger(monster1_address + 0x4) >> 3 & 0x3B
object1_address = 0x143499798 + (2 * object1_id) * 6
writeSmallInteger(monster1_address, monster);
writeSmallInteger(object1_address, monster);
end |
But take this from trainer:
Error:[string "function CETrainer_CECustomButton1Click(sende..."]:2: attempt to index a nil value (global 'monster')
can you or anybody tell me what my mistake is. This type of coding is still new for me
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Mon Oct 16, 2023 3:53 am Post subject: |
|
|
Trainer name >> Edit name >> Text
Code: | monster = CETrainer.CEEdit1.Text |
Button name?
Code: | CETrainer_CECustomButton1 -- ?
-- or
CETrainer_CEButton1 -- ?
|
_________________
Last edited by AylinCE on Mon Oct 16, 2023 10:43 am; edited 1 time in total |
|
Back to top |
|
 |
sky88 How do I cheat?
Reputation: 0
Joined: 14 Oct 2023 Posts: 4
|
Posted: Mon Oct 16, 2023 8:56 am Post subject: |
|
|
i did it again. Name is MyBox1,MyBox2,MyBox3,MyButton
if i generate the trainer i take a exe file. But if i want use it after i click on button.
I take this:
Error:[string "function CETrainer_MyButtonClick(sender)
..."]:3: attempt to index a nil value (global 'MyBox1')
so it must be now i think this:
canavar = CETrainer.MyBox1.Text. Where i must put this?
Description: |
|
Filesize: |
104.09 KB |
Viewed: |
3169 Time(s) |

|
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Mon Oct 16, 2023 10:41 am Post subject: |
|
|
I apologize, it's my fault..
Here, change this line of code.
Code: | monster = MyBox1.Text |
-- new
Code: | monster = CETrainer.MyBox1.Text |
_________________
|
|
Back to top |
|
 |
sky88 How do I cheat?
Reputation: 0
Joined: 14 Oct 2023 Posts: 4
|
Posted: Mon Oct 16, 2023 11:47 am Post subject: |
|
|
thanksss its function . One last question. I want if the box are empty, the programm should do nothing i mean he should skip the code. How could i do that?
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Mon Oct 16, 2023 1:27 pm Post subject: |
|
|
Code: |
function CETrainer_MyButtonClick(sender)
if CETrainer.MyBox1.Text=="" then
showMessage("Monster not found!")
else
monster = CETrainer.MyBox1.Text
monster1_address = 0x143497C40 + 0x4c
object1_id = readSmallInteger(monster1_address + 0x4) >> 3 & 0x3B
object1_address = 0x143499798 + (2 * object1_id) * 6
writeSmallInteger(monster1_address, monster);
writeSmallInteger(object1_address, monster);
end
end
|
Text check : Numbers!
Code: |
CETrainer.MyBox1.OnChange=function(sender)
nr = tonumber(sender.Text)
if nr==nil then
showMessage("Just numbers!")
sender.Text=""
end
end |
_________________
|
|
Back to top |
|
 |
|