Difference between revisions of "Lua:Class:MemoryRecord"

From Cheat Engine
Jump to navigation Jump to search
m (added a simple description...)
Line 2: Line 2:
  
 
The class MemoryRecord are the entries in Cheat tables. This class is commonly used with [[Addresslist]].
 
The class MemoryRecord are the entries in Cheat tables. This class is commonly used with [[Addresslist]].
 +
 +
 +
'''MemoryRecord Class'''
 +
  The Memoryrecord class object describes a Cheat Table's Cheat Entry.
 +
  
 
----
 
----
  
  
'''MemoryRecord Class'''
+
== Properties ==
  The Memoryrecord class object describes a Cheat Table's Cheat Entry.
+
 
 +
== Methods ==
  
  
'''memoryrecord_getID'''(memoryrecord)
+
'''getID'''()
 
   Returns the unique id of this memory record. Every memory record has an unique id
 
   Returns the unique id of this memory record. Every memory record has an unique id
  
  
'''memoryrecord_getHotkeyCount'''(memoryrecord)
+
'''getHotkeyCount'''()
 
   Returns the number of hotkeys assigned to this Cheat Entry
 
   Returns the number of hotkeys assigned to this Cheat Entry
  
  
'''memoryrecord_getHotkey'''(memoryrecord, index)
+
'''getHotkey'''(index)
 
   Returns a memoryrecordhotkey class
 
   Returns a memoryrecordhotkey class
  
  
'''memoryrecord_getHotkeyByID'''(memoryrecord, ID)  
+
'''getHotkeyByID'''(ID)  
 
   Every hotkey in a memoryrecord gets an unique ID. This way you can always find the hotkey even if the order of hotkeys has changed (or deleted)
 
   Every hotkey in a memoryrecord gets an unique ID. This way you can always find the hotkey even if the order of hotkeys has changed (or deleted)
  
  
'''memoryrecord_setDescription'''(memoryrecord, description)  
+
'''setDescription'''(description)  
 
   Sets the specified description for this entry
 
   Sets the specified description for this entry
  
  
'''memoryrecord_getDescription'''(memoryrecord)  
+
'''getDescription'''()  
 
   Gets the current description of this entry
 
   Gets the current description of this entry
  
  
'''memoryrecord_getAddress'''(memoryrecord)  
+
'''getAddress'''()  
 
   Returns the address and optional offsets for a pointer (note that in 64-bit kernelmode addresses will be rounded down...)
 
   Returns the address and optional offsets for a pointer (note that in 64-bit kernelmode addresses will be rounded down...)
  
  
'''memoryrecord_setAddress'''(memoryrecord,address,offsets OPTIONAL)   
+
'''setAddress'''(address,offsets OPTIONAL)   
 
   Sets the address of a entry. You can give as many offsets as you need
 
   Sets the address of a entry. You can give as many offsets as you need
  
  
'''memoryrecord_getType'''(memoryrecord)   
+
'''getType'''()   
 
   Returns the Variable type. (vtByte to vtCustom)
 
   Returns the Variable type. (vtByte to vtCustom)
  
  
'''memoryrecord_setType'''(memoryrecord, vartype)   
+
'''setType'''(vartype)   
 
   Sets the type of the entry
 
   Sets the type of the entry
  
  
'''memoryrecord_getValue'''(memoryrecord)  
+
'''getValue'''()  
 
   Returns the current value of the cheat table entry as a string
 
   Returns the current value of the cheat table entry as a string
  
  
'''memoryrecord_setValue'''(memoryrecord, value)  
+
'''setValue'''(value)  
 
   Sets the value of a cheat table entry
 
   Sets the value of a cheat table entry
  
  
'''memoryrecord_getScript'''(memoryrecord)   
+
'''getScript'''()   
 
   If the entry is of type vtAutoAssembler then you can get the script with this routine
 
   If the entry is of type vtAutoAssembler then you can get the script with this routine
  
  
'''memoryrecord_setScript'''(memoryrecord, script)
+
'''setScript'''(script)
  
  
'''memoryrecord_isActive'''(memoryrecord)
+
'''isActive'''()
  
  
'''memoryrecord_freeze'''(memoryrecord, updownfreeze OPTIONAL)
+
'''freeze'''(updownfreeze OPTIONAL)
 
   Sets the entry to frozen state. updownfreeze is optional. 0=freeze, 1=allow increase, 2=allow decrease
 
   Sets the entry to frozen state. updownfreeze is optional. 0=freeze, 1=allow increase, 2=allow decrease
  
  
'''memoryrecord_unfreeze'''(memoryrecord)  
+
'''unfreeze'''()  
 
   Unfreezes an entry
 
   Unfreezes an entry
  
  
'''memoryrecord_setColor'''(memoryrecord, colorrgb)  
+
'''setColor'''(colorrgb)  
 
   Sets the color of the entry
 
   Sets the color of the entry
  
  
'''memoryrecord_appendToEntry'''(memoryrecord,memoryrecord)   
+
'''appendToEntry'''(memoryrecord)   
 
   Adds the entry to another entry
 
   Adds the entry to another entry
  
  
'''memoryrecord_delete'''(memoryrecord)  
+
'''delete'''()  
 
   It's unknown what this function does, all that is known is that after using this command other memrec routines with this table entry value don't work anymore...
 
   It's unknown what this function does, all that is known is that after using this command other memrec routines with this table entry value don't work anymore...
  
  
'''memoryrecord_onActivate'''(memoryrecord, function)  
+
'''onActivate'''(, function)  
 
   Registers a function to be called when a cheat entry is Activated
 
   Registers a function to be called when a cheat entry is Activated
 
     function (memoryrecord, before, currentstate) boolean
 
     function (memoryrecord, before, currentstate) boolean
Line 94: Line 100:
  
  
'''memoryrecord_onDeactivate'''(memoryrecord, function)
+
'''onDeactivate'''(function)
 
   Registers a function to be called when a cheat entry is Deactivated
 
   Registers a function to be called when a cheat entry is Deactivated
 
     function (memoryrecord, before, currentstate) boolean
 
     function (memoryrecord, before, currentstate) boolean
Line 100: Line 106:
  
  
'''memoryrecord_onDestroy'''(memoryrecord, function)  
+
'''onDestroy'''(function)  
 
   Registers a function to be called when a cheat entry is delete
 
   Registers a function to be called when a cheat entry is delete
 
     function (memoryrecord)
 
     function (memoryrecord)
Line 108: Line 114:
 
Example:
 
Example:
 
<pre>
 
<pre>
addresslist = getAddressList()
+
al = getAddressList()
 
description1= [[Health]]
 
description1= [[Health]]
 
description2= [[Health Pointer]]
 
description2= [[Health Pointer]]
memoryrec1 = addresslist_getMemoryRecordByDescription(addresslist, description1)
+
memoryrec1 = al.getMemoryRecordByDescription(description1)
memoryrec2 = addresslist_getMemoryRecordByDescription(addresslist, description2)
+
memoryrec2 = al.getMemoryRecordByDescription(description2)
  
desc = memoryrecord_getDescription(memoryrec1)   --Gets the current memroyrecord's description
+
desc = memoryrec1.Description   --Gets the current memoryrecord's description
 
print(desc)
 
print(desc)
  
memoryrecord_setDescription(memoryrec1, [[My new health description]]) --sets the memorydescription
+
memoryrec1.Description=[[My new health description]]  --sets the memorydescription
  
  
value = memoryrecord_getValue(memoryrec2)    --Gets the current value of the memory record.
+
value = memoryrec2.Value  --Gets the current value of the memory record.
 
print(value)
 
print(value)
  
 
newvalue = 66
 
newvalue = 66
memoryrecord_setValue(memoryrec2, newvalue)   --sets value for the memoryrecord
+
memoryrec2.Value=newvalue  --sets value for the memoryrecord
  
if memoryrecord_isActive(memoryrecord) then  --Checks if memoryrecord is in frozen state or not
+
if memoryrecord.Active then  --Checks if memoryrecord is in frozen state or not
 
else
 
else
memoryrecord_freeze(memoryrec2) -- freezes the memoryrecord, to unfreeze use memoryrecord_freeze
+
memoryrec2.Active=false -- freezes the memoryrecord, to unfreeze use memoryrecord_freeze
 
end
 
end
  
memoryrecord_setColor(memoryrec2,0x0000FF)  --Sets the color of the memoryrecord. Here Red. Color range {0x000000 to 0xFFFFFF)
+
memoryrec2.Color=0x0000ff --Sets the color of the memoryrecord. Here Red. Color range {0x000000 to 0xFFFFFF)
  
count = memoryrecord_getHotkeyCount(memoryrec2--Gets number of hotkeys associated with memoryrecord
+
count = memoryrec2.HotkeyCount --Gets number of hotkeys associated with memoryrecord
 
print(count)                                    --From the image, We can see it is 2.     
 
print(count)                                    --From the image, We can see it is 2.     
 
</pre>[[Image:Image.png|frame|CheatEngine Encyclopedia]]
 
</pre>[[Image:Image.png|frame|CheatEngine Encyclopedia]]
 
[[Image:Hotkey.png|frame|CheatEngine Encyclopedia]]
 
[[Image:Hotkey.png|frame|CheatEngine Encyclopedia]]
 +
 +
----
 +
 +
* [[Lua|Lua Functions and Classes]]

Revision as of 23:56, 17 January 2017

--Under Construction

The class MemoryRecord are the entries in Cheat tables. This class is commonly used with Addresslist.


MemoryRecord Class

 The Memoryrecord class object describes a Cheat Table's Cheat Entry.




Properties

Methods

getID()

 Returns the unique id of this memory record. Every memory record has an unique id


getHotkeyCount()

 Returns the number of hotkeys assigned to this Cheat Entry


getHotkey(index)

 Returns a memoryrecordhotkey class


getHotkeyByID(ID)

 Every hotkey in a memoryrecord gets an unique ID. This way you can always find the hotkey even if the order of hotkeys has changed (or deleted)


setDescription(description)

 Sets the specified description for this entry


getDescription()

 Gets the current description of this entry


getAddress()

 Returns the address and optional offsets for a pointer (note that in 64-bit kernelmode addresses will be rounded down...)


setAddress(address,offsets OPTIONAL)

 Sets the address of a entry. You can give as many offsets as you need


getType()

 Returns the Variable type. (vtByte to vtCustom)


setType(vartype)

 Sets the type of the entry


getValue()

 Returns the current value of the cheat table entry as a string


setValue(value)

 Sets the value of a cheat table entry


getScript()

 If the entry is of type vtAutoAssembler then you can get the script with this routine


setScript(script)


isActive()


freeze(updownfreeze OPTIONAL)

 Sets the entry to frozen state. updownfreeze is optional. 0=freeze, 1=allow increase, 2=allow decrease


unfreeze()

 Unfreezes an entry


setColor(colorrgb)

 Sets the color of the entry


appendToEntry(memoryrecord)

 Adds the entry to another entry


delete()

 It's unknown what this function does, all that is known is that after using this command other memrec routines with this table entry value don't work anymore...


onActivate(, function)

 Registers a function to be called when a cheat entry is Activated
   function (memoryrecord, before, currentstate) boolean
   If before is true returning false will cause the activation to stop


onDeactivate(function)

 Registers a function to be called when a cheat entry is Deactivated
   function (memoryrecord, before, currentstate) boolean
   If before is true returning false will cause the deactivation to stop


onDestroy(function)

 Registers a function to be called when a cheat entry is delete
   function (memoryrecord)


Example:

al = getAddressList()
description1= [[Health]]
description2= [[Health Pointer]]
memoryrec1 = al.getMemoryRecordByDescription(description1)
memoryrec2 = al.getMemoryRecordByDescription(description2)

desc = memoryrec1.Description    --Gets the current memoryrecord's description
print(desc)

memoryrec1.Description=[[My new health description]]  --sets the memorydescription


value = memoryrec2.Value  --Gets the current value of the memory record.
print(value)

newvalue = 66
memoryrec2.Value=newvalue   --sets value for the memoryrecord

if memoryrecord.Active then   --Checks if memoryrecord is in frozen state or not
else
memoryrec2.Active=false  -- freezes the memoryrecord, to unfreeze use memoryrecord_freeze
end

memoryrec2.Color=0x0000ff --Sets the color of the memoryrecord. Here Red. Color range {0x000000 to 0xFFFFFF)

count = memoryrec2.HotkeyCount --Gets number of hotkeys associated with memoryrecord
print(count)                                     --From the image, We can see it is 2.     
File:Image.png
CheatEngine Encyclopedia
File:Hotkey.png
CheatEngine Encyclopedia