Code:
[proc,collectionlog_switchsubcategory](struct $subcat)
cc_deleteall(701:12);
def_string $subcat_name = struct_param($subcat, 595);
def_enum $subcat_objects = struct_param($subcat, 597);
def_inv $subcat_inv = struct_param($subcat, 596);
def_int $objects = enum_getoutputcount($subcat_objects);
def_obj $object = -1;
def_int $object_total = 0;
def_int $object_padding = (if_getwidth(701:12) - (6 * 36)) / 8;
def_int $obtained = 0;
for (def_int $i = 0; $i < $objects; $i = $i + 1) {
$object = enum(int, obj, $subcat_objects, $i);
$object_total = inv_total($subcat_inv, $object);
cc_create(701:12, ^iftype_graphic, $i);
cc_setposition(2 + (($i % 6) * (36 + $object_padding)), (($i / 6) * (36 + $object_padding)), ^setpos_abs_left, ^setpos_abs_top);
cc_setsize(36, 32, ^setsize_abs, ^setsize_abs);
cc_setgraphicshadow(0x333333);
cc_setoutline(true);
cc_setop(1, "Check");
cc_setopbase("<col=ff9040><oc_name($object)></col>");
cc_setonop("collectionlog_obj_op(oc_name($object), $object_total)");
if ($object_total > 0) {
cc_setobject($object, $object_total);
$obtained = $obtained + 1;
} else {
cc_setobject_nonum($object, 0);
cc_settrans(135);
}
}
// update the boss name component text
if_settext($subcat_name, 701:6);
// update the obtained component text and color
if_settext("<tostring($obtained)>/<tostring($objects)>", 701:8);
if ($obtained == $objects) {
if_setcolor(0x00FF00, 701:8);
} else {
if_setcolor(0xFFFF00, 701:8);
}
def_int $kills = ~collectionlog_killcount;
if ($kills >= 0) {
// update "Boss name kills" component
if_settext("<$subcat_name> kills:", 701:9);
if_sethide(false, 701:9);
// update kill count component text
if_settext(~script46(~collectionlog_killcount, ","), 701:10);
if_sethide(false, 701:10);
} else {
if_sethide(true, 701:9);
if_sethide(true, 701:10);
}
def_int $scroll_height = ($objects / 6) * (36 + $object_padding);
// we need to account for overflow so add 36 to the height if there is a remainder
if ($objects % 6 != 0) {
$scroll_height = $scroll_height + 36;
}
// hide scrollbar if it isn't needed
if ($scroll_height > if_getheight(701:12)) {
if_sethide(false, 701:13);
} else {
if_sethide(true, 701:13);
}
if_setscrollpos(0, 0, 701:12);
if_setscrollsize(0, $scroll_height, 701:12);
~scrollbar_vertical(701:13, 701:12, 792, 789, 790, 791, 773, 788);