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 


readInteger(address) Is there anyway i can read 2 bytes!

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Thu Nov 28, 2013 11:20 am    Post subject: readInteger(address) Is there anyway i can read 2 bytes! Reply with quote

Hello i made an editor in which i used the readInteger and readBytes command to show the value already present in edit box.
My issue is that look at the red boxes. The bowling ability That value should be in 500-2000 range not in lakhs as it is showing. It is actually showing Integer 4-Bytes value. If in table i change it to Integer 2-bytes, it shows the correct value. For some players it shows correct value like its showing for batting ability but for most players bowling ability is shown in lakhs (4-bytes)
Is there any command readInteger that reads only Integer 2-bytes and not Integer 4-Bytes.
Also will I have to change the writeInteger command too? to write 2bytes integer and not 4bytes.

My editor is ready to be uploaded. Just this small glitch?
Please help.

EDIT : In windows calculator i type that value as QWord and then click on just Word. Its showing correct value of 900 something. So it means its readWord command but i cant see such a command in main.lua (there is readQword)



ScreenHunter_01 Nov. 28 21.37.jpg
 Description:
see the red box of bowling. Its showing Integer 4 bytes value. It should show as Integer 2-bytes.
 Filesize:  112.62 KB
 Viewed:  13202 Time(s)

ScreenHunter_01 Nov. 28 21.37.jpg


Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 891

PostPosted: Thu Nov 28, 2013 11:55 am    Post subject: Reply with quote

I don't use Lua, so I can't confirm or deny the existence of a readShort function. However, you can always just do some arithmetic to get your 917. Long divide and then round out, then multiply and subtract to get the low word or read the two bytes individually and use long multiplication and addition to figure your value. If Lua supports bitwise operands and/or shifting, it's even easier.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Thu Nov 28, 2013 12:42 pm    Post subject: This post has 1 review(s) Reply with quote

Code:
function readShortint(address)
  return bAnd(0xFFFF, readInteger(address) )
end


or

Code:
function readShortint(address)
  local b1,b2 = readBytes(address,2)
  return b2*256+b1
end

_________________
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Thu Nov 28, 2013 1:35 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Code:
function readShortint(address)
  return bAnd(0xFFFF, readInteger(address) )
end


or

Code:
function readShortint(address)
  local b1,b2 = readBytes(address,2)
  return b2*256+b1
end


EDIT : OK. I got it. u defined a new function. and then replace readInteger with readShortint. Smile
Working perfect now Smile

Old :
This is my script of the section of screenshot posted :

Quote:

function refreshClick(sender)
setProperty( MyForm_eBatA,"Text", readInteger("[[[Cricket2013.exe+005D4D20]+c8]+b0]+95") )
setProperty( MyForm_eBatL,"Text", readBytes("[[[Cricket2013.exe+005D4D20]+c8]+b0]+96") )
setProperty( MyForm_eBowlType,"Text", readInteger("[[[Cricket2013.exe+005D4D20]+c8]+b0]+b90") )
setProperty( MyForm_eBowlA,"Text", readInteger("[[[Cricket2013.exe+005D4D20]+c8]+b0]+b8d") )
setProperty( MyForm_eBowlL,"Text", readBytes("[[[Cricket2013.exe+005D4D20]+c8]+b0]+b8e") )


As you can see i have used setProperty to show the value of of that pointer in the eBowlA edit box.

the script you gave me will require a separte function and 3 lines to write. so how do i do it.?
My script is triggered on clicking on the refresh button i made.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Thu Nov 28, 2013 1:50 pm    Post subject: Reply with quote

Code:
function readShortint(address)
  return bAnd(0xFFFF, readInteger(address) )
end

function refreshClick(sender)
  ...
  ...
  setProperty( MyForm_eBatA,"Text", readShortint("[[[Cricket2013.exe+005D4D20]+c8]+b0]+95") )
  ...
  ...
end




Btw. you don't need setProperty.

use this form:
Code:
MyForm.eBatA.Text = readShortint("[[[Cricket2013.exe+005D4D20]+c8]+b0]+95")

_________________
Back to top
View user's profile Send private message MSN Messenger
faizangmc
Expert Cheater
Reputation: 0

Joined: 12 Nov 2013
Posts: 167

PostPosted: Thu Nov 28, 2013 2:12 pm    Post subject: Reply with quote

Also why when i exit the trainer. Its exiting properly. But its persisting in process list of taskmanager as many times i open and close it. Neutral
How to force close it in process list of taskmanager.
Any script for it?

Also if i post on any site. Anyone downloading it and want to use will he require to download cheat engine? or just simply run the trainer exe?

What should i write in pre-requisites :
1. Net Framework (coz i have used trainer in past not working bcoz of this)
2. Any more?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

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

PostPosted: Thu Nov 28, 2013 2:38 pm    Post subject: Reply with quote

Again, better post your current work. Without it, we don't know what can be wrong. It can be anything, uppercase instead of lowercase (Lua is case sensitive)....


Trainers types:
EXE gigantic === standalone, CE not required
EXE tiny === CE required
CETRAINER === CE required
CT === CE required


CheatEngine itself and "EXE gigantic" do not require additional libraries.


And you better continue it in your previous thread. This one is solved.
("Is there anyway i can read 2 bytes")

In your previous thread I will add "timer with refresh script" soon.

_________________
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