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 


Multiple Lua breakpoints?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Woza
Newbie cheater
Reputation: 0

Joined: 08 Sep 2012
Posts: 12

PostPosted: Thu Aug 29, 2013 12:52 pm    Post subject: Multiple Lua breakpoints? Reply with quote

Code:
addys = {}
addys.enemies = "89 48 04 8B 8D 24 FF FF FF 89 48 08 E9 73 00 00 00"
addys.player = "66 0F D6 AB 00 01 00 00 F3 0F 7E 6E 18 66 0F D6 AB 08 01 00 00"
enemies = {}
player = {}

function debugger_onBreakpoint()
         if (EIP == addys.enemies) then
            enemies[EAX] = {x = readFloat(EAX), y = readFloat(EAX+0x04), z = readFloat(EAX+0x08)}
            return 1
         end
         if (EIP == addys.player) then
            if (enemies[0] ~= nil) then
               writeFloat(EBX+player.x, enemies[0].x)
               writeFloat(EBX+player.y, enemies[0].y+1)
               writeFloat(EBX+player.z, enemies[0].z)
            end
            return 1
         end
         debug_continueFromBreakpoint(co_run) -- continue execution
         return 0 -- let CE know we handled breakpoint, no need to update debugger form
end

for k,v in pairs(addys) do
addys[k] = AOBScan(v)
if addys[k] == nil then print("Error: couldnt find AOB " .. v) else addys[k] = tonumber(addys[k][0],16)
end
end


player.x = 0xFC -- player offsets
player.y = 0x104
player.z = 0x108

debugProcess()
debug_setBreakpoint(addys.enemies)
debug_setBreakpoint(addys.player)


Here is my code. I have 2 opcodes; one writes to the players coordinates and the other one to the enemies coordinates. I am trying to make a telekill script but cant seem to get 2 breakpoints at once. The enemies addresses sometimes switch when they die, thats why I need to update them with a breakpoint.

Can someone help?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Aug 29, 2013 1:14 pm    Post subject: Reply with quote

Have you confirmed that addys.enemies and addys.player actually contain valid addresses ?
setBreakpoint can either take a decimal integer/number or a ceformatted string (hexadecimal string or registered symbol name)

e.g
try: addys[k] = addys[k][0]
that way addys[k] gets the ceformatted string


(Also, the Stringlist Object returned by AOBScan should be freed if you don't want a memory leak. So I recommend using local variables instead of overwriting existing ones so you can actually free it when done with the list)

_________________
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
Woza
Newbie cheater
Reputation: 0

Joined: 08 Sep 2012
Posts: 12

PostPosted: Thu Aug 29, 2013 2:37 pm    Post subject: Reply with quote

Code:
addys = {}
addys.enemies = "89 48 04 8B 8D 24 FF FF FF 89 48 08 E9 73 00 00 00"
addys.player = "66 0F D6 AB 00 01 00 00 F3 0F 7E 6E 18 66 0F D6 AB 08 01 00 00"
enemies = {}
player = {}


function debugger_onBreakpoint()
         if (EIP == addys.enemies) then
            enemies[EAX] = {x = readFloat(EAX), y = readFloat(EAX+0x04), z = readFloat(EAX+0x08)}
            return 1
         end
         if (EIP == addys.player) then
            for k,v in pairs(enemies) do
                print(v)
                if (v ~= nil) then
                   print(EBX) -- this print right here I am wondering about
                   writeFloat(EBX+player.x, v.x)
                   writeFloat(EBX+player.y, v.y+1)
                   writeFloat(EBX+player.z, v.z)
                else
                    enemies.remove(k)
                end
            end
            return 1
         end
         debug_continueFromBreakpoint(co_run) -- continue execution
end

for k,v in pairs(addys) do
addys[k] = AOBScan(v)
if addys[k] == nil then print("Error: couldnt find AOB " .. v) else addys[k] = tonumber(addys[k][0],16)
end
end
print("Found AOBs")

player.x = 0xFC
player.y = 0x104
player.z = 0x10C

debugProcess()
debug_setBreakpoint(addys.enemies)
debug_setBreakpoint(addys.player)


that print(EBX) is returning 2 different addresses. My X coordinate locks perfectly on the enemies, but not Y or Z. How could I get the print(EBX) to return 1 address (the correct one). Is it interfering with the other breakpoint?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Aug 29, 2013 3:01 pm    Post subject: Reply with quote

No, it won't interfere as breakpoints are handled one by one. (the target freezes completely on each breakpoint until the current one continues)

the value of EBX is as it is when EIP has hit that specific address

Most likely the function you're in is called by something else as well. See if you can make a distinction between the correct state and the wrong state

_________________
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