Firstly, I'm not sure why you have the 4 ending brackets at the end of your script, when you only have one opening bracket.
And here's a tip, when you're scripting, make sure your starting brackets and the ending brackets line up. Makes it much easier to debug your code.
PHP Code:
function onCreated() {
| if (1 + 1 == 2) {
| | if (2 - 1 == 1) {
| | | // do something here
| | }
| }
}
You see how they line up? Make sure you do that
To further answer you question, I suggest you remove extent and position. Also, even though you define them as arrays you can't access them as arrays, so you should do
extent = "123 321"; instead. (What I mean by that you can't access them as arrays, is that there is currently no support for reading the first value of for example extent, by using extent[0] - atleast this is what the wiki states)
Instead of extent and position I suggest you use
resize(x, y, width, height);
This will place your guicontrol at x and y (relative to the parent gui control if it's a child. If this is the parent gui control, use screen coordinates) and resize the width and height to the values specified respectively.
And the use of partx, party, partw, parth is for clipping the image, using only a section of the image:
GuiControls don't really use partx, party etc etc besides GuiShowImgCtrl and GuiDrawingPanel, I suggest you use this instead:
PHP Code:
new GuiBitmapCtrl("Button_Test") {
resize(temp.sx, temp.sy, 11, 21);
alpha = 2;
bitmap = "image.png";
bitmaprectangle = {0,0,32,32};
}
You see the use of
bitmaprectangle? It starts to cut out a section of the provided image, allowing you to use a specified area of your bitmap.
The array values are as follows:
NPC Code:
bitmaprectangle = {startx, starty, width from startx, height from starty};
--
If you have any more questions or wondering about something else, just ask