Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-29-2013, 10:37 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Center GUI per screenwidth

I'm having an extremely hard time centering a gui control per screenwidth, so when screen width changes it's still centered. I know the GraalControl resize, and I'm using it.

The problem is just finding how to center it. I can get it close to center, but then when I resize Graal's window it gets all screwed up, even with the same center script. I've tried a multitude of things, but this is the most recent....

PHP Code:
= (screenwidth getimgwidth("roak_mainmenu_backdrop1.png")) - 230
The above is a bit unnecessary, but again, I've tried many things, including just splitting screen width subtracting a number. It just keeps "offsetting" from center as I change Graal's window size.....

Am I missing something?
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 09-29-2013, 10:53 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
Try this:
PHP Code:
= (screenwidth getimgwidth("roak_mainmenu_backdrop1.png")) / 2
Same goes for height.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #3  
Old 09-29-2013, 11:05 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
omg ty

I feel dumb.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #4  
Old 09-29-2013, 11:11 PM
Jakov_the_Jakovasaur Jakov_the_Jakovasaur is offline
Deleted by Darlene159
Jakov_the_Jakovasaur's Avatar
Join Date: Sep 2013
Location: Deleted by Darlene159
Posts: 353
Jakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud ofJakov_the_Jakovasaur has much to be proud of
wouldnt getimgwidth(imagename) return 0 if the image file hasn't been downloaded yet?
or are you ensuring the image is pre-loaded?
__________________
This signature has been deleted by Darlene159.
Reply With Quote
  #5  
Old 09-29-2013, 11:49 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
wouldnt getimgwidth(imagename) return 0 if the image file hasn't been downloaded yet?
or are you ensuring the image is pre-loaded?
Test it, but in the past, yes, it would return zero (but it would also trigger the downloading of the image, so you could keep trying it until it worked). If the image is not going to be changing much, you might as well just hardcode it as a constant in the script. Otherwise you'll have to wait for it to download (or if it's really important, you can force it to be pre-downloaded, e.g. via update packages or a script that triggers the download of certain images on login).
__________________
Reply With Quote
  #6  
Old 09-30-2013, 02:03 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
I did end up putting it in a var. It does happen some times still it seems at least...
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:15 PM.


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