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 


Setting a EditBox Text

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

Joined: 08 Oct 2012
Posts: 577

PostPosted: Sun Jun 11, 2017 10:20 am    Post subject: Setting a EditBox Text Reply with quote

I have an old table probably designed in 5.4 or earlier. Everything was done to a CheatPanel by the old design method, not programming.
Now I have added a EditBox and I would like to have the edit box display a value from a specific location, this didn't work
(0xreadBytes(0x004A0FC3))

Two questions arise, the first how to make it display the read byte,
and secondly how to display a byte of a record description of the table i.e. Level 1, Level 2 etc.?

EDIT: I forgot to mention that the readBytes(0x004A0FC3) was placed in the EditBox Text
Back to top
View user's profile Send private message Yahoo Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun Jun 11, 2017 8:30 pm    Post subject: Reply with quote

As far as I know you'd probably need to use the table's lua script to run something like this
Code:
function tableToHex(bytes)
  bytesString = ""
  for k,b in ipairs(bytes) do
    -- format and append each byte to the bytesString
    bytesString = bytesString .. string.format("0x%02X ", b) -- %#02X didn't add 0x for 0
  end
  -- trim extra space from last
  bytesString = bytesString:sub(0,-2)
  return bytesString
end

CEEditBox.Text = tableToHex(readBytes(0x004A0FC3, 4, true))


Though if you wanted to read a simple integer/float then you don't need the tableToHex function simply

Code:

CEEditBox.Text = tostring(readInteger(0x004A0FC3))
CEEditBox.Text = tostring(readFloat(0x004A0FC3))


alternatively if you had the address in the address list then you could get the memory record and simply use it's value property (which is a string as it's displayed in the CE GUI) eg.

Code:

al = getAddressList() -- probably already done somewhere in the script
mr = al.getMemoryRecordByDescription("Name of memory record") -- may also be done somewhere
CEEditBox.Text = mr.Value


Though if you wanted it to update as it changes, then you'd need to create a timer that runs that code every so often... Not sure what the differences between 5.4 and 6.7 would be however...
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