|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
juntalis Newbie cheater Reputation: 2
Joined: 13 Mar 2013 Posts: 12
|
Posted: Thu Oct 23, 2014 8:19 pm Post subject: Pre-fill Scan Range |
|
|
Some programs always allocate memory as the same fixed address. (pcsx2, for instance, does so at 20000000) When dealing with those programs a lot, it becomes convenient to pre-fill the scan range with the fixed range.
Code: |
set_scanrange = (function(frmMain)
-- Enclosed in an anonymous function call in order to
-- cache the result of getMainForm while avoiding the
-- need to pollute the script's locals.
local function find(name)
return frmMain.findComponentByName(name)
end
local function dec2hex(nValue, maybe_size)
local size = maybe_size or 0
local fmt = '%'
if type(nValue) == 'string' then nValue = tonumber(nValue) end
if size ~= 0 then fmt = fmt .. '0' .. tostring(size) end
fmt = fmt .. 'X'
return string.format(fmt, nValue)
end
-- Pretty sure we can cache the results of the 'find'
-- calls, but whatever.
return function(fromaddr, toaddr)
local fromctrl = find('FromAddress')
local toctrl = find('ToAddress')
if type(fromaddr) ~= 'string' then
fromaddr = dec2hex(fromaddr)
end
if type(toaddr) ~= 'string' then
toaddr = dec2hex(toaddr)
end
fromctrl.Lines.Text = fromaddr
toctrl.Lines.Text = toaddr
end
end)(getMainForm())
set_scanrange('20000000', '2A000000')
|
Note: This only works once Cheat Engine has attached to a process, so you'll most likely need to add the call to the handler for onOpenProcess.
|
|
Back to top |
|
|
xxhehe Expert Cheater Reputation: 0
Joined: 11 Mar 2015 Posts: 136
|
Posted: Sat Oct 06, 2018 9:41 pm Post subject: Re: Pre-fill Scan Range |
|
|
juntalis wrote: | Some programs always allocate memory as the same fixed address. (pcsx2, for instance, does so at 20000000) When dealing with those programs a lot, it becomes convenient to pre-fill the scan range with the fixed range.
Code: |
set_scanrange = (function(frmMain)
-- Enclosed in an anonymous function call in order to
-- cache the result of getMainForm while avoiding the
-- need to pollute the script's locals.
local function find(name)
return frmMain.findComponentByName(name)
end
local function dec2hex(nValue, maybe_size)
local size = maybe_size or 0
local fmt = '%'
if type(nValue) == 'string' then nValue = tonumber(nValue) end
if size ~= 0 then fmt = fmt .. '0' .. tostring(size) end
fmt = fmt .. 'X'
return string.format(fmt, nValue)
end
-- Pretty sure we can cache the results of the 'find'
-- calls, but whatever.
return function(fromaddr, toaddr)
local fromctrl = find('FromAddress')
local toctrl = find('ToAddress')
if type(fromaddr) ~= 'string' then
fromaddr = dec2hex(fromaddr)
end
if type(toaddr) ~= 'string' then
toaddr = dec2hex(toaddr)
end
fromctrl.Lines.Text = fromaddr
toctrl.Lines.Text = toaddr
end
end)(getMainForm())
set_scanrange('20000000', '2A000000')
|
Note: This only works once Cheat Engine has attached to a process, so you'll most likely need to add the call to the handler for onOpenProcess. |
ce6.8.1
error:[string "
..."]:30: attempt to index a nil value (field 'Lines')
js error
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Sun Oct 07, 2018 2:02 am Post subject: |
|
|
FromAddress and ToAddress are Edit objects, not Memo Objects, so they do not have Line properties
Also, this script can be rewritten to:
Code: |
function set_scanrange(from,to)
MainForm.FromAddress.Text=from
MainForm.ToAddress.Text=to
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
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 cannot download files in this forum
|
|