DS_Grids Help

J

JayR

Guest
Is it possible to get the sum of all the same items in an inventory using DS_Grid?

I have 10 columns (10 slots).
Row 1 hold the item indexes.
Row 2 hold the stack amount.

I know I can use for loop to loop through all my slots and add the stack amounts individually. But is there a function that does this? The sum functions of ds_grid don't seem much of a help..
 
T

TimothyAllen

Guest
The ds grid sum function is the one you want. If its not working like you want, its likely you made a mistake. Post your code.
 
J

JayR

Guest
My codes are kinda everywhere now. I double checked the docs. The ds grid sum function "Returns the sum of all the cells within a region on a grid." It returns all. But I only need the sum of the same item within a row.
 
T

TimothyAllen

Guest
My codes are kinda everywhere now. I double checked the docs. The ds grid sum function "Returns the sum of all the cells within a region on a grid." It returns all. But I only need the sum of the same item within a row.
So are you saying that you have multiple slots with the same item and you want to add up the stacks for that particular item type. If your items are not sorted, then your only option is to loop through them as you suggested.
 
J

JayR

Guest
So are you saying that you have multiple slots with the same item and you want to add up the stacks for that particular item type. If your items are not sorted, then your only option is to loop through them as you suggested.
Yeap, that's right.
Ahh ok.. Seems like I should have stick with Arrays.
Thanks!
 
Top