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 


How To Format A Hex Calculator ,Number To Hex?Seem Like This

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
InfinityLuaMan
How do I cheat?
Reputation: 0

Joined: 15 Jun 2022
Posts: 6

PostPosted: Thu Jun 16, 2022 6:17 am    Post subject: How To Format A Hex Calculator ,Number To Hex?Seem Like This Reply with quote

How to make a hex calculator seem like (1005=>3ED)
And Also Hello Everyone, i'm newbie of this Site! Very Happy



Ảnh chụp màn hình (185).png
 Description:
 Filesize:  15.5 KB
 Viewed:  1996 Time(s)

Ảnh chụp màn hình (185).png



Ảnh chụp màn hình (184).png
 Description:
 Filesize:  16.29 KB
 Viewed:  1996 Time(s)

Ảnh chụp màn hình (184).png


Back to top
View user's profile Send private message Send e-mail
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Thu Jun 16, 2022 6:25 am    Post subject: Reply with quote

You can use string.format for this.
Code:

local value = 1005

print(string.format("%X", value))


Flags:
%d : Decimal number
%X : Hexadecimal
%o : Octal
%f : Floating-point number
%s : Strings
Back to top
View user's profile Send private message
InfinityLuaMan
How do I cheat?
Reputation: 0

Joined: 15 Jun 2022
Posts: 6

PostPosted: Thu Jun 16, 2022 7:52 am    Post subject: Reply with quote

LeFiXER wrote:
You can use string.format for this.
Code:

local value = 1005

print(string.format("%X", value))


Flags:
%d : Decimal number
%X : Hexadecimal
%o : Octal
%f : Floating-point number
%s : Strings

Thanks!The code is work,thanks for your answer. Very Happy
And is there an array byte in that format?
Back to top
View user's profile Send private message Send e-mail
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Thu Jun 16, 2022 9:51 am    Post subject: Reply with quote

You mean like this? "10 05 10 05" for example.
Back to top
View user's profile Send private message
InfinityLuaMan
How do I cheat?
Reputation: 0

Joined: 15 Jun 2022
Posts: 6

PostPosted: Thu Jun 16, 2022 8:47 pm    Post subject: Reply with quote

LeFiXER wrote:
You mean like this? "10 05 10 05" for example.

Yes!
Back to top
View user's profile Send private message Send e-mail
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4299

PostPosted: Fri Jun 17, 2022 12:09 am    Post subject: Reply with quote

If you have an array of numbers, you can convert it to a hex AoB like so:
Code:
function numbers_to_aob_string(t)
  local t2 = {}
  for i,v in ipairs(t) do
    v = assert(tonumber(v)) & 0xFF
    t2[i] = ('%02X'):format(v)
  end
  return table.concat(t2, ' ')
end

local numbers = { 123, 68, 0, 32 }
print(numbers_to_aob_string(numbers))

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
InfinityLuaMan
How do I cheat?
Reputation: 0

Joined: 15 Jun 2022
Posts: 6

PostPosted: Mon Jun 20, 2022 2:13 am    Post subject: Reply with quote

ParkourPenguin wrote:
If you have an array of numbers, you can convert it to a hex AoB like so:
Code:
function numbers_to_aob_string(t)
  local t2 = {}
  for i,v in ipairs(t) do
    v = assert(tonumber(v)) & 0xFF
    t2[i] = ('%02X'):format(v)
  end
  return table.concat(t2, ' ')
end

local numbers = { 123, 68, 0, 32 }
print(numbers_to_aob_string(numbers))

Thanks!It's work.
Back to top
View user's profile Send private message Send e-mail
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