View previous topic :: View next topic |
Author |
Message |
dl748 Advanced Cheater Reputation: 0
Joined: 05 Mar 2016 Posts: 75
|
Posted: Sat Jan 20, 2018 7:06 pm Post subject: MemoryRecord Custom Type |
|
|
I can't seem to find a way to set a Memory Record to a specific custom type.
Code: |
MemoryRecord.setCustomTypeName("My Custom Type") -- doesn't exist
MemoryRecord.CustomTypeName = "My Custom Type" -- doesn't work
MemoryRecord.VarType = "My Custom Type" -- seems to change to the default vtDword, doesn't seem to look for custom types.
|
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat Jan 20, 2018 7:31 pm Post subject: |
|
|
You have to set "Type" to "vtCustomType" to use custom types, then set "CustomTypeName".
Quote: |
CustomTypeName: String - If the type is vtCustomType this will contain the name of the CustomType |
_________________
|
|
Back to top |
|
|
dl748 Advanced Cheater Reputation: 0
Joined: 05 Mar 2016 Posts: 75
|
Posted: Sat Jan 20, 2018 8:35 pm Post subject: |
|
|
tried that, vtCustomType doesn't work, defaults to vtDword.
According to this. There is no vtCustomType type. There is a vtCustom, but setting CustomTypeName does nothing to the entry.
vtCustom just creates a blank line (i use this a lot to keep a uneditable pointer, to set child memory record to offsets.
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat Jan 20, 2018 8:44 pm Post subject: |
|
|
Yeah, just pulled that from the "celau.txt" file, but you are right, in "defines.lua" there is only a "vtCustom".
But this works for me on 6.7.
Code: | local mr = AddressList.createMemoryRecord()
mr.Description = 'Custom Type Test'
mr.Type = vtCustom
mr.CustomTypeName = 'Int / 2'
|
EDIT:
Do you have the custom type registered?
_________________
|
|
Back to top |
|
|
dl748 Advanced Cheater Reputation: 0
Joined: 05 Mar 2016 Posts: 75
|
Posted: Sat Jan 20, 2018 9:58 pm Post subject: |
|
|
6.7 here
Yeah, that code doesn't work for me, even if i change the name to yours. Yes its registered because I have some temporary entries using it.
Also, using .Type doesn't work for me either. I have to use .VarType
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat Jan 20, 2018 10:31 pm Post subject: |
|
|
Changing the name to the custom type on my computer will do you no good if you don't have a custom type registered with that same name.
And not sure what to say about the VarType other than the only CE Lua classes that has that property are the "MemScan" and "StructureElement" classes, at lest that I know of.
The only other thing I can say to try is open CE with out a table hook the tutorial process and run this in the Lua Engine form.
Code: | local TypeName = 'Int / 2'
local ByteCount = 4
local IsFloat = false
local function bytesToValue( ... )
local bytes = { ... }
return (byteTableToDword({ bytes[1], bytes[2], bytes[3], bytes[4] }) / 2)
end
local function valueToBytes(value)
local bytes = dwordToByteTable(value * 2)
return bytes[1], bytes[2], bytes[3], bytes[4]
end
registerCustomTypeLua(TypeName, ByteCount, bytesToValue, valueToBytes, IsFloat)
local mr = AddressList.createMemoryRecord()
mr.Description = 'Custom Type Test'
mr.Type = vtCustom
mr.CustomTypeName = TypeName
|
_________________
|
|
Back to top |
|
|
|