OSRS Plugin API
    Preparing search index...

    Function ocCost

    • Gets the cost of the object identified by the provided id.

      Parameters

      • objId: number

        the id of an object.

      Returns number

      the cost of the identified object.

      local BACKPACK = 93;
      local size = osrs.ClientOp.invSize(BACKPACK);
      local totalCost = 0;
      for i=0, size-1, 1 do
      local id = osrs.ClientOp.invGetObjId(BACKPACK, i)
      totalCost = totalCost + osrs.ClientOp.ocCost(id);
      osrs.printf("Slot %d contains the item id: %d, name: %s, cost: %d", i, id, osrs.ClientOp.ocName(id), tostring(osrs.ClientOp.ocCost(id)));
      end
      osrs.printf("The total value of the inventory is: %d", totalCost)