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 


Advanced options and Lua

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
kryptek
How do I cheat?
Reputation: 0

Joined: 04 May 2013
Posts: 3

PostPosted: Sat May 04, 2013 6:17 pm    Post subject: Advanced options and Lua Reply with quote

I have some code that I've added to the 'Advanced Options' list, and setting the memory to nothing for the offsets performs the task I want perfectly.

Instead of having to toggle off 4 offsets each time, I'd like to attach the logic to a button I can toggle on and off via code. How can I do this in Lua?
Back to top
View user's profile Send private message
kryptek
How do I cheat?
Reputation: 0

Joined: 04 May 2013
Posts: 3

PostPosted: Sun May 05, 2013 7:05 am    Post subject: Reply with quote

Okay, I think I'm on the right path:

Code:

function WallHack(sender)
  autoAssemble([[

[ENABLE]
  alloc(wallhack,512)
  label(returnhere)
  label(originalcode)
  label(exit)

  wallhack:
  nop
  nop

  originalcode:
  mov [ebx],eax
  mov eax,[ebp-40]

  exit:
  jmp returnhere

  "wingame.exe"+1052FD:
  jmp wallhack
  returnhere:

[DISABLE]
  dealloc(wallhack)
  "wingame.exe"+1052FD:
  mov [ebx],eax
  mov eax,[ebp-40]


  ]])

end


Injects the code just fine; using an intermediate variable to distinguish whether or not it's enabled, how can I specifically call the DISABLE or ENABLE routines from the AutoAssemble script?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Sun May 05, 2013 9:26 am    Post subject: Reply with quote

Just use 2 seperate scripts
Enable script:
"wingame.exe"+1052FD:
Nop
Nop
.... till it makes up the number of bytes of the oneinstruc5ion

Disable script:
"wingame.exe"+1052FD:
mov [ebx],eax

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
kryptek
How do I cheat?
Reputation: 0

Joined: 04 May 2013
Posts: 3

PostPosted: Sun May 05, 2013 11:00 am    Post subject: Reply with quote

Dark Byte wrote:
Just use 2 seperate scripts
Enable script:
"wingame.exe"+1052FD:
Nop
Nop
.... till it makes up the number of bytes of the oneinstruc5ion

Disable script:
"wingame.exe"+1052FD:
mov [ebx],eax


yeah; that's what I ended up doing. How does disabling without deallocating work if I exit cheatengine or my trainer without deallocating? I imagine this leads to memory leaks right?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Sun May 05, 2013 12:23 pm    Post subject: Reply with quote

The scripts doesn't alloc, so there's nothing to dealloc
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
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