View Single Post
  #2  
Old 06-16-2013, 01:57 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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 (
== 2) {
| | if (
== 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.sxtemp.sy1121);
  
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
__________________
Reply With Quote