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 


Copy and convert from String to Decimal

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Meiyoh
Master Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 400

PostPosted: Mon Mar 19, 2018 3:28 am    Post subject: Copy and convert from String to Decimal Reply with quote

How can I make an unicode string consisting of 7 bytes value =5180 displayed as a string to Decimal 5180 and paste from

"ModelSource" to "ModelTarget" address as a DECIMAL not 7 bytes string?

EG

ModelSource = 5180 (Unicode String)
ModelTarget muse become 5180 but DECIMAL 4 bytes.

How to do so?

_________________
I am the forgotten one the dead one.
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Mar 19, 2018 5:15 am    Post subject: Reply with quote

I believe this should work writeInteger('ModelTarget', tonumber(readString("ModelSource", 7, true))), though I wouldn't expect a 4 character Unicode string to be 7 bytes since typically each unicode character is 2 bytes...
_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Meiyoh
Master Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 400

PostPosted: Mon Mar 19, 2018 6:45 am    Post subject: Reply with quote

FreeER wrote:
I believe this should work writeInteger('ModelTarget', tonumber(readString("ModelSource", 7, true))), though I wouldn't expect a 4 character Unicode string to be 7 bytes since typically each unicode character is 2 bytes...


Thanks this works if I put pointers instead of the "Model" declared.

And here is an example which panraven gave me that works very good!
Thanks to both you !

Code:
function FixBadStuff(sender)

local num = readString("[[Model+8]+10]+1A", 7, true)
num = num and num:match"^%d+"
num = num and tonumber(num)
if num then
WriteInteger("[[[[Model]+1348]+18]+18]+A90C", num)
WriteInteger("[[[[Model]+1348]+18]+18]+A88C", num)

_________________
I am the forgotten one the dead one.
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
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