Lua:Class:Addresslist
Jump to navigation
Jump to search
{} Class
class Addresslist : Panel
The Addresslist class represents Cheat Engine's main cheat table address list.
It contains MemoryRecord entries and provides methods for selecting, creating, finding, editing, activating, and disabling records.
Contents
- 1 Inheritance
- 2 Properties
- 3 Events
- 4 Methods
- 5 Examples
- 5.1 Get the Addresslist object
- 5.2 Use the global AddressList variable
- 5.3 Create a new MemoryRecord
- 5.4 Iterate through all records
- 5.5 Access a record with getMemoryRecord
- 5.6 Find a record by description
- 5.7 Find a record by ID
- 5.8 Get the selected record
- 5.9 Use the SelectedRecord property
- 5.10 Set the selected record
- 5.11 Get all selected records
- 5.12 Show the description change dialog
- 5.13 Show the address change dialog
- 5.14 Show the type change dialog
- 5.15 Show the value change dialog
- 5.16 Disable all records without executing [Disable] sections
- 5.17 Rebuild the description cache
- 5.18 Get the mouse-highlighted record
- 5.19 Change address list colors
- 5.20 Handle description changes
- 5.21 Handle address changes
- 5.22 Handle value changes manually
- 5.23 Handle Auto Assembler script edits
- 5.24 Create multiple records
- 5.25 Clear and rebuild the table
- 6 See Also
Inheritance[edit]
| Class | Inherits From | Description |
|---|---|---|
| Addresslist | Panel | The main cheat table address list control. |
| Panel | WinControl | Base class for panel controls. |
| WinControl | Control | Base class for windowed controls. |
| Control | Component | Base class for visual controls. |
| Component | Object | Base class for components. |
Properties[edit]
| Property | Type | Description |
|---|---|---|
| LoadedTableVersion | Integer | Returns the table version of the last loaded table. |
| Count | Integer | The number of records in the address list. |
| SelCount | Integer | The number of selected records. |
| SelectedRecord | MemoryRecord | The main selected memory record. |
| MemoryRecord[] | MemoryRecord | Array-style accessor for individual memory records. |
| [] | MemoryRecord | Default accessor for individual memory records. |
| CheckboxActiveSelectedColor | Color | The checkbox color used for records that are both active and selected. |
| CheckboxActiveColor | Color | The checkbox color used for active records. |
| CheckboxSelectedColor | Color | The checkbox color used for selected records. |
| CheckboxColor | Color | The normal checkbox color. |
| SelectedBackgroundColor | Color | The primary background color used for selected records. |
| SelectedSecondaryBackgroundColor | Color | The secondary background color used for selected records. |
| ExpandSignColor | Color | The color of the expand/collapse sign. |
| IncreaseArrowColor | Color | The color of the increase arrow. |
| DecreaseArrowColor | Color | The color of the decrease arrow. |
Events[edit]
| Event | Callback | Description |
|---|---|---|
| OnDescriptionChange | function(addresslist, memrec): boolean | Called when the user initiates a description column change on a record. Return true if you handle it, false for normal behavior. |
| OnAddressChange | function(addresslist, memrec): boolean | Called when the user initiates an address column change on a record. Return true if you handle it, false for normal behavior. |
| OnTypeChange | function(addresslist, memrec): boolean | Called when the user initiates a type column change on a record. Return true if you handle it, false for normal behavior. |
| OnValueChange | function(addresslist, memrec): boolean | Called when the user initiates a value column change on a record. Return true if you handle it, false for normal behavior. |
| OnAutoAssemblerEdit | function(addresslist, memrec) | Called when the user initiates a MemoryRecord Auto Assembler script edit. The callback is responsible for changing the memory record. |
Methods[edit]
| Method | Return Type | Description |
|---|---|---|
| getCount() | Integer | Returns the number of records in the address list. |
| getMemoryRecord(index) | MemoryRecord | Returns the memory record at the given index. |
| getMemoryRecordByDescription(description) | MemoryRecord | Returns the first memory record with the given description. |
| getMemoryRecordByID(ID) | MemoryRecord | Returns the memory record with the given ID. |
| createMemoryRecord() | MemoryRecord | Creates a generic cheat table entry and adds it to the address list. |
| getSelectedRecords() | Table | Returns a table containing all selected records. |
| doDescriptionChange() | void | Shows the GUI window to change the description of the selected entry. |
| doAddressChange() | void | Shows the GUI window to change the address of the selected entry. |
| doTypeChange() | void | Shows the GUI window to change the type of the selected entries. |
| doValueChange() | void | Shows the GUI window to change the value of the selected entries. |
| getSelectedRecord() | MemoryRecord | Gets the main selected memory record. |
| setSelectedRecord(memrec) | void | Sets the currently selected memory record. This unselects all other entries. |
| disableAllWithoutExecute() | void | Disables all memory records without executing their [Disable] sections. |
| rebuildDescriptionCache() | void | Rebuilds the description-to-record lookup table. |
| MouseHighlightedRecord() | MemoryRecord | Returns the memory record the mouse points at, or nil if nothing is highlighted. |
Examples[edit]
Get the Addresslist object[edit]
1 local addresslist = getAddressList()
2
3 print("Records: " .. tostring(addresslist.Count))
Use the global AddressList variable[edit]
1 local addresslist1 = getAddressList()
2 local addresslist2 = AddressList
3
4 print(addresslist1 == addresslist2)
Create a new MemoryRecord[edit]
1 local addresslist = getAddressList()
2 local record = addresslist.createMemoryRecord()
3
4 record.Description = "Player Health"
5 record.Address = "game.exe+12345"
6 record.Type = vtDword
7 record.Value = "1000"
Iterate through all records[edit]
1 local addresslist = getAddressList()
2
3 for i = 0, addresslist.Count - 1 do
4 local record = addresslist[i]
5
6 print(i .. ": " .. record.Description)
7 end
Access a record with getMemoryRecord[edit]
1 local addresslist = getAddressList()
2
3 if addresslist.Count > 0 then
4 local record = addresslist.getMemoryRecord(0)
5
6 print(record.Description)
7 end
Find a record by description[edit]
1 local addresslist = getAddressList()
2 local record = addresslist.getMemoryRecordByDescription("Player Health")
3
4 if record ~= nil then
5 print("Found: " .. record.Description)
6 end
Find a record by ID[edit]
1 local addresslist = getAddressList()
2 local record = addresslist.getMemoryRecordByID(10)
3
4 if record ~= nil then
5 print("Found ID 10: " .. record.Description)
6 end
Get the selected record[edit]
1 local addresslist = getAddressList()
2 local record = addresslist.getSelectedRecord()
3
4 if record ~= nil then
5 print("Selected: " .. record.Description)
6 end
Use the SelectedRecord property[edit]
1 local addresslist = getAddressList()
2
3 if addresslist.SelCount > 0 then
4 local record = addresslist.SelectedRecord
5
6 print("Selected: " .. record.Description)
7 end
Set the selected record[edit]
1 local addresslist = getAddressList()
2 local record = addresslist.getMemoryRecordByDescription("Player Health")
3
4 if record ~= nil then
5 addresslist.setSelectedRecord(record)
6 end
Get all selected records[edit]
1 local addresslist = getAddressList()
2 local selectedRecords = addresslist.getSelectedRecords()
3
4 for i, record in ipairs(selectedRecords) do
5 print(i .. ": " .. record.Description)
6 end
Show the description change dialog[edit]
1 local addresslist = getAddressList()
2
3 if addresslist.SelCount > 0 then
4 addresslist.doDescriptionChange()
5 end
Show the address change dialog[edit]
1 local addresslist = getAddressList()
2
3 if addresslist.SelCount > 0 then
4 addresslist.doAddressChange()
5 end
Show the type change dialog[edit]
1 local addresslist = getAddressList()
2
3 if addresslist.SelCount > 0 then
4 addresslist.doTypeChange()
5 end
Show the value change dialog[edit]
1 local addresslist = getAddressList()
2
3 if addresslist.SelCount > 0 then
4 addresslist.doValueChange()
5 end
Disable all records without executing [Disable] sections[edit]
1 local addresslist = getAddressList()
2
3 addresslist.disableAllWithoutExecute()
Rebuild the description cache[edit]
1 local addresslist = getAddressList()
2
3 addresslist.rebuildDescriptionCache()
Get the mouse-highlighted record[edit]
1 local addresslist = getAddressList()
2 local record = addresslist.MouseHighlightedRecord()
3
4 if record ~= nil then
5 print("Mouse is over: " .. record.Description)
6 end
Change address list colors[edit]
1 local addresslist = getAddressList()
2
3 addresslist.CheckboxActiveColor = 0x00FF00
4 addresslist.CheckboxColor = 0x808080
5 addresslist.SelectedBackgroundColor = 0x202020
6 addresslist.SelectedSecondaryBackgroundColor = 0x303030
7 addresslist.ExpandSignColor = 0xFFFFFF
Handle description changes[edit]
1 local addresslist = getAddressList()
2
3 addresslist.OnDescriptionChange = function(sender, memrec)
4 print("Description change requested for: " .. memrec.Description)
5
6 return false
7 end
Handle address changes[edit]
1 local addresslist = getAddressList()
2
3 addresslist.OnAddressChange = function(sender, memrec)
4 print("Address change requested for: " .. memrec.Description)
5
6 return false
7 end
Handle value changes manually[edit]
1 local addresslist = getAddressList()
2
3 addresslist.OnValueChange = function(sender, memrec)
4 local oldValue = memrec.Value
5
6 memrec.Value = "999"
7
8 print("Changed " .. memrec.Description .. " from " .. oldValue .. " to " .. memrec.Value)
9
10 return true
11 end
Handle Auto Assembler script edits[edit]
1 local addresslist = getAddressList()
2
3 addresslist.OnAutoAssemblerEdit = function(sender, memrec)
4 print("Auto Assembler edit requested for: " .. memrec.Description)
5 end
Create multiple records[edit]
1 local addresslist = getAddressList()
2
3 local values = {
4 { description = "Health", address = "game.exe+1000" },
5 { description = "Ammo", address = "game.exe+2000" },
6 { description = "Score", address = "game.exe+3000" }
7 }
8
9 for i, entry in ipairs(values) do
10 local record = addresslist.createMemoryRecord()
11
12 record.Description = entry.description
13 record.Address = entry.address
14 record.Type = vtDword
15 end
Clear and rebuild the table[edit]
1 local addresslist = getAddressList()
2
3 addresslist.clear()
4
5 local health = addresslist.createMemoryRecord()
6 health.Description = "Health"
7 health.Address = "game.exe+1234"
8 health.Type = vtDword
9
10 local ammo = addresslist.createMemoryRecord()
11 ammo.Description = "Ammo"
12 ammo.Address = "game.exe+5678"
13 ammo.Type = vtDword
See Also[edit]
Main Pages
Form Related Pages
Form Related Functions
Form Related Classes