Code: Select all
Invalid condition in IF(json.get(item, "Entity") == sName) roll option. Statement options (if any): h, if(json.get(item, "Entity") == sName ) Statement Body : totalWeight = totalWeight + (json.get(item, "Qty") * json.get(item, "Weight"))
Code: Select all
[h: sName = arg(0)]
[h: totalWeight = 0]
[h: Items = "[]"]
[h: Inventory = getLibProperty("Inventory","Lib:Utility")]
[h: Containers = getLibProperty("Containers","Lib:Utility")]
[h, foreach(item, Inventory), CODE: {
[h, if(json.get(item, "Entity") == sName ): totalWeight = totalWeight +
(json.get(item, "Qty") * json.get(item, "Weight"))]
[h, if(json.get(item, "Capacity") > 0): Containers = json.append(Containers, item)]
[h, if(json.get(item, "Entity") == sName ): Items = json.append(Items, item)]
}]
[h: setLibProperty("ItemList",Items, "Lib:Utility")]
[h: setLibProperty("Containers",Containers, "Lib:Utility")]
[h: macro.return = totalWeight ]
Code: Select all
,{"ID":2840,"ItemName":"Periapt of Health","ItemDesc":"pg 325","Container":1775,"Entity":"Perran Davy","Qty":1,"Weight":0.01,"Capacity":0,"WeightOverride":0,"MagicItem":1},{"ID":2845,"ItemName":"Spear +1","ItemDesc":"head of adamantine steel","Container":0,"Entity":"Zaor","Qty":2,"Weight":5,"Capacity":0,"WeightOverride":0,"MagicItem":0},{"ID":2848,"ItemName":"Decanter of endless water","ItemDesc":"","Container":1839,"Entity":"Cotman Longfoot","Qty":1,"Weight":2,"Capacity":0,"WeightOverride":0,"MagicItem":1},{"ID":2861,"ItemName":"Water, quart","ItemDesc":"","Container":2582,"Entity":"Perran Davy","Qty":1,"Weight":2,"Capacity":0,"WeightOverride":0,"MagicItem":0},{"ID":2865,"ItemName":"Lantern, hooded","ItemDesc":"","Container":0,"Entity":"Cotman Longfoot","Qty":1,"Weight":2,"Capacity":0,"WeightOverride":0,"MagicItem":0},{"ID":2866,"ItemName":"Holy water (flask)","ItemDesc":"","Container":1839,"Entity":"Cotman Longfoot","Qty":4,"Weight":0.1,"Capacity":0,"WeightOverride":0,"MagicItem":0}