Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   GuiDrawingPanel.onMouseDown() error? (https://forums.graalonline.com/forums/showthread.php?t=134265425)

iBeatz 12-27-2011 11:52 PM

GuiDrawingPanel.onMouseDown() error?
 
I've been constructing a GUI-based project, and have run into a problem which hinders the progress I make on this project severely.
As the title suggests, when the event occurs, one of the parameters appears to go skew-whiff with the following code:

PHP Code:

// The drawing panel inside a GuiScrollCtrl
new GuiDrawingPanel("Tiles_Panel"){
  
0;
  
0;
  
width getImgWidth("pics1.png");
  
height getImgHeight("pics1.png");
  
drawImage(00getTileset());
}

// The event
function Tiles_Panel.onMouseDown(keymodmouse_xmouse_ycount){
  
player.chat this.start_x params[1]/16;


When the drawing panel is clicked at its furthermost left, it comes out as a decimal value around 30, which isn't right...
I though conflicting GUI names might cause the problem, but that's the only GUI I have with that name.

iBeatz 01-04-2012 07:16 PM

Bumping until I get some sort of explanation, if there is any. :cry:

ffcmike 01-04-2012 07:22 PM

Just a guess, but I thought the maximum drawing panel width/height is now 1024 pixels, which the tileset is wider than.
Perhaps test the same but with a smaller image?

Tolnaftate2004 01-04-2012 07:48 PM

Is this the entire code? Because it works fine for me.

I'd wager a guess that it's not, and that you're doing something between catching the mousedown event and the assignment that is changing the values in params. You've already given explicit symbols for the params, you might as well use them...

PHP Code:

player.chat this.start_x mouse_x/16


0PiX0 01-04-2012 07:55 PM

I find it strange that you are using the 'params' var.
Quote:

Originally Posted by ffcmike (Post 1680716)
Just a guess, but I thought the maximum drawing panel width/height is now 1024 pixels, which the tileset is wider than.
Perhaps test the same but with a smaller image?

They are not limited to 1024 width/height.

iBeatz 01-04-2012 08:16 PM

I suppose the only thing that could be changing the output in my onMouseDown event is the first element in the scrollpos array of the ScrollCtrl the drawing panel is inside, as I'm adding it to the mouse_x parameter to find where on the drawing panel was clicked, but I've checked and made sure the horizontal scroll bar was at its furthermost left when I clicked the panel, but it still outputs 30.
I'm not sure how my script goes, as I can't check it right now, but that's the only other thing that could be affecting it.

Any ideas?

Tolnaftate2004 01-04-2012 08:40 PM

Quote:

Originally Posted by iBeatz (Post 1680720)
I suppose the only thing that could be changing the output in my onMouseDown event is the first element in the scrollpos array of the ScrollCtrl the drawing panel is inside, as I'm adding it to the mouse_x parameter to find where on the drawing panel was clicked, but I've checked and made sure the horizontal scroll bar was at its furthermost left when I clicked the panel, but it still outputs 30.
I'm not sure how my script goes, as I can't check it right now, but that's the only other thing that could be affecting it.

Any ideas?

You're going to have to give us more. The snippet you've shown works, and it's really hard to debug code that we can't see.


All times are GMT +2. The time now is 01:12 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.