View previous topic :: View next topic |
Author |
Message |
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Thu Apr 20, 2017 8:57 pm Post subject: Create Records |
|
|
Code: | al=getAddressList()
name_address = 0x2a7d60f
name_offset = 0x462
for i =0,127 do
whichHero = trainer.Data.Characters[i]
mr = al.createMemoryRecord()
mr.Type = vtString,10
mr.Address = string.format("%x",(name_address + name_offset*i))
mr.Description = readString(mr.Address,10)
end |
I've run into a couple of issues here, using Ver 6.3
mr.Address they are all correct
mr.Type isn't right they are all zero length
mr.Description all are Plugin Address
What do I need to change?
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Thu Apr 20, 2017 9:24 pm Post subject: |
|
|
bknight2602 wrote: | What do I need to change? |
Your version of CE. From my perspective, you're being somewhat egotistical by expecting to get support for outdated software.
Regardless, if you look at main.lua, you'll see why the string's size is always 0:
Code: | MemoryRecord Class:
...
Type: ValueType - The variable type of this record. See vtByte to vtCustom
If the type is vtString then the following properties are available:
String.Size: Number of characters in the string
String.Unicode: boolean
... | (this is the main.lua of CE 6.6, it could be different in 6.3)
Instead of putting ",10" after vtString, assign 10 to the String.Size property of the memory record (i.e. mr.String.Size = 10).
As for the description, that code seems to work fine in CE 6.6. I'd guess it's a bug in 6.3.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Fri Apr 21, 2017 9:32 am Post subject: |
|
|
ParkourPenguin wrote: | bknight2602 wrote: | What do I need to change? |
Your version of CE. From my perspective, you're being somewhat egotistical by expecting to get support for outdated software.
Regardless, if you look at main.lua, you'll see why the string's size is always 0:
Code: | MemoryRecord Class:
...
Type: ValueType - The variable type of this record. See vtByte to vtCustom
If the type is vtString then the following properties are available:
String.Size: Number of characters in the string
String.Unicode: boolean
... | (this is the main.lua of CE 6.6, it could be different in 6.3)
Instead of putting ",10" after vtString, assign 10 to the String.Size property of the memory record (i.e. mr.String.Size = 10). |
Tried that and didn't work, but it seems reasonable, perhaps a bug in 6.3 as in the Description
In the train of thought from another string in which you posted getDescription(), I thought I tried that, however, using your suggestion that worked and the new records have what I was attempting except the size of the string/text. See above comment mr.String.Size = 10 resulted in an error attempting to index a nil value(String)
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Fri Apr 21, 2017 9:43 am Post subject: |
|
|
There's a memoryrecord_string_setSize function defined in the same file at the time of that commit. Try using that.
Again, I would recommend you update CE to the latest version. You'll eventually get left behind if you continue using 6.3. The sooner you update everything, the easier it will be.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Fri Apr 21, 2017 12:38 pm Post subject: |
|
|
Hopefully opening the table with 6.6 doesn't prevent opening/running with 6.3, but
Code: | al=getAddressList()
name_address = 0x294d60f
name_offset = 0x462
for i =0,127 do
whichHero = trainer.Data.Characters[i]
al = getAddressList()
for x = 0, al.Count-1 do
whichRec = al.MemoryRecord[x]
if al.Description == whichRec then
if x > 5541 then
whichRecord.deleteMemoryRecord()
end
end
end
end |
Results Error:in attempt to call a nil value (field 'deleteMemoryRecord')
How does one delete the record?
For those wondering, the createRecord added records, some of which are duplicates, and I wish to delete the duplicates, but just the records added with the create procedure(at the end x >=5541)
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Fri Apr 21, 2017 1:24 pm Post subject: |
|
|
whichRecord.destroy()
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Fri Apr 21, 2017 2:27 pm Post subject: |
|
|
That's not fair!!
But it didn't run, got tp the first duplicate record and error
Error:TTreeNodes.GetNodeFromIndex Index 5669 out of bounds (Count=5669)
That's probably accurate, so I guess I'll have to delete them manually, unless there is another suggestion.
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Apr 21, 2017 2:42 pm Post subject: |
|
|
you are messing many things:
bknight2602 wrote: | Hopefully opening the table with 6.6 doesn't prevent opening/running with 6.3, but
Code: | al=getAddressList()
name_address = 0x294d60f
name_offset = 0x462
for i =0,127 do
whichHero = trainer.Data.Characters[i]
al = getAddressList()
for x = 0, al.Count-1 do
whichRec = al.MemoryRecord[x]
if al.Description == whichRec then
if x > 5541 then
whichRecord.deleteMemoryRecord()
end
end
end
end |
|
al object doesn't have Description property.
_________________
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Fri Apr 21, 2017 3:08 pm Post subject: |
|
|
Also, the for loop evaluates the upper boundary expression only once. If the control expressions represent an index in a container, no items should be added to or removed from the container within the for loop. Otherwise, the for loop will either not iterate over all the items or try to index a value that no longer exists.
Deleting a memory record will modify the upper boundary of the address list. In the for loop in your code, this will eventually cause an access violation because the address list is now shorter than it was when the for loop started (i.e. the only time the expression al.Count-1 was evaluated).
Iterating over the address list in the opposite direction using a for loop would work.
Code: | for i = al.Count - 1, 0, -1 do
-- code...
al[i].destroy()
end |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
bknight2602 Grandmaster Cheater Reputation: 0
Joined: 08 Oct 2012 Posts: 577
|
Posted: Fri Apr 21, 2017 3:20 pm Post subject: |
|
|
ParkourPenguin wrote: | Also, the for loop evaluates the upper boundary expression only once. If the control expressions represent an index in a container, no items should be added to or removed from the container within the for loop. Otherwise, the for loop will either not iterate over all the items or try to index a value that no longer exists.
Deleting a memory record will modify the upper boundary of the address list. In the for loop in your code, this will eventually cause an access violation because the address list is now shorter than it was when the for loop started (i.e. the only time the expression al.Count-1 was evaluated).
Iterating over the address list in the opposite direction using a for loop would work.
Code: | for i = al.Count - 1, 0, -1 do
-- code...
al[i].destroy()
end |
|
I thought I was taking care of the upper bound, by resetting al=getAddressList()
Code: | al=getAddressList()
name_address = 0x294d60f
name_offset = 0x462
for i =0,127 do
whichHero = trainer.Data.Characters[i]
al = getAddressList()
numb = 0
for x = 0, al.Count-1 do
whichRecord = al.MemoryRecord[x]
if whichRecord.Description == whichHero then
numb = numb +1
if x >= 5541 and numb >= 2 then
print(x .. " " .. whichRecord.Description)
whichRecord.destroy()
end
end
end
end |
line #6, but working backwards might have been better and that statement might have been in the wrong position.
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Apr 21, 2017 3:29 pm Post subject: |
|
|
It would be easier if you use "header" memory record, then append memory records there, those you want to delete in the future.
_________________
|
|
Back to top |
|
|
|