Thanks Chompy...well now I'm having problems with dragging the icon around. Here's what I have:
PHP Code:
function loadPage() {
for (a=1; a<25; a++) {
makevar("ItemIcon_" @ a).destroy();
}
this.itemssize = clientr.items.size()-((this.page-1)*24);
temp.base = {218+Inv.x, 53+Inv.y};
for (temp.i=0; temp.i<this.itemssize; temp.i++) {
new GuiShowImgCtrl("ItemIcon_" @ temp.i) {
x = temp.base[0] + (32*(temp.i%4));
y = temp.base[1] + (32*int(temp.i/6));
image = "bcalarmclock.png";
this.origin = {this.x, this.y};
thiso.catchevent(this.name, "onMouseDown", "linkItem");
thiso.catchevent(this.name, "onRightMouseDown", "onItemRightClicked");
thiso.catchevent(this.name, "onMouseUp", "unlinkItem");
thiso.catchevent(this.name, "onMouseDragged", "moveItem");
InventoryGUI.addControl(this);
}
}
}
function linkItem(iname) {
makevar(iname).zoom = 1.2;
makevar(iname).width = makevar(iname).width*1.2;
makevar(iname).height = makevar(iname).height*1.2;
this.linkeditem = makevar(iname);
}
function unlinkItem() {
if (this.linkeditem != NULL) {
for (i=0; i<this.slots.size(); i++) {
if (this.linkeditem.x in |this.slots[i][0]+Inv.x, this.slots[i][2]+Inv.x| && this.linkeditem.y in |this.slots[i][1]+Inv.y, this.slots[i][3]+Inv.y|) {
if (this.slots[i][5] == NULL) equipItem(this.slots[i][4], this.linkeditem.name);
else {
unequipItem(this.slots[i][4], this.slots[i][5]);
equipItem(this.slots[i][4], this.linkeditem.name);
}
this.slots[i][5] = this.linkeditem.name;
}
}
with (this.linkeditem) {
zoom = 1;
extent = {32,32};
position = this.origin;
}
this.linkeditem = NULL;
}
}
function moveItem() {
if (this.linkeditem != NULL)
this.linkeditem.position = {params[2], params[3]};
}
Which works, except...for some reason I can't drag the icon to the left. o.0 Which is kind of a problem, because the main reason I'm doing this is to drag it to the equip slots, which is to the left of the icons.
By the way, Chompy, where the hell have you been? You haven't been on Maloria in forever. D: