First of all, you can replace
PHP Code:
for (temp.i = 0; temp.i < 42; temp.i++)
{
(@ "InventoryGuiBitmapCtrl_item_" @ temp.i).destroy();
}
with
PHP Code:
InventoryGuiScrollCtrl_Contents.clearControls();
You also don't have to use
temp.w and
temp.h to determine the positions of the controls. Instead you could use this:
PHP Code:
x = 33*(temp.i%4);
y = 33*int(temp.y/4);
I'm also fairly sure that your text controls is what messes it up. Try commenting them out. Why aren't you just setting
text = clientr.item.(@temp.itemlist[temp.i])[0]; in the
GuiShowImgCtrl though?