Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-27-2011, 11:52 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
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.
__________________

Intelligence without ambition is like a bird without wings.

Reply With Quote
  #2  
Old 01-04-2012, 07:16 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
Bumping until I get some sort of explanation, if there is any.
__________________

Intelligence without ambition is like a bird without wings.

Reply With Quote
  #3  
Old 01-04-2012, 07:22 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
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?
Reply With Quote
  #4  
Old 01-04-2012, 07:48 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
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
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 01-04-2012 at 08:11 PM..
Reply With Quote
  #5  
Old 01-04-2012, 07:55 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
I find it strange that you are using the 'params' var.
Quote:
Originally Posted by ffcmike View Post
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.
__________________
Reply With Quote
  #6  
Old 01-04-2012, 08:16 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
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?
__________________

Intelligence without ambition is like a bird without wings.

Reply With Quote
  #7  
Old 01-04-2012, 08:40 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by iBeatz View Post
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.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 01-04-2012 at 09:46 PM..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:14 AM.


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