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 


Teleport Coords Save / Load current pos.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Thu Feb 16, 2017 12:47 pm    Post subject: Teleport Coords Save / Load current pos. Reply with quote

Hey there, im lost as to how i can do this, i can teleport all i want, but can't find a way to script a save/load coordinates. All i needed was 1 position. This is what i got to retrieve the coordinates.

Code:
[ENABLE]
aobscanmodule(INJECT,TheForest.exe,F3 0F 10 71 14 0F C6 C0 00 0F 29 85 10 FD FF FF 8B D6) // should be unique
alloc(newmem,$1000)

label(code)
label(return)
globalalloc(coordsbase,4)
newmem:

code:
  movss xmm6,[ecx+14]
  mov [coordsbase],ecx
  jmp return

INJECT:
  jmp newmem
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db F3 0F 10 71 14

unregistersymbol(INJECT)
dealloc(newmem)


Then the pointers use
coordsbase+10 for X
coordsbase+18 for Y
coordsbase+14 for Z

I did this by watching a tutorial here, but now for this save/load thing i suspect envolves much more code and i didn't see any tut.
Any help appreciated.

Thanks.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Feb 16, 2017 1:18 pm    Post subject: Reply with quote

I have posted several examples that you may refer to for reference. I am not at my computer at the moment, but I can help you when I get home if you still need help at that time.
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Thu Feb 16, 2017 1:43 pm    Post subject: Reply with quote

Yes, i still would like that input.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Feb 16, 2017 5:04 pm    Post subject: Reply with quote

I cannot test this and I have not thoroughly checked it. Please report back.

Important:
This script requires an injection location that is exclusive to player coordinates. This script was designed with the assumption that the coordinate base address is stored at [ecx+10]. It is preferable that the injection location is accessing coordinate values constantly (every second).

Hotkeys:

F1 - Save location slot #1
F2 - Load location slot #1

F3 - Save location slot #2
F4 - Load location slot #2



TheForest.CT
 Description:

Download
 Filename:  TheForest.CT
 Filesize:  6.85 KB
 Downloaded:  834 Time(s)

Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Thu Feb 16, 2017 9:07 pm    Post subject: Reply with quote

Hi, thanks for this, awesome script, although there is one issue.
I just opened it to see how it works, i understand most of it, but i fail to understand how/why you chose edx register to store values, maybe i got it wrong. Is it just any register that isn't ecx and it's fine?

The other thing is: it complains about line 9:

alloc(newmem_teleport,1024,TheForest.exe)

"failure determining what TheForest.exe means."
Back to top
View user's profile Send private message
SunBeam
I post too much
Reputation: 65

Joined: 25 Feb 2005
Posts: 4022
Location: Romania

PostPosted: Fri Feb 17, 2017 1:45 am    Post subject: Reply with quote

Oh really.. what do you think "TheForest.exe" means? It should be replaced with your game executable.
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Fri Feb 17, 2017 2:30 am    Post subject: Reply with quote

Huh, yeah, but why does it complain about it? why does it need to be specified? i've got other scripts where i don't have that in similar lines:

simply

alloc(newmem,$1000)

i guess my question is why is it there, and is is essential?
Back to top
View user's profile Send private message
SunBeam
I post too much
Reputation: 65

Joined: 25 Feb 2005
Posts: 4022
Location: Romania

PostPosted: Fri Feb 17, 2017 2:47 am    Post subject: Reply with quote

Sometimes, when you have that many questions, Google is your friend Smile
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Feb 17, 2017 6:47 am    Post subject: Reply with quote

careca777 wrote:
how/why you chose edx register to store values, maybe i got it wrong. Is it just any register that isn't ecx and it's fine?
-Yes; edx was arbitrarily chosen.

careca777 wrote:
The other thing is: it complains about line 9:
-Make sure that you are attached to the correct process and that your process name is TheForest.exe. If not, make the necessary adjustments. Once everything checks out, if you are still receiving the error, just remove that part from your script. Again, I could not test this myself and I did not thoroughly check it, so you will need to be able to troubleshoot these kinds of problems on your own:

Remove the red portion:
Quote:
alloc(newmem_teleport,1024,TheForest.exe)
becomes...
alloc(newmem_teleport,1024)


Is the table working as it should??
Back to top
View user's profile Send private message
SunBeam
I post too much
Reputation: 65

Joined: 25 Feb 2005
Posts: 4022
Location: Romania

PostPosted: Fri Feb 17, 2017 8:32 am    Post subject: Reply with quote

alloc( newmem, $1000 ) will allocate arbitrary memory, not inside the game's process. Normally, you want it inside the game's process.

As I said, take some time off, read a bit about those commands you use and don't know what they do and return with feedback Smile
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Feb 17, 2017 8:58 am    Post subject: Reply with quote

Are you sure that allocation is placed outside of the main module?
I would assume that since the module is defined inside aobscanmodule, that defining it for alloc is unnecessary. I am just guessing, though. Very Happy
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Feb 17, 2017 9:03 am    Post subject: This post has 2 review(s) Reply with quote

SunBeam wrote:
alloc( newmem, $1000 ) will allocate arbitrary memory, not inside the game's process. Normally, you want it inside the game's process.

alloc will attempt to allocate memory in whatever process CE is attached to. If CE is attached to the game, it will allocate memory that belongs to the game (i.e. in the same virtual address space as everything else in the game).

careca777:
The third parameter to alloc is an address that specifies the median of a ~4GB memory region CE should allocate memory in. It's useful for 64-bit targets so that jmp instructions can use a rel32 operand (i.e. 5 bytes) instead of an r/m64 stored just after the jmp instruction (i.e. 14 bytes). It isn't useful in 32-bit targets since every address is within a rel32 displacement of each other.

Anyways... that error is an exception thrown by the symbol handler. It means "TheForest.exe" isn't a valid address. You probably weren't attached to the correct process when you tried that.

_________________
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
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Sun Feb 19, 2017 1:06 pm    Post subject: Reply with quote

Hi there, indeed, after the process is attached there's no more warning.

But now it seems like it's not working, the pointer doesn't get the value it seems. its always with question marks like the screenshot shows.

When i press F1 through F4 nothing happens, no values appear on the pointers.



Capture.PNG
 Description:
 Filesize:  7.41 KB
 Viewed:  14885 Time(s)

Capture.PNG


Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Feb 19, 2017 1:20 pm    Post subject: Reply with quote

The script appears to be working as it should, but the Address data must have been cleared.

I assume that you did not make changes to the script? If you did not, then simply activate the script and double-click on the address for each one (Save Slot #1, Load Slot #1, Save Slot #2 and Load Slot #2). Make sure that the Pointer box is checked, then paste the following address for each one, accordingly:

Save Slot #1: save_coordinates1
Load Slot #1: load_coordinates1
Save Slot #2: save_coordinates2
Load Slot #2: load_coordinates2
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Sun Feb 19, 2017 6:34 pm    Post subject: Reply with quote

hello, i see, but what you're asking is already done, i mean, unless i didn't get it right.

The pointer address is already that and each one has the correct one.
Only the values don't come up.

BTW: there's one "error", it's just that the axis are mixed up they go like this:

coordsbase+10 for X
coordsbase+18 for Y
coordsbase+14 for Z

The only change i did was change the offset in the actual coords pointers.



Capture.PNG
 Description:
 Filesize:  6.47 KB
 Viewed:  14845 Time(s)

Capture.PNG


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
Goto page 1, 2  Next
Page 1 of 2

 
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