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 script, please help.
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Jan 25, 2017 6:50 am    Post subject: Reply with quote

execute this lua code

Code:
getCurrentMemscan().OnlyOneResult=true



after the scan the list will probably stay empty, just execute this to get the result

Code:
return string.format("%x", getCurrentMemscan().Result)



also check parameters for the function :

Code:
  -- firstScan(scanoption, vartype, roundingtype, input1, input2,
  --           startAddress, stopAddress, protectionflags,
  --           alignmenttype, "alignmentparam",
  --           isHexadecimalInput, isNotABinaryString, isunicodescan, iscasesensitive)

  --    scanOption: soUnknownValue, soExactValue, soValueBetween, soBiggerThan, soSmallerThan
  --    vartype: vtByte, vtWord, vtDword, vtQword, vtSingle, vtDouble, vtString,
  --             vtByteArray, vtGrouped, vtBinary, vtAll
  --    roundingtype: rtRounded, rtTruncated, rtExtremerounded
  --    alignmenttype: fsmNotAligned, fsmAligned, fsmLastDigits
  --    protectionflags: X W C   (+ to indicate that flag MUST be set, - MUST NOT, * whatever)




Output to hex instead dec :

Code:
function DEC_HEX(IN)
   if IN<=0 then
      return '0'
   end
   local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
   while IN>0 do
      I=I+1
      IN,D=math.floor(IN/B),math.mod(IN,B)+1
      OUT=string.sub(K,D,D)..OUT
   end
   return OUT
end

local Address = fl.Address[i];
local ReadBytes = readBytes(Address,6,true);
for _,String in pairs(ReadBytes) do
   local Hex = DEC_HEX(String);
   if Hex:len()==1 then
      Hex = '0' .. Hex;
   end
   ReadBytes[_] = Hex;
end
print(unpack(ReadBytes));



Is it no way to change your searching value to AOB ?
Back to top
View user's profile Send private message
ner0
Cheater
Reputation: 0

Joined: 10 Dec 2011
Posts: 32

PostPosted: Wed Jan 25, 2017 9:12 am    Post subject: Reply with quote

Thanks for the code provided, I'll have a go at it.

I'm pretty new to CE, so I don't quite know all approaches to memory scans and value replacements, certainly not familiar with "Array Of Bytes" approach. The only thing I do know is that I want to find specific values and read/write to determined addresses and use LUA to be able to use some logic functionality. I'll probably try to read some tutorials later on and try to learn the best approach to what I want to achieve.

Thank you.
Back to top
View user's profile Send private message
BlazesRus
How do I cheat?
Reputation: 0

Joined: 06 Oct 2019
Posts: 1

PostPosted: Sun Oct 06, 2019 11:49 am    Post subject: Anyway to check whether the Addresses are static? Reply with quote

Anyway to filter out the addresses inside memscan that are non-static?
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
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