Quote:
Originally Posted by Chompy
Hmm, then my guess is, you're not giving them a coordinate in the Inventory control? I'm not used to use the inventory itself as an gui control.. I just use an image and then a for() loop and place them on the image itself..
and I use another method for placing them (Thanks Contiga for that one  )
PHP Code:
x = x + (offsetx*index§iconshorizontal); y = y + (offsety*int(index/iconsvertical));
for example for 6x6 icons I do:
PHP Code:
this.ix = inventory.x; this.iy = inventory.y; for(temp.i = 0; i < 36; i ++) { new GuiBitmapButtonCtrl("button_" @ i) { x = thiso.ix + 13.5 + (33*(i§6)); y = thiso.iy + 165 + (33*int(i/6)); this.image = "bomb.png"; normalbitmap = this.image; mouseoverbitmap = this.image; pressedbitmap = this.image;
width = 32; height = 32; thiso.catchevent(this, "onMouseDown", "onItemPressed"); } }
PS: In the scripts I had to write § instead of o/o (percent symbol), stupid bad request **** =/
|
Sorry to revive this thread, but...that actually doesn't work, Chompy. =/
It works only for an even grid (like your 6x6 example)
So i changed the y to:
PHP Code:
y = temp.base[1] + (32*int(roundTo((temp.id/6),1.1)));
roundTo() being Zero's roundTo() function.
PHP Code:
public function roundTo(val, place) {
return int(val/place + 0.5)*place;
}
But, that only works for TWO lines...(on a 4x6 grid)...so now I can't figure out how to do it.