Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Auto Resizing Text (https://forums.graalonline.com/forums/showthread.php?t=51267)

XiLe 02-22-2004 06:52 AM

Auto Resizing Text
 
There is obviously no way to shrink text automatically (or at least Loriel said)

I came up with this script, but it doesn't seem to want to work. I tried it with for at first, and when it wouldn't work I tried the while, which just happened to refuse. I reconnected a few times, disconnected and /npcstarted up my NPC Server (couldnt do it with cpanel, it wont work) and it still doesnt work.. any ideas?

function showweap() {
wraptext2 97,.5,@Verdana@b,#w;
i=.5;
// for (i=.5; !strequals(#w,#t(0)); i-=.01;) {
while (!strequals(#w,#t(0))) {
i-=.1;
wraptext2 97,i,@Verdana@b,#w;
}
showtext 506,3,1,Verdana,b,#t(0);
changeimgvis 506,8;
changeimgzoom 506,i;
// }
timeout=.05;
}

R0bin 02-22-2004 07:35 AM

Meh, I cannot see what you are trying to do :confused:

XiLe 02-22-2004 08:50 AM

I got it working... I was attempting to make the text fit into a small box. For example, on kingdoms when your experience goes from 5 digits to 6, the text shrinks to fit it. It turns out that my NPC-Server is fussy and I had to take out the comments for some reason, then it worked...

R0bin 02-22-2004 01:14 PM

how strange o.O

VeX_RaT_Boy 02-22-2004 05:50 PM

Quote:

Originally posted by XiLe
I got it working... I was attempting to make the text fit into a small box. For example, on kingdoms when your experience goes from 5 digits to 6, the text shrinks to fit it. It turns out that my NPC-Server is fussy and I had to take out the comments for some reason, then it worked...
NPC Code:
if (strlen(#s(some.string))>5) changeimgzoom index,0.6;


???

XiLe 02-22-2004 11:24 PM

Quote:

Originally posted by VeX_RaT_Boy

NPC Code:
if (strlen(#s(some.string))>5) changeimgzoom index,0.6;


???

I wanted to go a bit more in depth than that lol. Some characters as you probably know take more width than others... example are "Z" compared to "|" I made it so that it goes through various zooms starting at .5 and going down until it just fits the stuff on the screen.

VeX_RaT_Boy 02-22-2004 11:43 PM

Quote:

Originally posted by XiLe


I wanted to go a bit more in depth than that lol. Some characters as you probably know take more width than others... example are "Z" compared to "|" I made it so that it goes through various zooms starting at .5 and going down until it just fits the stuff on the screen.

If I'm not completly wrong, you can use textheight() to calculate that?

Duwul 02-24-2004 12:40 AM

I believe you're thinking of textwidth(). :)

BTW I suggested that and textheight to Stefan. I'm so flattered. ;)

-Ramirez- 02-24-2004 12:42 AM

Quote:

Originally posted by Duwul
BTW I suggested that and textheight to Stefan. I'm so flattered. ;)
You and 23094820394 other people.

Duwul 02-24-2004 01:27 AM

Doubt it.:p

Goboom 02-24-2004 02:05 AM

Quote:

Originally posted by Duwul
Doubt it.:p
I know I sugested it, that makes 2.

-Ramirez- 02-24-2004 02:12 AM

As well as me, there's 3. Anyone else want to prove him wrong?

Duwul 02-24-2004 02:17 AM

Oh well. XP

VeX_RaT_Boy 02-24-2004 10:02 PM

From newfeatures:
Quote:

- new scripting function:
textheight(zoom,font,style) calculates
the height of text displayed with the
given zoom factor, font name and style;
textheight(1,,) gives the height of
the standard font used for showimg/showtext;
the style is a string with the letters
b (bold), or i (italic), the other styles
don't really make sense - the font name
and font style are generaly not influencing
the height a lot
???

xManiamaNx 02-24-2004 10:18 PM

textheight calculates the HEIGHT of the text. XiLe is trying to calulate the WIDTH of the text.


<3 big text


All times are GMT +2. The time now is 04:10 PM.

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