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 


Code to move table addresses into Group address
Goto page 1, 2  Next
 
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: 586

PostPosted: Sun Mar 06, 2022 10:55 am    Post subject: Code to move table addresses into Group address Reply with quote

What would be a code to move table addresses into a group address?
memfirst.Address = 070F759C
...
memlast.Address = 070F776C
into
Group.Address = ??[/img]
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1521

PostPosted: Sun Mar 06, 2022 1:39 pm    Post subject: Reply with quote

This code continues to supersede the new value without clearing the table.

If you want to empty the table at runtime use it:
Code:
memfirst={}
memlast={}


Code:
Group={}

addr1=[[024CDE20
024D5B78
024DA0F0
06E11CB0
06E12624
06E129EC
06E12DB4]]

addr2=[[06E13360
06E13728
06E13AF0
06E14464
073E73E0
073ED830]]

function insertTblAdd(tbl,list)
n=#tbl
sl=createStringList()
sl.Text=list
for i=0, (sl.Count) - 1 do
n=tonumber(n) + 1
tbl[n]=sl[i]
end
end

memfirst={}
memlast={}

insertTblAdd(memfirst,addr1)
insertTblAdd(memlast,addr2)

table.insert(Group,1,memfirst)
table.insert(Group,2,memlast)

print(1,Group[1][2])
print(2,Group[2][4])

--for i,k in pairs(Group[1]) do
--print(k)
--end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Sun Mar 06, 2022 2:48 pm    Post subject: Reply with quote

Could this be accomplished in a for loop where memrec.Address that are equal to or greater memfirst.Address and less than or equal to memlast.Address?
To my knowledge the addresses are increasing in value.

ETA: There are 6 groups of ~300-350 records into 6 group headers.
Back to top
View user's profile Send private message Yahoo Messenger
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Sun Mar 06, 2022 3:02 pm    Post subject: Reply with quote

It's certainly possible with a loop, yes. You may require several loops to achieve what you want but it's feasible.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1521

PostPosted: Sun Mar 06, 2022 5:50 pm    Post subject: Reply with quote

bknight2602 wrote:
Could this be accomplished in a for loop where memrec.Address that are equal to or greater memfirst.Address and less than or equal to memlast.Address?
To my knowledge the addresses are increasing in value.

ETA: There are 6 groups of ~300-350 records into 6 group headers.


It was a somewhat complex statement. Smile
I don't know if it would be helpful for you to compare them all out of order.
But we can try to compare lists sequentially.

One more note: Comparing addresses will not give very healthy results.
But if you want to compare address values, we can generate additional codes.

Could you explain your statement (question) a little more?

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Mon Mar 07, 2022 11:23 am    Post subject: Reply with quote

AylinCE wrote:
bknight2602 wrote:
Could this be accomplished in a for loop where memrec.Address that are equal to or greater memfirst.Address and less than or equal to memlast.Address?
To my knowledge the addresses are increasing in value.

ETA: There are 6 groups of ~300-350 records into 6 group headers.


It was a somewhat complex statement. Smile
I don't know if it would be helpful for you to compare them all out of order.
But we can try to compare lists sequentially.

One more note: Comparing addresses will not give very healthy results.
But if you want to compare address values, we can generate additional codes.

Could you explain your statement (question) a little more?

Comparing address values seems logical if comparing the addresses themselves is not "healthy"
Um I don't know how to say it better than I have. Let me show an image of CE to demonstrate a small piece of the puzzle, actually I'll sow three images.
The bottom image is of the first few records all of the 1st... should move into the 1st Header.
The middle image is taken at the bottom of 1st beginning of the 2nd all the records should move into the appropriate header. Ill move the "attitudes into an attitude header since there are only a few. The top image is after moving the attitudes, leaving just the 2nd records. Is this a better description?



2022-03-07_11-19-46.png
 Description:
 Filesize:  130.93 KB
 Viewed:  4106 Time(s)

2022-03-07_11-19-46.png



2022-03-07_11-09-55.png
 Description:
 Filesize:  237.49 KB
 Viewed:  4106 Time(s)

2022-03-07_11-09-55.png



2022-03-07_11-08-01.png
 Description:
 Filesize:  225.55 KB
 Viewed:  4106 Time(s)

2022-03-07_11-08-01.png


Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1521

PostPosted: Mon Mar 07, 2022 5:38 pm    Post subject: Reply with quote

A different approach.
Click on Lua Script >> File menu, select "New Tab" and try the below code in new tab.

Code:
Group={}
memfirst={}
memlast={}

function crtList(tbl,start,finish) --List the values in the range selected from the address list into the table
addressList = getAddressList()
addrCnt = addresslist_getCount(addressList)
for i=tonumber(start), addrCnt do
aa=addresslist_getMemoryRecord(addressList,i)
  if i < tonumber(finish) then
   table.insert(tbl, aa.Value)
  end
 end
 --return table.sort(tbl)
end

function tblComp(t1,t2) --Take the larger of the compared value.
aa=""
    if t1 < t2 then
     aa=t2 --print("t2: " .. t2 .. " < " .. t1)
     else
     aa=t1 --print("t1: " .. t1 .. " < " .. t2)
    end
return aa
end

crtList(memfirst,0,9) --Get list "memfirst" from address list
crtList(memlast,10,17) --Get list "memlast" from address list

table.insert(Group,1,memfirst) --Set "memfirst" as Group list 1.
table.insert(Group,2,memlast) --Set "memlast" as Group list 2.

print(1,Group[1][2]) --check
print(2,Group[2][4]) --check

function findTbl(t0,t1,t2) --Collide the tables and load the high value into a new table or whatever you write there.
g1=math.min(#t1,#t2) --If the table lengths are not the same, choosing the least fixes the error.
for i=1, g1 do
 t0[i]=tblComp(t1[i],t2[i])
 end
end


collapse={}
findTbl(collapse,Group[1],Group[2]) --use
--table control

for i,k in pairs(collapse) do
print(k)
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Mar 08, 2022 8:11 am    Post subject: Reply with quote

Stupid question, but where is the lua scrip new tab option? All I am able to find is add a new scan tab.
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1521

PostPosted: Tue Mar 08, 2022 9:50 am    Post subject: Reply with quote

CE Main Menu >> Table >> Show cheat table Lua Script
Lua Script: Cheat Table Main Menu >> File >> New Tab >> click ..

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Tue Mar 08, 2022 4:09 pm    Post subject: Reply with quote

This what I see, the add is for an additional scan tab. I guess I don't understand how code will be executed in a different table. Now if the code were runt in the debug window that sounds like a deal.


2022-03-08_16-04-24.png
 Description:
 Filesize:  250.48 KB
 Viewed:  3985 Time(s)

2022-03-08_16-04-24.png



2022-03-08_16-04-54.png
 Description:
 Filesize:  227.86 KB
 Viewed:  3985 Time(s)

2022-03-08_16-04-54.png


Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1521

PostPosted: Tue Mar 08, 2022 4:45 pm    Post subject: Reply with quote

Yes I forgot 6.7. Smile
The second picture is correct, but I don't remember if there is a "File >> New Tab" feature in Lua Script in 6.7.

If I remember correctly, you had 7.4 installed.
Open the current Trainer code in 7.4 and open the new tab I said and try.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Wed Mar 09, 2022 11:50 am    Post subject: Reply with quote

In 7.4 all I "see" is to add another scan tab, now if you mean to add the attached code into the debug widow, that I can do. I I don't see any new tab other than a scan tab. What am I missing?
I haven't looked at the code, is there a place to input the starting and ending addresses? Or does the program work in between Header's 1st, 2nd etc.?
Back to top
View user's profile Send private message Yahoo Messenger
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Wed Mar 09, 2022 12:02 pm    Post subject: Reply with quote

On the main Cheat Engine window press Ctrl, Alt + L in the new window press Ctrl, Shift + T

Here is the menu AylinCE is talking about:
Back to top
View user's profile Send private message
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 586

PostPosted: Wed Mar 09, 2022 1:05 pm    Post subject: Reply with quote

Strange this is what I have. Where is the script?


2022-03-09_13-04-01.png
 Description:
 Filesize:  84.36 KB
 Viewed:  3900 Time(s)

2022-03-09_13-04-01.png


Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1521

PostPosted: Wed Mar 09, 2022 1:48 pm    Post subject: Reply with quote

Start from your last picture and follow the steps below with the "Table" in the 3rd row:

Code:
Table >> Show Cheat Table Lua Script
Lua Script: Cheat Table Main Menu >> File >> New Tab >> click ..


EDIT:
I asked you to open the side tab with the advice of trying the code below.
Thus, it would be convenient for you to move the useful code to the main tab.

Here is your code:
AylinCE wrote:
A different approach.
Click on Lua Script >> File menu, select "New Tab" and try the below code in new tab.

Code:
Group={}
memfirst={}
memlast={}

function crtList(tbl,start,finish) --List the values in the range selected from the address list into the table
addressList = getAddressList()
addrCnt = addresslist_getCount(addressList)
for i=tonumber(start), addrCnt do
aa=addresslist_getMemoryRecord(addressList,i)
  if i < tonumber(finish) then
   table.insert(tbl, aa.Value)
  end
 end
 --return table.sort(tbl)
end

function tblComp(t1,t2) --Take the larger of the compared value.
aa=""
    if t1 < t2 then
     aa=t2 --print("t2: " .. t2 .. " < " .. t1)
     else
     aa=t1 --print("t1: " .. t1 .. " < " .. t2)
    end
return aa
end

crtList(memfirst,0,9) --Get list "memfirst" from address list
crtList(memlast,10,17) --Get list "memlast" from address list

table.insert(Group,1,memfirst) --Set "memfirst" as Group list 1.
table.insert(Group,2,memlast) --Set "memlast" as Group list 2.

print(1,Group[1][2]) --check
print(2,Group[2][4]) --check

function findTbl(t0,t1,t2) --Collide the tables and load the high value into a new table or whatever you write there.
g1=math.min(#t1,#t2) --If the table lengths are not the same, choosing the least fixes the error.
for i=1, g1 do
 t0[i]=tblComp(t1[i],t2[i])
 end
end


collapse={}
findTbl(collapse,Group[1],Group[2]) --use
--table control

for i,k in pairs(collapse) do
print(k)
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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