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 read 2bytes in lua script?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
cancandodo
Newbie cheater
Reputation: 0

Joined: 09 Mar 2012
Posts: 14

PostPosted: Thu Nov 02, 2017 8:49 am    Post subject: How to read 2bytes in lua script? Reply with quote

in the lua script

"readbytes"in fact is read 1 byte
"readInteger"in fact is read 4 bytes


How to read 2bytes in lua script?

==========
function shuaxinClick(sender)
control_setCaption(CETrainer.shengao,readBytes("[PrincessMaker.exe+AE6C8]+1ab",2,true))
end
==========
this code can not work to show the real value
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 63

Joined: 06 Jul 2014
Posts: 1964
Location: Arcadian Suburbia

PostPosted: Thu Nov 02, 2017 10:04 am    Post subject: Reply with quote

celua.txt:
Quote:
readSmallInteger(address) : Reads a 16-bit integer from the specified address

_________________
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
cancandodo
Newbie cheater
Reputation: 0

Joined: 09 Mar 2012
Posts: 14

PostPosted: Thu Nov 02, 2017 10:05 am    Post subject: Reply with quote

this code work correct!

function shuaxinClick(sender)
local bt=readBytes("[PrincessMaker.exe+AE6C8]+1ab",2,true)
control_setCaption(CETrainer.shengao,byteTableToWord(bt))
end

then

how to write 2 Bytes to Address?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 122

Joined: 09 Jun 2013
Posts: 3279

PostPosted: Thu Nov 02, 2017 6:29 pm    Post subject: Reply with quote

Perhaps readSmallInteger has a corresponding writeSmallInteger...
Back to top
View user's profile Send private message
movss
Cheater
Reputation: 0

Joined: 10 Feb 2018
Posts: 40

PostPosted: Sat Feb 10, 2018 3:50 pm    Post subject: Reply with quote

先转换成bytes,再写入?
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 9

Joined: 01 Feb 2016
Posts: 897

PostPosted: Sun Feb 11, 2018 2:38 am    Post subject: Reply with quote

yeah send them my greetings
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
patched cheat engine tutorials
Back to top
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 154

Joined: 07 Nov 2008
Posts: 4222
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Feb 11, 2018 2:46 am    Post subject: Reply with quote

Code:
readSmallInteger(address) : Reads a 16-bit integer from the specified address

readSmallInteger, readInteger, readSmallIntegerLocal, readIntegerLocal
can also have second boolean parameter. If true, value will be signed.


So:





writeSmallInteger also handles signed and unsigned values.

For example:
Code:
writeSmallInteger('400500',33536)
writeSmallInteger('400500',-32000)

will write the same two bytes at address 400500.

_________________
Back to top
View user's profile Send private message MSN Messenger
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