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 


LUA with AAscript

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

Joined: 02 Jul 2012
Posts: 12

PostPosted: Wed Jul 11, 2012 10:59 am    Post subject: LUA with AAscript Reply with quote

Help. I want to. to a variable in the main code Trainer has been available in a Aasripte. First, I find there Aobscan, which gives me the address (this is the one variable), then runs Aastsript, which found that the address appears variable. Here's the code:
Code:
speedhack_setSpeed(0)
         results=AOBScan("F2 0F 59 90 90 90 90","+X-W-C")
         speedhack_setSpeed(1)
       if (results~=nil) then
            count=stringlist_getCount(results)
            address_speed0 =getAddress(stringlist_getString(results,0))
            address_speed=string.format("%08X",address_speed0)
          object_destroy(results)
          results=nil
       else
         end
         object_destroy(results)
          results=nil
          registerSymbol("address_speed", address_speed, false)
       AAscript = [[
 alloc(cave,18)
label(address_speed)
registersymbol(address_speed)
cave:
mulsd xmm1,xmm0
mov [ebp-20],00000000
mov [ebp-1C],40120000

ret

address_speed:
jmp cave
nop
nop
nop
nop

returnhere:
]]
autoAssemble(AAscript)

.
How can I be, AAscript not want to take it!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Jul 11, 2012 11:34 am    Post subject: Reply with quote

the auto assembler does not know what address_speed is
but it does know what $address_speed is

replace
Code:

address_speed:

with
Code:

$address_speed:
address_speed:

That way the current address pointer will be set to the address of the lua variable address_speed, and the next line will assign that current address to the global address_speed variable

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

Joined: 02 Jul 2012
Posts: 12

PostPosted: Wed Jul 11, 2012 2:28 pm    Post subject: Reply with quote

Changed! Execute the code, but the result is the same, no changes shall issue!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Jul 11, 2012 2:44 pm    Post subject: Reply with quote

Have you confirmed address_speed contains a valid string representing an address?
Alternatively, build the aa script up out of two strings with the address inbetween

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

Joined: 02 Jul 2012
Posts: 12

PostPosted: Wed Jul 11, 2012 3:10 pm    Post subject: Reply with quote

Yes, I have the address in the format of hex.

Dark Byte wrote:

Alternatively, build the aa script up out of two strings with the address inbetween

How?
f you can. then make changes to my script as above!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Jul 11, 2012 9:16 pm    Post subject: Reply with quote

instead of
Code:

autoAssemble(AAscript)

do
Code:

writeToClipboard(AAscript)

Then paste into the auto assembler and assemble the result. See if it gives an idea on what goes wrong.

This is what I meant
[[first
part
]]..stringwithaddress..[[:
secondpart
]]

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

Joined: 02 Jul 2012
Posts: 12

PostPosted: Thu Jul 12, 2012 1:09 pm    Post subject: Reply with quote

Thanks to your advice and after some anguish, I finally got a working code.

Code:
function ssdAOB()

speedhack_setSpeed(o)
   results=AOBScan("8D 45 80 90 90 90 90 90 90","+X-W-C")
   speedhack_setSpeed(1)
  if (results~=nil) then
    count=stringlist_getCount(results)
    address_0 =getAddress(stringlist_getString(results,0))
    address= string.format("%08X",address_0)
    object_destroy(results)
    results=nil
   else
   end
    object_destroy(results)
    results=nil
    unregisterSymbol("address")
    registerSymbol("address", address, false)
end

function ssdAAs()
 AAscript = [[
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
originalcode:
mulsd xmm0,xmm1
mov [ebp-18],00000000
mov [ebp-14],90909090
movq xmm1,[ebp-18]

exit:
jmp returnhere
address:
jmp newmem
nop
nop
nop
nop
returnhere:
]]
autoAssemble(AAscript)
end

function un_ssdAAs()
 AAscript = [[
dealloc(newmem)
address_speed:
mulsd xmm0,xmm1
movq [ebp-18],xmm0
]]
autoAssemble(AAscript)
end

--ssdAOB() function AOB finds the address of the insertion AAskript
--ssdAAs() set insertion
--un_ssdAAs() returns to its original state
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