View previous topic :: View next topic |
Author |
Message |
squerol Advanced Cheater Reputation: 2
Joined: 06 Jul 2015 Posts: 65 Location: Poland
|
Posted: Wed May 17, 2017 9:01 am Post subject: "getMemoryRecordByDescription" for multiple target |
|
|
Hello. I have a small question about lua...
Is it possible to make "getMemoryRecordByDescription()" for more than one target at same time? I want to it work like that - I have, for example, 1000 adresses with same name (description) and I want just to set same value for those 1000 adresses.
When I try, for example that lua in cheat table with many adresses with test1 description (name)
Code: |
<LuaScript>
mr1 = getAddressList().getMemoryRecordByDescription("test1")
mr1.Active = true
mr1.Value = 15
</LuaScript>
|
The only target which will be freezed and changed value is just the first one. Every other target with same description is just ignored.
The situation is like that - I'm modding a game with Cheat Engine.
I'm changing stuff like enemies parameters, animations timing etc.
I've set tons of pointers - for example, unit parameters... There are near 800 monsters/npc in total, per every npc/monster I've set 5 pointers (action delay, turn speed, run speed, hear range, sight angle) so we have 4000 pointers here... There are more than 1000 pointers for animations start/end/action points too... So it's massive amount...
There are many duplicates of same NPC or monster, just a different variation (for example just with different appearance). For most of NPCs I want to change some parameters to same value too.
So, if the getMemoryRecordByDescription() could work for multiple targets It could save a looooooooooot of work time.
Setting hotkeys via Cheat Engine GUI is not a method here - I can set hotkey only for 1 target at same time, so for that amount of pointers... No...
I'm thinking about changing multiple pointers names to the same name at same time (It's possible) and then change their value via lua script, when the table is launched. But need to make getMemoryRecordByDescription() to work on multiple targets
Hope it is possible or maybe there is some different method? Thank You.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed May 17, 2017 9:42 am Post subject: |
|
|
Code: |
local al=getAddressList()
local i
for i=0, al.Count-1 do
if al[i].Description='test' then
begin
al[i].Active=true
al[i].Value=15
end
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 |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Wed May 17, 2017 10:47 am Post subject: |
|
|
Another somewhat-obvious solution is that you could append a number to the description and use a loop eg
Code: | local al = getAddressList()
local name = "Description used by all: "
local numpointers = 100 -- number of pointers with the name
for i = 1, numpointers do -- assumes first is "...: 1"
mr = al.getMemoryRecordByDescription(name .. i)
mr.Active = true
mr.Value = 15
end |
|
|
Back to top |
|
|
squerol Advanced Cheater Reputation: 2
Joined: 06 Jul 2015 Posts: 65 Location: Poland
|
Posted: Wed May 17, 2017 11:39 am Post subject: |
|
|
Thank You Dark Byte and FreeER for suggestions. But no success with them for me. Dunno, maybe I'm doing something wrong?
Posting screens.
Dark Byte wrote: | Code: |
local al=getAddressList()
local i
for i=0, al.Count-1 do
if al[i].Description='test' then
begin
al[i].Active=true
al[i].Value=15
end
end
|
|
FreeER wrote: | Another somewhat-obvious solution is that you could append a number to the description and use a loop eg
Code: | local al = getAddressList()
local name = "Description used by all: "
local numpointers = 100 -- number of pointers with the name
for i = 1, numpointers do -- assumes first is "...: 1"
mr = al.getMemoryRecordByDescription(name .. i)
mr.Active = true
mr.Value = 15
end |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed May 17, 2017 2:38 pm Post subject: |
|
|
there are (at least) 2 mistakes in my script. see if you can fix it. (it may teach some lua)
hint: don't begin at the begin
and
equal is not the same as assign
_________________
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 |
|
|
squerol Advanced Cheater Reputation: 2
Joined: 06 Jul 2015 Posts: 65 Location: Poland
|
Posted: Thu May 18, 2017 9:17 am Post subject: |
|
|
Dark Byte wrote: | there are (at least) 2 mistakes in my script. see if you can fix it. (it may teach some lua)
hint: don't begin at the begin
and
equal is not the same as assign |
Ohhhhh, nice trick Dark Byte
Thanks for hints anyway, it's fixed now I think:
Code: |
local al=getAddressList()
local i
for i=0, al.Count-1 do
if al[i].Description=='test' then
al[i].Active=true
al[i].Value=15
end
end |
Thank You very much for script, You've saved me shitload of time
Your script even find targets hidden deep in multiple groups, nice.
About learning lua - I don't even want to be honest. When I try to recall my IT highschool and "very basics of basics" of c++, javascript, php, html and mysql and that I couldn't pass that school without cheating every test, I think it's hopeless even to try it
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Thu May 18, 2017 10:45 am Post subject: |
|
|
Glad you got DB's working, as for mine it depends on having a setup like this:
Notice that the records are named "Test 1", "Test 2", etc. and that the name that the number is appended to includes a space at the end and has the same case. Also that the address list starts at "Test 1" and ends at "Test 6" and the for loop starts with i = 1 and numpointers is 6 (not 100 because there aren't 100 records to change).
A simple fix for the error you saw is to nest the code that changes the memory record in an if statement that checks if mr is "true" eg.
Code: |
for i = 1, numpointers do
mr = al.getMemoryRecordByDescription(name .. i)
if mr then -- only if the memory record actually exists
mr.Active = true
mr.Value = 15
end
end |
So it won't cause an error by trying to do something to a script that doesn't exist. But that won't make the script work if it's not setup correctly and it's unnecessary if it is setup correctly (it just "hides" the error).
As for learning lua, if you can at least kind of understand how/why these two scripts work then you can learn lua, if you want to.
|
|
Back to top |
|
|
squerol Advanced Cheater Reputation: 2
Joined: 06 Jul 2015 Posts: 65 Location: Poland
|
Posted: Sat May 20, 2017 3:41 am Post subject: |
|
|
Thank You
|
|
Back to top |
|
|
|