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 04-02-2012, 04:59 PM
r3ckless r3ckless is offline
Owner of Corinthia
Join Date: Dec 2011
Location: MAssachusetts, USA
Posts: 131
r3ckless is an unknown quantity at this point
Send a message via AIM to r3ckless Send a message via MSN to r3ckless
positioning for everyone

Hey guys I'm trying to setup a custom HP HUD. I'm having trouble with placement on screen though. I'm using screenheight/width, but when I line it up perfect on my screen, its not perfect for everyone else. How would I go about doing this correctly?

This is a part of what I have:

PHP Code:
function ShowHP_Bar()
{
with (findimg(250)) {
image "bigheart.png";
    
screenwidth-200;
    
screenheight-540;
    
partw 40;
    
parth 44;
    
layer 4;
   }

__________________

Yep.

Reply With Quote
  #2  
Old 04-02-2012, 05:06 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
You're trying to get it to show in the bottom right of the screen? That looks about right. Otherwise change the x/y values—you only need the screen's width/height if you're at the right/bottom.
__________________
Reply With Quote
  #3  
Old 04-02-2012, 05:46 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
How did you decide the values of 200 and 540? If you want it to be exactly in the corner, you'd only have to subtract the height/width of the image itself.
Reply With Quote
  #4  
Old 04-02-2012, 05:56 PM
r3ckless r3ckless is offline
Owner of Corinthia
Join Date: Dec 2011
Location: MAssachusetts, USA
Posts: 131
r3ckless is an unknown quantity at this point
Send a message via AIM to r3ckless Send a message via MSN to r3ckless
I want it to be at the top right somewhat. Here is a screenshot of what the said code gave me
Attached Thumbnails
Click image for larger version

Name:	cornerimg.png
Views:	187
Size:	29.5 KB
ID:	54479  
__________________

Yep.

Reply With Quote
  #5  
Old 04-02-2012, 07:10 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You don't need to use screenheight when you're working from the top, just using a 10 or 20 y value for example will get you what you're looking for.
__________________
Quote:
Reply With Quote
  #6  
Old 04-02-2012, 09:50 PM
r3ckless r3ckless is offline
Owner of Corinthia
Join Date: Dec 2011
Location: MAssachusetts, USA
Posts: 131
r3ckless is an unknown quantity at this point
Send a message via AIM to r3ckless Send a message via MSN to r3ckless
ah, thanks fp
__________________

Yep.

Reply With Quote
  #7  
Old 04-02-2012, 09:52 PM
r3ckless r3ckless is offline
Owner of Corinthia
Join Date: Dec 2011
Location: MAssachusetts, USA
Posts: 131
r3ckless is an unknown quantity at this point
Send a message via AIM to r3ckless Send a message via MSN to r3ckless
How would I go about the x axis though, not everybody's screen is the same size...
__________________

Yep.

Reply With Quote
  #8  
Old 04-02-2012, 10:14 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by r3ckless View Post
How would I go about the x axis though, not everybody's screen is the same size...
You already got that right in your first post. Use screenwidth and then subtract.
Reply With Quote
  #9  
Old 04-02-2012, 11:55 PM
r3ckless r3ckless is offline
Owner of Corinthia
Join Date: Dec 2011
Location: MAssachusetts, USA
Posts: 131
r3ckless is an unknown quantity at this point
Send a message via AIM to r3ckless Send a message via MSN to r3ckless
Thanks guys
__________________

Yep.

Reply With Quote
  #10  
Old 04-03-2012, 01:17 PM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
Quote:
Originally Posted by Crow View Post
You already got that right in your first post. Use screenwidth and then subtract.
It looks like he wants it centered, though, so he'd have to do something more akin to:

screenwidth / 2 - width_of_hpbar / 2
Reply With Quote
  #11  
Old 04-03-2012, 05:07 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Hezzy002 View Post
It looks like he wants it centered, though, so he'd have to do something more akin to:

screenwidth / 2 - width_of_hpbar / 2
Quote:
Originally Posted by r3ckless View Post
I want it to be at the top right somewhat. Here is a screenshot of what the said code gave me
Going by what he posted earlier, I don't think he wants it centered Still, good point to make.
Reply With Quote
  #12  
Old 04-03-2012, 05:20 PM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
Looked centered in the screenie..
Reply With Quote
  #13  
Old 04-04-2012, 05:01 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by Hezzy002 View Post
It looks like he wants it centered, though, so he'd have to do something more akin to:

screenwidth / 2 - width_of_hpbar / 2
simplify!

x = (screenwidth - IMG_WIDTH) / 2;

That's all :P

If you want it to be to the right then wrap that in quotes then + (whatever offset from center). Also make sure to re set values when the screen is resized.
__________________
Deep into the Darkness peering...
Reply With Quote
  #14  
Old 04-04-2012, 09:59 PM
r3ckless r3ckless is offline
Owner of Corinthia
Join Date: Dec 2011
Location: MAssachusetts, USA
Posts: 131
r3ckless is an unknown quantity at this point
Send a message via AIM to r3ckless Send a message via MSN to r3ckless
thanks guys, i wanted it on the left side. But i figured it out from what you guys said.
__________________

Yep.

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 08:13 AM.


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