Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
For a newb I have managed to get this javascript array in CC working but unsure how to do the final step to translate the results to populate the 2D overlays I have setup in my inventory screen(called - slt1, slt2, slt3 etc): This works: const invMe= [ {name: 'Water bottle', qty: 1, group: 'food', regen: 6, condition: 0.9, weight: 0.7}, {name: 'Bandage', qty: 0, group: 'heal', regen: 2, condition: 0.8, weight: 0.1}, {name: 'Medkit', qty: 2, group: 'heal', regen: 7, condition: 0.8, weight: 0.3} ]; //WORKING - filter a group like name, qty, group, regen etc const filtercategrory1 = invMe.filter(function(list) { if(list.group === 'heal') { print(list.name); return true; } }); //WORKING - filter results within a category like name, qty, group, regen etc const filtercategory2 = invMe.filter(function(list) { if(list.qty >= 1) { print(list.weight); return true; } }); I'm fairly sure you need to allocate the index of each result of the query wanted to one 2D overlay each. Im just not sure how to do that... anyone please ?? |
||||
|
NOTE - the first two 2D overlays (slt1, slt2 etc) need to know what the item is in index 0 & 1 etc and show the picture accordingly. I suspect I need another grouping like "nu" in my array to attach this number to each 2d overlay so that showing the appropriate picture will be easier to lookup like.....texture1.png and texture2.png etc... any thoughts on this also ? |
|