|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
icsmoke+ Cheater Reputation: 0
Joined: 31 Aug 2020 Posts: 32
|
Posted: Sat Sep 25, 2021 6:01 am Post subject: [Ask] add array from memrec |
|
|
hello there,
i want to ask how to add array from memrec and add some formula on it?
let say my address value is 5 then i want to add formula to array table e.g (5-3,5-2,5-1, 5, 5+1, 5+2, 5+3)
Code: |
al = getAddressList
mr = al.getMemoryRecordByDescription
arrRange = { 'mr('myaddress').getValue()-3','mr('myaddress').getValue()-2',
'mr('myaddress').getValue()-1','mr('myaddress').getValue()',
'mr('myaddress').getValue()+1','mr('myaddress').getValue()+2'
'mr('myaddress').getValue()+3','mr('myaddress').getValue()+100'
'mr('myaddress').getValue()100+1','mr('myaddress').getValue()+100+2' and so on } |
how to write that formula properly?
so i can use that array like below
Code: |
function range()
if tonumber(mr('NPCName1').getValue()) ==npcname and
tonumber(mr('crew1').getValue()) == arrRange then
myfunction()
end
end |
thanks in advance for help[/code]
|
|
Back to top |
|
|
Birdi Expert Cheater Reputation: 0
Joined: 08 Jun 2020 Posts: 122 Location: Migrating
|
Posted: Sat Sep 25, 2021 1:12 pm Post subject: |
|
|
Are you trying to return a range of values based on the found memrec's value, or just look for a value within a range?
Try using less/greater than if you can, anyway.
_________________
Trying to learn!
Add me on Discord if you want hands-on help: Birdi#0007 |
|
Back to top |
|
|
icsmoke+ Cheater Reputation: 0
Joined: 31 Aug 2020 Posts: 32
|
Posted: Sat Sep 25, 2021 5:08 pm Post subject: |
|
|
Yes i am looking for value within range and its a coordinat
|
|
Back to top |
|
|
Birdi Expert Cheater Reputation: 0
Joined: 08 Jun 2020 Posts: 122 Location: Migrating
|
Posted: Sat Sep 25, 2021 7:20 pm Post subject: |
|
|
Code: |
function findMemrecValue(memrec,min,max)
local al = getAddressList()
for i=0,al.Count-1 do
if al[i].Description == memrec then
if tonumber(al[i].Value) > min and tonumber(al[i].Value) < max then
print(al[i].Value)
end
end
end
end
findMemrecValue("My Memrec",10,30)
|
If you want it to scan between multiple ranges (10~30 & 35~40 not 31~34) you can just set additional parameters:
Code: |
function findMemrecValue(memrec,ranges)
local al = getAddressList()
for i=0,al.Count-1 do
local t = al[i]
if t.Description == memrec then
if #ranges % 2 == 0 then
for o=1,#ranges do
if o % 2 == 1 then
if tonumber(t.Value) ~= nil and tonumber(t.Value) > ranges[o] and tonumber(t.Value) < ranges[o+1] then
print(t.Value)
end
end
end
else
print("Uneven amount of integers to compare.")
end
end
end
end
findMemrecValue("My Memrec",{10,30,50,70,90,110})
--looks for values 10~30, 50~70, 90~110
|
If you want this run often, use a timer:
Code: |
function doIt()
findMemrecValue("My Memrec",{10,30,50,70,90,110})
end
if checkTimer then
checkTimer.Enabled = false
checkTimer.Destroy()
checkTimer = nil
checkTimer = createTimer(MainForm, false)
checkTimer.Interval = 1000
checkTimer.OnTimer = doIt
checkTimer.Enabled = true
else
checkTimer = createTimer(MainForm, false)
checkTimer.Interval = 1000
checkTimer.OnTimer = doIt
checkTimer.Enabled = true
end
|
_________________
Trying to learn!
Add me on Discord if you want hands-on help: Birdi#0007 |
|
Back to top |
|
|
icsmoke+ Cheater Reputation: 0
Joined: 31 Aug 2020 Posts: 32
|
Posted: Sun Sep 26, 2021 12:59 am Post subject: |
|
|
Veri nice, thanks man...that answer kills the question
|
|
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
|
|