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 


Add pointer to Lua script cheat engine

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Tue Jul 26, 2016 7:23 pm    Post subject: Add pointer to Lua script cheat engine Reply with quote

How can I add this pointer to my code
My pointer is :
"mygame.exe"+00773BB8

1st offest : 1c
2nd :d8
3d : 470
4 :14c
5 : 4b0



Code:
[Enable]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem:
push ecx
mov ecx,[mypointer]

cmp [esi+160], ecx
je originalcode




cmp [esi+24],#111
je originalcode
cmp [esi+24],#110
je originalcode

cmp [esi+24],#121
je originalcode

cmp [esi+24],#120
je originalcode

cmp [esi+24],#130
jne originalcode

fimul [esi+20]
mov [esi+20],#0
fdiv qword ptr [roleview.dll+1F3A0]












jmp exit
originalcode:
fimul [esi+20]
fdiv qword ptr [roleview.dll+1F3A0]

exit:
pop ecx
jmp returnhere

"roleview.dll"+21B0:
jmp newmem
nop
nop
nop
nop
returnhere:
[Disable]
dealloc(newmem)
"roleview.dll"+21B0:
fimul [esi+20]
fdiv qword ptr [roleview.dll+1F3A0]
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Jul 26, 2016 8:50 pm    Post subject: Reply with quote

Code:
mov ecx,[mygame.exe+00773BB8]
mov ecx,[ecx+1C]
mov ecx,[ecx+D8]
mov ecx,[ecx+470]
mov ecx,[ecx+14C]
mov ecx,[ecx+4B0]
Back to top
View user's profile Send private message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Tue Jul 26, 2016 9:38 pm    Post subject: Reply with quote

Zanzer wrote:
Code:
mov ecx,[mygame.exe+00773BB8]
mov ecx,[ecx+1C]
mov ecx,[ecx+D8]
mov ecx,[ecx+470]
mov ecx,[ecx+14C]
mov ecx,[ecx+4B0]


The game keep crashing when I do that
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Tue Jul 26, 2016 10:40 pm    Post subject: Reply with quote

game crashes when your pointer isnt valid, break and trace your injection, when the game crashes, you can see which line it crashes on and if your addresses are lining up the way you wanted them to. Odds are you will see that one of your offsets went to the wrong address and the cmp at the end is what broke it when it tries to read the address.
Back to top
View user's profile Send private message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Wed Jul 27, 2016 12:15 am    Post subject: Reply with quote

cooleko wrote:
game crashes when your pointer isnt valid, break and trace your injection, when the game crashes, you can see which line it crashes on and if your addresses are lining up the way you wanted them to. Odds are you will see that one of your offsets went to the wrong address and the cmp at the end is what broke it when it tries to read the address.




Idk how to break and trace my injection .. Iam trying to use this pointer value to compare it with another value
Code:
[esi+160]

Is there anyway to get the value of this pointer only without trying to but it in my script ?
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Wed Jul 27, 2016 2:32 am    Post subject: Reply with quote

Store it when the games uses it, reference your stored address. Otherwise, I dont really understand your question, but I think the answer is no.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Jul 27, 2016 11:46 am    Post subject: Re: Add pointer to Lua script cheat engine Reply with quote

Topic is wrong, should be:
"Add pointer to AA script"



Pointers are tricky. Some of them aren't correct 100% of the time. Assume your pointer is correct in 99.9% of time, if your hack point is excessively used, you will get a crash after a while. Your 5 level pointer sometimes can be broken on e.g. second offset (level 2), and point to null (address is 0) or random value.



You can try this one. It will reject any too small addresses (0-10000) in multilevel pointer chain.
If that doesn't help, you will have to use IsBadReadPtr.
Code:
mov ecx,[mygame.exe+00773BB8]
cmp ecx,10000
jb originalcode

mov ecx,[ecx+1C]
cmp ecx,10000
jb originalcode

mov ecx,[ecx+D8]
cmp ecx,10000
jb originalcode

mov ecx,[ecx+470]
cmp ecx,10000
jb originalcode

mov ecx,[ecx+14C]
cmp ecx,10000
jb originalcode


// this
lea ecx,[ecx+4B0]

// or this (depends on what you want, if address, use above line, if value use below line)
//mov ecx,[ecx+4B0]




Or maybe a mix of Lua Scripting and Asm Scripting would be an even better idea.

_________________
Back to top
View user's profile Send private message MSN Messenger
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Wed Jul 27, 2016 3:48 pm    Post subject: Reply with quote

sry but the game keep crashing i used :

Code:
cmp ecx,10000
jb originalcode


I want to transfer my enemy co ordinates to mine can u code this ?
when i try to but the pointer In AA crash might my code wrong ?



ce4.jpg
 Description:
The instruction which access my x address only
 Filesize:  15.13 KB
 Viewed:  17652 Time(s)

ce4.jpg



ce3.jpg
 Description:
Myx pointer
 Filesize:  16.22 KB
 Viewed:  17652 Time(s)

ce3.jpg



ce2.jpg
 Description:
enemy x pointer
 Filesize:  28.2 KB
 Viewed:  17652 Time(s)

ce2.jpg



ce1.jpg
 Description:
co ordinates
 Filesize:  21.1 KB
 Viewed:  17652 Time(s)

ce1.jpg


Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Wed Jul 27, 2016 11:27 pm    Post subject: Reply with quote

I answered this question in your other thread. Please dont make multiple threads asking the same question! If you had added the pictures to the other thread, i could have filled in most of the script, but you can figure it out pretty quickly.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jul 28, 2016 7:54 am    Post subject: Reply with quote

Twistedfate wrote:
I want to transfer my enemy co ordinates to mine can u code this ?

Try Lua scripting only then:

Code:
function enemyTeleportHotkeyFunc()
  local x=readInteger("[mygame.exe+offset0]+268")
  local y=readInteger("[mygame.exe+offset0]+26C")

  if x~=nil then
    writeInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+724",x)
    writeInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+720",y)
  end
end

if enemyTeleportHotkey~=nil then enemyTeleportHotkey.destroy(); enemyTeleportHotkey=nil end

enemyTeleportHotkey = createHotkey(enemyTeleportHotkeyFunc,VK_F6)
enemyTeleportHotkey.DelayBetweenActivate = 200


hotkey: F6

_________________
Back to top
View user's profile Send private message MSN Messenger
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Thu Jul 28, 2016 9:54 am    Post subject: Reply with quote

mgr.inz.Player wrote:
Twistedfate wrote:
I want to transfer my enemy co ordinates to mine can u code this ?

Try Lua scripting only then:

Code:
function enemyTeleportHotkeyFunc()
  local x=readInteger("[mygame.exe+offset0]+268")
  local y=readInteger("[mygame.exe+offset0]+26C")

  if x~=nil then
    writeInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+724",x)
    writeInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+720",y)
  end
end

if enemyTeleportHotkey~=nil then enemyTeleportHotkey.destroy(); enemyTeleportHotkey=nil end

enemyTeleportHotkey = createHotkey(enemyTeleportHotkeyFunc,VK_F6)
enemyTeleportHotkey.DelayBetweenActivate = 200


hotkey: F6




thank you very much for tracing my post and helping me
I will try the script but I have many question as newbie "Sad
In the picture ( ce2.jpg ) the first offset is 324 or its the last one ?

* this code is my co ordinates :

Code:
function enemyTeleportHotkeyFunc()
  local x=readInteger("[mygame.exe+offset0]+268")
  local y=readInteger("[mygame.exe+offset0]+26C")



and this is for my enemy :
Code:
writeInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+724",x)
    writeInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+720",y)


writeInteger mean copy the value of enemy co ordinates to mine ?

** what is offset0 ?
lets say [mygame.exe+00773BB8] and there are some offsets in pointer
offset0 is 00773BB8 or the first one or just i could leave it .

**F6 will enable and disable script ?
** executing the script from ce table table script or by pressing Ctrl+L in memory viewer or all the same ?.

Iam learning assembly as first programming language and memory reading etc and want to learn c++ and lua sry for these question but Iam trying to learn from you ^^
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jul 28, 2016 11:12 am    Post subject: Reply with quote

Quote:
In the picture ( ce2.jpg ) the first offset is 324 or its the last one ?

It is the first offset.
In memory record (memory record is an addresslist entry and can be "AA script", "multilevel pointer", "address" )
Pointers in memory record in addresslist - first offset starts from bottom.



Quote:
mean copy the value of enemy co ordinates to mine ?

Above script reads player coordinates data, and writes it to enemy coordinates.
Enemy should teleport.

Quote:
what is offset0

well, I should write, 5 level pointer looks like this:
[[[[[modulename+moduleoffset]+offset1]+offset2]+offset3]+offset4]+offset5

Let's say "mygame.exe+00773BB8" is the base,
and offsets are: 324(first), 2e0, 680, 400, 724(last)

then this will be the full pointer:
[[[[[mygame.exe+00773BB8]+324]+2e0]+680]+400]+724



Quote:
F6 will enable and disable script?

Pressing F6 will execute function enemyTeleportHotkeyFunc.


Just copy whole script from my previous post, and paste it inside "lua script: cheat table" window. (menu -> table -> show cheat table lua script ), save it.


Click 'execute script', open game process, go to game and press F6 key.



PS: do not quote whole post. It is not nice. There are exceptions: e.g. you are referring to post at page 56, and topic currently have 132 pages.

_________________
Back to top
View user's profile Send private message MSN Messenger
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Thu Jul 28, 2016 12:43 pm    Post subject: Reply with quote

thank you very much for your advanced tutorial , I want to teleport my self to the enemy so changing the codes will be done the first 2 line with the last 2 ^^
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jul 28, 2016 12:53 pm    Post subject: Reply with quote

yes
Code:
function enemyTeleportHotkeyFunc()
  local x=readInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+724")
  local y=readInteger("[[[[[mygame.exe+offset0]+324]+2e0]+680]+400]+720")

  if x~=nil then
    writeInteger("[mygame.exe+offset0]+268",x)
    writeInteger("[mygame.exe+offset0]+26C",y)
  end
end

_________________
Back to top
View user's profile Send private message MSN Messenger
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Sat Jul 30, 2016 5:47 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
yes


perfect working perfect thanks but can I do compare like ASM?
if value equals to 0 then jump
and comparing between my x and enemy x if greater than 18 then jump ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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