Cheat Engine
The Official Site of Cheat Engine

Author Message
dankedgelord
How do I cheat?
Reputation: 0

Joined: 21 Mar 2017
Posts: 2

 Posted: Sun Apr 09, 2017 9:55 am    Post subject: New to lua, can I do XOR? Hi, is it possible to do something like this in cheat engine lua scripting? 1. Go to a specific address 2. XOR the first 4 bytes, and the next 4 bytes. 3. If it returns something like 8F000000 for example, I want to take the first byte 8F, convert it to decimal and add 1 to it and return this value as an integer. Thanks in advance if you have an answer for this.
FreeER
Master Cheater
Reputation: 12

Joined: 09 Aug 2013
Posts: 358

Posted: Sun Apr 09, 2017 11:02 am    Post subject:

The main.lua (and wiki) shows that these exist in lua:
 Code: bOr(int1, int2)   : Binary Or bXor(int1, int2)  : Binary Xor bAnd(int1, int2)  : Binary And bShl(int, int2)   : Binary shift left bShr(int, int2)   : Binary shift right bNot(int)         : Binary not

So I think something like this should work:

 Code: addr = "address of information" val = readInteger(addr) val2 = readInteger(addr.."+4") -- assuming a string address xored = bXor(val, val2) if xored == 0x8F000000 then   return 0x90   --[[    8F+1, lua knows it's a number so unless it needs to be a string it doesn't matter    if you use decimal 144 or hexadecimal 0x90 notation to write it.    if you did need it as a string then tostring(0x90) is all you need    though since you know the value you can do it with just return "144"        for a hex string string.format("%#X", 0x9a) would work    note that I used 9a to demonstrate the formatting better    the # adds 0x to the string, and the case of the X determines    the case of the letters in the hex value (x = a, X = A)   --]] end

Though you can probably forgo the variables and use:

If you don't know what the result will be and just want to return the result plus 1 then:
or
if you want/need it as a string
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 55

Joined: 06 Jul 2014
Posts: 1825

Posted: Sun Apr 09, 2017 11:05 am    Post subject:

_________________
I don't know where I'm going, but I'll figure it out when I get there.
dankedgelord
How do I cheat?
Reputation: 0

Joined: 21 Mar 2017
Posts: 2

 Posted: Sun Apr 09, 2017 12:08 pm    Post subject: Thank you for the replies
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 6 Hours Page 1 of 1

 Jump to: Select a forum Cheat Engine----------------Cheat EngineCheat Engine Lua ScriptingCheat Engine TutorialsGeneral GamehackingAuto Assembler tutorialsPointer tutorialsGame specific tutorialsWebbrowser stuff related tutorialsConsole ModdingLUA TutorialsLua Extensions General Discussions----------------General DiscussionsArtComputer TalkRandom spamArt RequestsArt TutorialsWillekeurige RotzooiGuestsHorse Excrement Cheat Requests----------------Single player cheat request Cheat Engine Downloads----------------TablesTrainersAuto Assemble scripts Coding----------------Cheat Engine SourceCETC Server and ClientsDBVMPlugin developmentGeneral programmingBinariesCrackmesGeneral programming+Game Development2D Graphics3D ModelingGameplay designWeb Development Games----------------Flash GamesGaia OnlineStick Arena
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