 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Sat Dec 14, 2019 7:46 am Post subject: read/write with several edit boxes |
|
|
How to read/write with edit boxes in the following example? Maybe some piece of code can be improved, what do you advise?
| Code: | baseaddr = 0x400000
function UDF1_CEListBox1Click(sender)
for x = 0, 2 do
UDF1_CEEdit ..17+x.. .Text = string.format('%04X', readSmallInteger(baseaddr+0x5BC6CA + x*2 + UDF1_CEListBox1.ItemIndex * 8))
end
end
for x = 0, 2 do
function UDF1_CEEdit ..17+x.. KeyPress(sender, key)
local a = tonumber(UDF1_CEEdit..17+x.. .Text, 16)
if (a~=nil) and isKeyPressed(VK_RETURN) then
writeSmallInteger(baseaddr+0x5BC6CA + x*2 + UDF1_CEListBox1.ItemIndex * 8, a)
end
return key
end
end |
|
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Dec 14, 2019 8:45 am Post subject: |
|
|
There are many methods to access form controls by name (e.g. CEEdit1):
| Code: | control_1_1 = UDF1.CEEdit1
control_1_2 = UDF1_CEEdit1
control_1_3 = UDF1["CEEdit1"]
return control_1_1 == control_1_2, control_1_2 == control_1_3
1:true
2:true |
control_1_1, control_1_2 and control_1_3 are equal.
inside methods, use "sender".
EDIT:
| Code: | baseaddr = 0x400000
local EditControls = {}
for x = 0,2 do
EditControls[x] = UDF1["CEEdit"..(17+x)]
end
local function ListBoxClick(sender)
local itemindex = sender.ItemIndex
if itemindex~=-1 then
for x = 0, 2 do
EditControls[x].Text = string.format('%04X', readSmallInteger(baseaddr+0x5BC6CA + x*2 + itemindex * 8))
end
end
end
local function onkeypressex(sender, key, x)
local a = tonumber(sender.Text, 16)
local itemindex = UDF1.CEListBox1.ItemIndex
if (a~=nil) and key=="\r" and itemindex~=-1 then
writeSmallInteger(baseaddr+0x5BC6CA + x*2 + itemindex * 8, a)
end
return key
end
UDF1.CEListBox1.OnClick = ListBoxClick
for x = 0, 2 do
EditControls[x].OnKeyPress = function(sender, key) return onkeypressex(sender, key, x) end
end
|
_________________
|
|
| Back to top |
|
 |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Sat Dec 14, 2019 2:20 pm Post subject: |
|
|
| Thanks for the tips.
|
|
| Back to top |
|
 |
|
|
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
|
|