Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   textwidth madness (https://forums.graalonline.com/forums/showthread.php?t=134258179)

coreys 02-25-2010 09:15 PM

textwidth madness
 
I'm having some very strange issues with the textwidth function. If I try and input a variable into the function like this:
PHP Code:

foo "some text here";
len textwidth(1"Verdana""b"foo); 

it will always output the same value no matter what the text is in the variable (in my case, 74).

However, if I use a string literal, like this:
PHP Code:

len textwidth(1"Verdana""b""some text here"); 

It will work properly.

Anybody know what I'm doing wrong here? I've checked the variables value over and over, it's nothing to do with that, I don't think.

fowlplay4 02-25-2010 10:15 PM

It's gettextwidth.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
foo "some text here"
  
len gettextwidth(1"Verdana""b"foo);
  
len2 gettextwidth(1"Verdana""b""some text here");
  echo(
len SPC len2); // echos "184 184"



coreys 02-25-2010 10:50 PM

Ah, I hadn't used the function since long ago when it was textwidth(). Thanks :)

DustyPorViva 02-25-2010 11:21 PM

It was never just textwidth() :P

Crow 02-25-2010 11:29 PM

Quote:

Originally Posted by dustyporviva (Post 1558879)
it was never just textwidth() :p

GS1.stupid anti caps

coreys 02-25-2010 11:31 PM

Quote:

Originally Posted by Crow (Post 1558882)
GS1.stupid anti caps

^ yeah this
So, obviously been awhile :)

Chompy 02-25-2010 11:32 PM

Quote:

Originally Posted by DustyPorViva (Post 1558879)
It was never just textwidth() :P

I'm pretty, very and quite sure it existed way back in gs1.

Or.. Ok, I'm like.. 100% that there was. newfeatures2003.txt

Quote:

- textwidth(zoom,font,style,text): calculates the pixel
width of a text with the given zoom factor, font and style

DustyPorViva 02-25-2010 11:44 PM

Odd enough, I alway remembered the gettextwidth()... wonder why it was changed!


All times are GMT +2. The time now is 06:46 PM.

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