Storing quantities with a FormList

Post » Mon Jun 18, 2012 1:04 pm

Basically, I'm using a FormList to store a list of items, but I need to store the item's quantity as well. So far my workaround has been to store an instance of the item for every count, but this is disgustingly inefficient, and has caused noticable slowdown when working with a large collection of items. I've considered using an array of ints to store the counts, but the problem here is that I would need a non-fixed-length array.

I could use new to reallocate a new array each time I need it bigger, like I would in C++, but as far as I can tell there's no "delete" equivellant. Does Papyrus have garbage collection?
User avatar
Wanda Maximoff
 
Posts: 3493
Joined: Mon Jun 12, 2006 7:05 am

Post » Mon Jun 18, 2012 8:12 am

It looks like you can't use new with a variable array length...

I tried using "int temp[] = new int[countsize]", and the compiler gave me errors galore.
User avatar
Ron
 
Posts: 3408
Joined: Tue Jan 16, 2007 4:34 am

Post » Mon Jun 18, 2012 9:16 am

Anyone? Bump?
User avatar
Laura Simmonds
 
Posts: 3435
Joined: Wed Aug 16, 2006 10:27 pm

Post » Mon Jun 18, 2012 7:23 am

Make placeholder statics (objects literally named One,Two, etc) and keep the list indexes in order? Sorry, can't think of a better solution. If only we can Instantiate objects w/ Papyrus (one of my pet peeves)...
User avatar
Sarah Evason
 
Posts: 3507
Joined: Mon Nov 13, 2006 10:47 pm

Post » Mon Jun 18, 2012 6:28 am

Believe me though the workaround this time around are a lot less crazy than ... When oblivion was around.
User avatar
Karen anwyn Green
 
Posts: 3448
Joined: Thu Jun 15, 2006 4:26 pm

Post » Mon Jun 18, 2012 10:54 am

What do I do when I'm working with, say, 1000 of a given item? I would literally need *thousands* of dummy items.. tens of thousands if I really wanted to cover my bases....
User avatar
Danielle Brown
 
Posts: 3380
Joined: Wed Sep 27, 2006 6:03 am

Post » Mon Jun 18, 2012 6:58 pm

Bump, I really can't think of a way to do this efficiently...

If only FormLists supported extra data....
User avatar
Jessica Nash
 
Posts: 3424
Joined: Tue Dec 19, 2006 10:18 pm


Return to V - Skyrim