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 


Search for Array and substitute following bytes
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Nov 20, 2013 2:37 pm    Post subject: Reply with quote

Google is your friend Wink.
And I've created a simple script to do so, few months ago. (Second script, to test and etc.);
http://forum.cheatengine.org/viewtopic.php?p=5480782#5480782

About your second question, you may use the createNativeThread function
Code:
Thread Class: (Inheritance: Object)
createNativeThread(function(Thread)) :
  Executes the given function in another thread using the systems thread mechanism
  The function returns the Thread class object
  function declaration: function (Thread)

properties

methods
  freeOnTerminate(thread, state) :
    When set to true the thread object will free itself when the function ends (default=true)
    Note: Use this only from inside the thread function as the thread might have already terminated and freed itself when called

  thread_synchronize(thread, function(thread)) :
    Called from inside the thread. This wil cause the tread to get the main thread to execute the given function and wait for it to finish.
    Usually for gui access
    function (Thread)

  thread_waitfor(thread) :
    Waits for the given thread to finish (Not recommended to call this from inside the thread itself)


Example script:
Code:
lastvar = 1
var = 0;
createNativeThread(function() for i=1,1000000000 do var = i; if (var / 10) == lastvar then print(var); lastvar = var; end end end);
t = createTimer(nil,false);
t.Interval = 1000;
t.onTimer = function (sender) print(var); if var == 1000000000 then sender.destroy(); end end;
t.Enabled = true;


Beware, graphical rendering (like using canvas and pen and brush and etc.) with this function ruins the 'quality'.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
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 Nov 20, 2013 4:30 pm    Post subject: Reply with quote

processMessages() is the equivelent of DoEvents
_________________
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
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Nov 20, 2013 5:04 pm    Post subject: Reply with quote

Indeed it does work.
Code:
for i=1,2000 do
    processMessages()
    print(i)
end

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
toebab
Newbie cheater
Reputation: 0

Joined: 23 Oct 2013
Posts: 10

PostPosted: Thu Nov 21, 2013 9:42 am    Post subject: WOW Reply with quote

Im sorry, I dont have better words to describe it.... Just WOW!
I'll go and set it up nicely and make sure you get credits for all your help as well!
Ill pm you the final product in case somebody asks for the same stuff.
(I wont post the finished product here since it is way to powerful for everybody to download it ) Cool
Back to top
View user's profile Send private message
toebab
Newbie cheater
Reputation: 0

Joined: 23 Oct 2013
Posts: 10

PostPosted: Mon Nov 25, 2013 3:07 pm    Post subject: skype Reply with quote

DaSpamer,
I have sent you a msg on skype since I cant PM in here Sad
I hope to hear from you soon.
Back to top
View user's profile Send private message
sillygoose123
How do I cheat?
Reputation: 0

Joined: 01 Feb 2024
Posts: 3

PostPosted: Sat Feb 03, 2024 12:25 pm    Post subject: Re: CE Script not updating Reply with quote

This looks a lot like what I'm trying to do, except I don't want the addresses to be written to a seperate file, I'd like the addresses to be added directly to the cheat engine table with the script. I think it might be the creatememoryrecord() command but I don't actually know how to tell it to reference the aobscan result... I would like the address that has the aob scan result values to be added to my cheat table upon getting found. Along with the address at +0x30, +0xb0, +0xc0, and +0xd0 offset from that.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Sun Feb 04, 2024 6:49 am    Post subject: Re: CE Script not updating Reply with quote

sillygoose123 wrote:
This looks a lot like what I'm trying to do, except I don't want the addresses to be written to a seperate file, I'd like the addresses to be added directly to the cheat engine table with the script. I think it might be the creatememoryrecord() command but I don't actually know how to tell it to reference the aobscan result... I would like the address that has the aob scan result values to be added to my cheat table upon getting found. Along with the address at +0x30, +0xb0, +0xc0, and +0xd0 offset from that.


Play with this code example.
Or take whatever works for you.

Code:
alist = getAddressList()
local vTypTbl2={["Byte"]=0,["vtWord"]=1,["vtDword"]=2,["vtQword"]=3,["vtSingle"]=4,["vtDouble"]=5,["vtString"]=6 }
local offsTbl1={"30","B0","C0","D0"}

function startmem1(addr,desc,offs,ops) -- 2=4 Byte -- 12=Pointer
--print(2,addr,desc,offs,ops)
 if ops==1 then
  local mem1 = alist.createMemoryRecord()
    mem1.Address = addr
    mem1.Type = vTypTbl2.vtDword
    mem1.Description = desc
 elseif ops==2 then -- pointer
  local mem1 = alist.createMemoryRecord()
    mem1.Address = addr
    mem1.OffsetCount = 1
     mem1.setOffset(0, "0x"..offs)
    mem1.Type = vTypTbl2.vtSingle
    mem1.Description = desc
    -- or
    --local mem1 = alist.createMemoryRecord()
    --mem1.Address = addr.."+"..offs
    --mem1.Type = vTypTbl2.vtDword
    --mem1.Description = desc
 elseif ops==3 then -- full pointer
  local mem1 = alist.createMemoryRecord()
    mem1.Address = addr
    mem1.OffsetCount = #offsTbl1
     local cnt = 0
     for l,k in pairs(offsTbl1) do
       mem1.setOffset(cnt, "0x"..k)
       cnt = tonumber(cnt) + 1
     end
    mem1.Type = vTypTbl2.vtSingle
    mem1.Description = desc
 end
end

function searchAndCreateAdrr(search)
aobresult=AOBScan(tostring(search))
  if (aobresult~=nil) then
    print("Results found: "..aobresult.Count)
      for i=0, aobresult.Count -1 do
        addr1 = aobresult[i]
        desc = i.." - "..addr1.."(4Bytes)"
        startmem1(addr1,desc,"",1)
          for l,k in pairs(offsTbl1) do
           desc1 = i.." - "..addr1.."(P:"..k..")"
           startmem1(addr1,desc1,k,2)
          end
          desc2 = i.." - "..addr1.."(fullPnt.)"
          startmem1(addr1,desc2,"",3)
      end

    aobresult.destroy()
  else
    print("No results found")
  end
end

searchAndCreateAdrr("A0 86 01 00") -- your aobs code search?

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website 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
Goto page Previous  1, 2
Page 2 of 2

 
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