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 


Run specific function on different breakpoint?

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

Joined: 24 Feb 2016
Posts: 8

PostPosted: Wed Feb 24, 2016 9:33 pm    Post subject: Run specific function on different breakpoint? Reply with quote

I'm working on a script that needs to add four different breakpoints in various places, and I'd like to run a different function for each one. Defining a debugger_onBreakpoint function works, but it runs that function for ALL breakpoints, and I'd like to use different functions for each breakpoint.

Alternatively, is there a variable/function with the address of the instruction being broken upon?

EDIT: I figured it out, I can use the EIP register for what I need. I'm still new to assembly Razz
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Feb 24, 2016 11:02 pm    Post subject: Reply with quote

Also, debug_setBreakpoint() accepts a function as the last argument which is called on that breakpoint only.
Back to top
View user's profile Send private message
apemanzilla
How do I cheat?
Reputation: 0

Joined: 24 Feb 2016
Posts: 8

PostPosted: Thu Feb 25, 2016 4:10 pm    Post subject: Reply with quote

Zanzer wrote:
Also, debug_setBreakpoint() accepts a function as the last argument which is called on that breakpoint only.


I can't seem to get this to work - I've tried it two ways.
Setting the 'functiontocall' argument as listed in the main.lua file:
Code:

debug_setBreakpoint(address, function() print("breakpoint!") return 1 end)

Setting the 'breakpointmethod' argument as listed in the main.lua file:
Code:

debug_setBreakpoint(address, nil, nil, function() print("breakpoint!") return 1 end, nil)

Neither seem to do anything at all - no printing, it doesn't even call the debugger_onBreakpoint function.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Feb 25, 2016 4:26 pm    Post subject: Reply with quote

You have CE 6.5?
Back to top
View user's profile Send private message
apemanzilla
How do I cheat?
Reputation: 0

Joined: 24 Feb 2016
Posts: 8

PostPosted: Thu Feb 25, 2016 4:31 pm    Post subject: Reply with quote

Zanzer wrote:
You have CE 6.5?

Yes. I downloaded it a couple days ago from the main page.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Thu Feb 25, 2016 4:36 pm    Post subject: Reply with quote

try
debug_setBreakpoint(address, 1, bptExecute, function() print("breakpoint!") return 1 end)

_________________
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
apemanzilla
How do I cheat?
Reputation: 0

Joined: 24 Feb 2016
Posts: 8

PostPosted: Thu Feb 25, 2016 5:10 pm    Post subject: Reply with quote

Dark Byte wrote:
try
debug_setBreakpoint(address, 1, bptExecute, function() print("breakpoint!") return 1 end)


Working perfectly, thanks!
Back to top
View user's profile Send private message
hemersonkla1
Cheater
Reputation: 0

Joined: 24 Jun 2015
Posts: 34

PostPosted: Mon Aug 22, 2016 10:26 am    Post subject: Reply with quote

Code:
function BUTTON1(sender)
  if sender.Checked then debug_setBreakpoint    (43 4c 49 43 4b 3e)
  else                   debug_removeBreakpoint (43 4c 49 43 4b 3e)
   end
end



Hello. Please help. How i can do it for aob scan ?
Breapoint on aob
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Aug 22, 2016 6:04 pm    Post subject: Reply with quote

Code:
aob = AOBScan("43 4c 49 43 4b 3e")
print(aob[0])
print(tonumber(aob[0],16))
Back to top
View user's profile Send private message
hemersonkla1
Cheater
Reputation: 0

Joined: 24 Jun 2015
Posts: 34

PostPosted: Tue Aug 23, 2016 8:05 am    Post subject: Reply with quote

Zanzer wrote:
Code:
aob = AOBScan("43 4c 49 43 4b 3e")
print(aob[0])
print(tonumber(aob[0],16))


thanks i will try.
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