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 


Error Dec To Hex convertion

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

Joined: 17 Jan 2020
Posts: 4

PostPosted: Fri Jan 17, 2020 6:16 am    Post subject: Error Dec To Hex convertion Reply with quote

Hello

I'd like to calculate "011d" - "1200" which and equals 131D
my code gives 12F how to make the addition of the two code please? Crying or Very sad

Code:

function CETrainer_CEButton1Click(sender)

hex1 = CETrainer.CEEdit1.text
resultat1 = string.format("0%x", hex1)
Control_setCaption(CETrainer_CEEdit2, resultat1)

end

function CETrainer_CEButton2Click(sender)

hex2 = CETrainer.CEEdit3.text*2
resultat2 = string.format("%x00", hex2)
Control_setCaption(CETrainer_CEEdit4, resultat2)

end

function CETrainer_CEButton3Click(sender)

Control_setCaption(CETrainer_CEEdit5, string.format("%#2x", hex2 + hex1))

end



Capture d’écran (8).png
 Description:
 Filesize:  65.87 KB
 Viewed:  791 Time(s)

Capture d’écran (8).png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 379

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

PostPosted: Fri Jan 17, 2020 7:58 am    Post subject: Reply with quote

fist convert the text into binary form

Since your input is in hexadecimal (base 16) you need to convert the text that way

so use
Code:

hex1 = tonumber(CETrainer.CEEdit1.text,16)
if hex1==nil then
  messageDialog(CETrainer.CEEdit1.text..' is an invalid number', mtError, mbOK)
  return
end


and same for other texts

_________________
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
grolo12
How do I cheat?
Reputation: 0

Joined: 17 Jan 2020
Posts: 4

PostPosted: Fri Jan 17, 2020 9:55 am    Post subject: Reply with quote

Dark Byte wrote:
fist convert the text into binary form

Since your input is in hexadecimal (base 16) you need to convert the text that way

so use
Code:

hex1 = tonumber(CETrainer.CEEdit1.text,16)
if hex1==nil then
  messageDialog(CETrainer.CEEdit1.text..' is an invalid number', mtError, mbOK)
  return
end


and same for other texts



Thank you very much Dark Byte,
works perfectly Very Happy Very Happy Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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