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 


Trainer Button Functions

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Sun May 29, 2016 12:40 pm    Post subject: Trainer Button Functions Reply with quote

Hello, im trying to create a trainer with buttons that will teleport you to different places in a game. I got the pointer adresses for (x,y,z)
what i want to happen is: Press button -> Change value of three different pointers to three different values. Which results in a teleport ingame.
This is the code i put in so far but im clearly doing something wrong.
Code:

function CEButton1Click(sender)
writeFloat("[[[[[game.exe+0084E4BC]+308]+c]+18]+658]+38", Value)
writeFloat("[[[[[game.exe+0084E4BC]+2e8]+0]+24]+690]+24", Value)
writeFloat("[[[[[game.exe+0084E4BC]+7c]+2ac]+150]+51c]+24", Value)
end


Here is my pointers:



Pointers.jpg
 Description:
Pointers
 Filesize:  124.42 KB
 Viewed:  7142 Time(s)

Pointers.jpg


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Sun May 29, 2016 1:04 pm    Post subject: Reply with quote

As I have said before:
ParkourPenguin wrote:
If you double click on the "address" field of a memory record that's a pointer, the "Change address" window should appear. The very bottom editbox is the base address. The one above that is the first offset. The next one, the second offset, etc.
Code:
writeFloat("[[baseAddress]+firstOffset]+secondOffset", 3.14)

If it's not working, make sure your offsets are in the right order. Post a picture of that box if you're not sure.

AKA, your offsets are in reverse order.
Code:
function CEButton1Click(sender)
  writeFloat("[[[[[game.exe+0084E4BC]+38]+658]+18]+c]+308", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+690]+24]+0]+2e8", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+51c]+150]+2ac]+7c", Value)
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Sun May 29, 2016 1:21 pm    Post subject: Reply with quote

ParkourPenguin wrote:
As I have said []before[/url]:
ParkourPenguin wrote:
If you double click on the "address" field of a memory record that's a pointer, the "Change address" window should appear. The very bottom editbox is the base address. The one above that is the first offset. The next one, the second offset, etc.
Code:
writeFloat("[[baseAddress]+firstOffset]+secondOffset", 3.14)

If it's not working, make sure your offsets are in the right order. Post a picture of that box if you're not sure.

AKA, your offsets are in reverse order.
Code:
function CEButton1Click(sender)
  writeFloat("[[[[[game.exe+0084E4BC]+38]+658]+18]+c]+308", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+690]+24]+0]+2e8", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+51c]+150]+2ac]+7c", Value)
end


Oh sorry, i missed that part Surprised

Anyways it looks like this now but it is still not working tho :p

Script:



lua scrips.jpg
 Description:
 Filesize:  229.63 KB
 Viewed:  7122 Time(s)

lua scrips.jpg


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Sun May 29, 2016 1:30 pm    Post subject: Reply with quote

The script you're using w/ offsets in reverse order:
Code:
function CEButton1Click(sender)
  writeFloat("[[[[[game.exe+0084E4BC]+308]+c]+18]+658]+38", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+2e8]+0]+24]+690]+24", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+7c]+2ac]+150]+51c]+24", Value)
end

The corrected script w/ offsets in the correct order:
Code:
function CEButton1Click(sender)
  writeFloat("[[[[[game.exe+0084E4BC]+38]+658]+18]+c]+308", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+690]+24]+0]+2e8", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+51c]+150]+2ac]+7c", Value)
end

Do you see the difference? Even if you don't see it and/or don't understand why, you should at least be using the one with the offsets in the correct order.

Side note: make sure the functions are respectively assigned to the buttons' OnClick events.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Sun May 29, 2016 1:45 pm    Post subject: Reply with quote

ParkourPenguin wrote:
The script you're using w/ offsets in reverse order:
Code:
function CEButton1Click(sender)
  writeFloat("[[[[[game.exe+0084E4BC]+308]+c]+18]+658]+38", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+2e8]+0]+24]+690]+24", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+7c]+2ac]+150]+51c]+24", Value)
end

The corrected script w/ offsets in the correct order:
Code:
function CEButton1Click(sender)
  writeFloat("[[[[[game.exe+0084E4BC]+38]+658]+18]+c]+308", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+690]+24]+0]+2e8", Value)
  writeFloat("[[[[[game.exe+0084E4BC]+24]+51c]+150]+2ac]+7c", Value)
end

Do you see the difference? Even if you don't see it and/or don't understand why, you should at least be using the one with the offsets in the correct order.

Side note: make sure the functions are respectively assigned to the buttons' OnClick events.


Oh now i got it right! Thanks so much for being so patient with me!
Back to top
View user's profile Send private message
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