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 


Partial list of "old" codes to "new" one

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
bknight2602
Master Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 359

PostPosted: Wed Apr 12, 2017 10:04 am    Post subject: Partial list of "old" codes to "new" one Reply with quote

To help me in the newer programming procedures let me post my common usages.
al = getAddresslist()
x as identifier
addresslist_getMemoryRecord(al, x)--al.getMemoryRecord(x)--??
addresslist_getMemoryRecordByDescription(al, "text")--?
memoryrecord_getDescription(addresslist_getMemoryRecord(al, x))--??
memoryrecord_getAddress(addresslist_getMemoryRecord(al, x))--??
memoryrecord_setAddress(addresslist_getMemoryRecord(al, x), 0xhexvalue)--?
memoryrecord_getValue(addresslist_getMemoryRecord(al, x))--??
memoryrecord_getValue(addresslist_getMemoryRecordByDescription(al, "text"))--?
memoryrecord_setValue(addresslist_getMemoryRecord(al, x), n)--??

ms = createMemScan()
for x = 0, foundlist_getCount(fl)-1-->ms.Count--?
mr = foundlist_getAddress(fl, x)--??


lv = createListview()
trainer.listview_colum1 = trainer.listview.getColumns().add()--lv.Add, Column1
trainer.listview_colum1.Width = n--lv.Colum1.Width = n--?

rg = createRadioGroup()
trainer.rg.Height = n--etc.
for chacater_ in pairs(trainer.Data.Characters) do
trainer.rg.Add--?
trainer.rg.getItems().add(_);


The lines in red are what I believe to be correct.
please fill in the gaps, change what I have to correct lines where applicable.
Back to top
View user's profile Send private message Yahoo Messenger
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 49

Joined: 06 Jul 2014
Posts: 1693
Location: Arcadian Suburbia

PostPosted: Wed Apr 12, 2017 10:34 am    Post subject: Reply with quote

There's a file in the main CE directory called "main.lua". It contains most of the functions, properties, and methods associated with most classes. For example:
Code:
Addresslist Class: (Inheritance: Panel->WinControl->Control->Component->Object)
properties
  Count: Integer - The number of records in the table
  SelCount: integer- The number of records that are selected
  SelectedRecord: MemoryRecord - The main selected record
  MemoryRecord[]: MemoryRecord - Array to access the individial memory records
  [] = MemoryRecord - Default accessor

methods
  getCount()
  getMemoryRecord(index)
  getMemoryRecordByDescription(description): returns a MemoryRecord object
  getMemoryRecordByID(ID)
  createMemoryRecord() : creates an generic cheat table entry and add it to the list

  getSelectedRecords():  Returns a table containing all the selected records

  doDescriptionChange() : Will show the GUI window to change the description of the selected entry
  doAddressChange() : Will show the GUI window to change the address of the selected entry
  doTypeChange() : Will show the GUI window to change the type of the selected entries
  doValueChange() : Will show the GUI window to change the value of the selected entries

  getSelectedRecord() : Gets the main selected memoryrecord
  setSelectedRecord(memrec) : Sets the currently selected memoryrecord. This will unselect all other entries

All the properties and methods of the class are indices in the userdata object and are meant to be accessed as such.

In the above section of main.lua, "Count" is listed as a property under the address list class. If you have an address list userdata object (e.g. via getAddressList() function), you can access the "Count" property by indexing the userdata object:
Code:
local al = getAddressList()
local count = al.Count   -- shortcut for al['Count']

Methods can be called in the same manner. Extending this illustration to the other classes (e.g. MemScan, Listview, RadioGroup) should be trivial.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
FreeER
Expert Cheater
Reputation: 6

Joined: 09 Aug 2013
Posts: 149

PostPosted: Wed Apr 12, 2017 10:55 am    Post subject: Reply with quote

Red's a bit hard on my eyes, you might choose a different color if you want other people to use this as a reference...

Considering this information from the main.lua file included with CE (copy-paste of some relevant info) https://pastebin.com/VPbngQfu

dark red is unknown

al = getAddresslist()
mr = addresslist_getMemoryRecord(al, x) : mr = al.getMemoryRecord(x)
mr = addresslist_getMemoryRecordByDescription(al, "text") : mr = al.getMemoryRecordByDescription("text")
mr = addresslist_getMemoryRecordById(al, id) : mr = al.getMemoryRecordById(id) -- assuming this existed in old style too

memoryrecord_getDescription(mr) : mr.Description or mr.getDescription() -- not sure if there's a real difference
memoryrecord_getAddress(mr) : mr.Address or mr.getAddress() -- function mentions a second result so diff?
memoryrecord_setAddress(mr, 0xhexvalue) : mr.Address = "0xhexvalue" or mr.setAddress("0xhexvalue") -- note is a string, makes it a pointer if offsets are provided
memoryrecord_getValue(mr) : mr.Value
memoryrecord_setValue(mr, n) : mr.Value = "n" -- note as a string

ms = createMemScan()
fl = createFoundList(ms)
foundlist_initialize(fl) : fl.initialize()
for x = 0, foundlist_getCount(fl)-1 : for x = 0, fl.fl.Count-1 or for x = 0, fl.getCount()-1
mr = foundlist_getAddress(fl, x) : mr = fl.Address[x] or mr = fl.getAddress(x) -- as a string
val = foundlist_getValue(fl, x) : mr = fl.Value[x] or mr = fl.getValue(x) -- as a string


lv = createListview()
trainer.listview_colum1 = trainer.listview.getColumns().add()--lv.Add, Column1 : ?? not sure, haven't used these before
trainer.listview_colum1.Width = n--lv.Colum1.Width = n : ??


rg = createRadioGroup()
trainer.rg.Height = n
for chacater_ in pairs(trainer.Data.Characters) do : probably the same?
trainer.rg.Add : ??

trainer.rg.getItems().add(_) : trainer.rg.Items.add(_) or trainer.rg.getItems().add(_) -- Items is a Strings derived object
Back to top
View user's profile Send private message
bknight2602
Master Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 359

PostPosted: Wed Apr 12, 2017 11:49 am    Post subject: Reply with quote

FreeER wrote:
...
Considering this information from the main.lua file included with CE (copy-paste of some relevant info) https://pastebin.com/VPbngQfu

...


Those diagrams/charts don't connects with me as they don't five a specific example to each.
Thanks for the time.
Back to top
View user's profile Send private message Yahoo 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
Page 1 of 1

 
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