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 


Help me make a script with a 'written value'.

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

Joined: 03 Dec 2011
Posts: 21

PostPosted: Sat Dec 03, 2011 8:47 am    Post subject: Help me make a script with a 'written value'. Reply with quote

I need make a script cheat that can do that:
Search for a value:
62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? d0 4f ?? ?? ?? d0 4f ?? ?? ?? 47
Write this value
Change the value by:
62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? 02 02 02 02 02 02 02 02 02 02 47

Then make another script that can unchange the value:
62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? 02 02 02 02 02 02 02 02 02 02 47
>
62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? d0 4f ?? ?? ?? d0 4f ?? ?? ?? 47
(value written)

Someone know how do that? The cheat engine have the option to read a value? If not, someone know a similar program that can do that?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Dec 03, 2011 9:43 am    Post subject: Reply with quote

Not lua, but an AA command (easier, but lua can do it as well)
Code:

[enable]
alloc(originalbytes,10)
registersymbol(originalbytes)

label(foundaddress)
registersymbol(foundaddress)

aobscan(found, 62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? d0 4f ?? ?? ?? d0 4f ?? ?? ?? 47)

found+c:
foundaddress:

//store the original bytes
originalbytes:
readmem(foundaddress, 10)

//change the bytes
found+c:
db 2,2,2,2,2,2,2,2,2,2

[disable]
foundaddress:
readmem(originalbytes, 10)

unregistersymbol(foundaddress)
dealloc(originalbytes)


You can assign it to a cheat table and just toggle it on/off

bugbypass:
Before clicking assign to table go to memory view->view->userdefined symbols and add foundaddress with address 00400000

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

Joined: 03 Dec 2011
Posts: 21

PostPosted: Sat Dec 03, 2011 10:03 pm    Post subject: Reply with quote

Thanks, but this don't work...
The search found two values, i guess that i need put two scripts and not unregister, right? i don't know how make a script to change two values.
And the (originalbytes), i don't need add they too in the userdefined symbols?

I don't understand the script, the readmem read the value in the 'foundadress', but why i call 'originalbytes' when disable?
Back to top
View user's profile Send private message
ddtank.
Newbie cheater
Reputation: 0

Joined: 03 Dec 2011
Posts: 21

PostPosted: Mon Dec 05, 2011 7:40 am    Post subject: Reply with quote

Please, someone can help me?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Mon Dec 05, 2011 9:10 am    Post subject: Reply with quote

For multiple you will need lua
Code:

function replaceAOB()

  r=AOBScan("62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? d0 4f ?? ?? ?? d0 4f ?? ?? ?? 47")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist=nil
      resultlist={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist[i+1]={}
        resultlist[i+1][1]=a  --store the address
        resultlist[i+1][2]=readBytes(a, 23, true) --store the original bytes     

        --6.1 has an ugly bug with writeBytes using a tableformat so I have to use an ugly workaround...
        for j=12,22 do
          writeBytes(tonumber("0x"..a)+j, 2)
        end


      end
      print("Found "..c.." results")
    else
      print("No results");
    end
  else
    print("Scan error")
  end

end

function restoreAOB()
  for i=1,#resultlist do
    print("restoring result "..i)
    local a=tonumber("0x"..resultlist[i][1])
    local orig=resultlist[i][2];
    for j=12,22 do
      writeBytes(a+j,orig[j])
    end
  end
end


call replaceAOB() to replace the entries and call restoreAOB() to restore the entries.

You can add it to a cheat table by adding a header or other useless entry, and registering an onActivate event with memoryrecord_onActivate which then calls replaceAOB()

Ask if you wish to do that

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

Joined: 03 Dec 2011
Posts: 21

PostPosted: Mon Dec 05, 2011 4:51 pm    Post subject: Reply with quote

Sorry, i don't know how do that. I add the lua command in table -> show cheat table lua script? and how i make the header? table -> create form?
i'm beginner to programming in cheat engine, i only know how search the aobs, and copy and paste scripts to make trainers. xD
If you can post me the ct with the script i'm grateful...
I'm newbie... T_T
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Mon Dec 05, 2011 5:15 pm    Post subject: Reply with quote

Here is a table with this implemented
The code that's inside it:
Code:


function replaceAOB()

  r=AOBScan("62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? d0 4f ?? ?? ?? d0 4f ?? ?? ?? 47")


  if (r~=nil) then
    c=strings_getCount(r)
    if (c>0) then
      resultlist=nil
      resultlist={}
      for i=0,c-1 do
        a=strings_getString(r,i);
        resultlist[i+1]={}
        resultlist[i+1][1]=a  --store the address
        resultlist[i+1][2]=readBytes(a, 23, true) --store the original bytes

        --6.1 has an ugly bug with writeBytes using a tableformat so I have to use an ugly workaround...
        for j=12,22 do
          writeBytes(tonumber("0x"..a)+j, 2)
        end


      end
      --print("Found "..c.." results")
    else
      print("No results");
    end
  else
    print("Scan error")
  end

end

function restoreAOB()
  for i=1,#resultlist do
    --print("restoring result "..i)
    local a=tonumber("0x"..resultlist[i][1])
    local orig=resultlist[i][2];
    for j=12,22 do
      writeBytes(a+j,orig[j])
    end
  end
end


function activatetick(mr, before, currentstate)
  if (before==false) and (currentstate==true) then
    replaceAOB()
  end

  return true
end

function deactivatetick(mr, before, currentstate)
  if (before==false) and (currentstate==false) then
    restoreAOB()
  end

  return true
end

al=getAddressList()
--mr=addresslist_getMemoryRecordByDescription(al,"Replace stuff")
--In this specific cheat table the ID number of 0, only if you delete the entry it will change (moving has no effect)
mr=addresslist_getMemoryRecordByID(al,0);


memoryrecord_onActivate(mr,activatetick)
memoryrecord_onDeactivate(mr,deactivatetick)


don't hesitate to ask if you have questions

also, when loading the table you will get asked to execute the script, answer yes else ticking the button will not work.



example.CT
 Description:

Download
 Filename:  example.CT
 Filesize:  1.97 KB
 Downloaded:  1436 Time(s)


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

Joined: 03 Dec 2011
Posts: 21

PostPosted: Mon Dec 05, 2011 9:25 pm    Post subject: Reply with quote

thx very much!! This 'work', but are some wrong with the script, and i don't know how change it.
The aobs is change to
62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? 02 02 02 02 02 02 02 02 02 02 02 instead
62 06 66 ?? ?? 24 03 a1 4f ?? ?? ?? 02 02 02 02 02 02 02 02 02 02 47

...
Forget, I found the error, to easy, xD
J=12,21 instead J=12,22...

Thx very much friend!!! Now i can hack happy!
...

More a thing, to add more cheats in the table, what i need to do?
And would have how to do a lua script in cheat engine 5.6.1 to make a trainer? In 6.1 the trainer maker don't work...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Mon Dec 05, 2011 11:07 pm    Post subject: Reply with quote

5.6.1 can not make a trainer with this, you will have to use 6.1 to make the trainer (don't forget to assign hotkeys before autogenerating the trainerscript, give the trainer an icon, and do not touch the about text)
_________________
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
ddtank.
Newbie cheater
Reputation: 0

Joined: 03 Dec 2011
Posts: 21

PostPosted: Tue Dec 06, 2011 9:31 am    Post subject: Reply with quote

I can't make a trainer with the 6.1, the exe don't open...
And how place more cheats in the table? i need put in the lua script right? how i make a header with the scripts?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Dec 07, 2011 8:35 am    Post subject: Reply with quote

If you follow these things: give the trainer an icon, and do not touch the about text , then the trainer will open

You make a header by rightclicking the addresslist and choose Create Header

Also, if your description is unique, you can make use of mr=addresslist_getMemoryRecordByDescription(al,"Unique Description") instead of trying to find the ID

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

Joined: 03 Dec 2011
Posts: 21

PostPosted: Wed Dec 07, 2011 10:43 am    Post subject: Reply with quote

The trainer maker still don't working, i tried all... anyway...
Thanks for all man. o/
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