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 02-26-2012, 05:08 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
findimg() text width and height

I'm trying to code the nickname system for Delteria, and I'm having some issues with finding the height and width for the text when using findimg();
I'm trying to stretch an image to the width and height of the text, but using findimg(id).width or findimg(id).height doesn't give me any values. Is there a way to get the width and height?
PHP Code:
with(findimg(1)) {
  
text player.nick;
  
zoom 0.75;
  
player.x;
  
player.y;

If I echo findimg(1).width, it gives me 0;
__________________
Reply With Quote
  #2  
Old 02-26-2012, 05: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
Quote:
Originally Posted by Emera View Post
I'm trying to code the nickname system for Delteria, and I'm having some issues with finding the height and width for the text when using findimg();
I'm trying to stretch an image to the width and height of the text, but using findimg(id).width or findimg(id).height doesn't give me any values. Is there a way to get the width and height?
PHP Code:
with(findimg(1)) {
  
text player.nick;
  
zoom 0.75;
  
player.x;
  
player.y;

If I echo findimg(1).width, it gives me 0;
It's probably better to just use Default nicknames rather than script them for a server which intends to be on iPhone. Unless you want to include extra capabilities and controls for them, and have sufficient knowledge to optimise the system.

There is gettextwidth(zoom, font, style, text);, and gettextheight(zoom, font, style, text);.
Reply With Quote
  #3  
Old 02-26-2012, 05:24 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
If you want to center the text below the player, you can try something like this
PHP Code:
with(findImg(1)) {
  
text player.nick;
  
player.1.5;
  
player.3.4;
  
style "c";

__________________
MEEP!
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 12:27 PM.


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