Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-04-2002, 05:09 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Text Length

Some Function is needed to calculate the length (in pixles) of a string at a certain size and font .. like

textlen(string,zoomfactor,font)

Seeing as how fonts are not fixed width. It would be nice for some things I have been making.
__________________

subliminal message: 1+1=3

Last edited by Falcor; 11-04-2002 at 05:20 AM..
Reply With Quote
  #2  
Old 11-04-2002, 05:57 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
good idea, horrible naming convention

textlen reminds me of the length of a string.

maybe textwidth?
Reply With Quote
  #3  
Old 11-04-2002, 06:56 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Re: Text Length

Quote:
Originally posted by Falcor
Some Function is needed to calculate the length (in pixles) of a string at a certain size and font .. like

textlen(string,zoomfactor,font)

Seeing as how fonts are not fixed width. It would be nice for some things I have been making.

I know what you mean. :-( Was a guessing game getting text to match up to stuff.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #4  
Old 11-04-2002, 07:00 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Isn't there a command to get the image width and height? If that's set up to work with @ images...
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #5  
Old 11-04-2002, 07:31 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
nope, just to get the width of an image in memory.

Also.


IMPLEMENT THIS IDEA NOW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!
Reply With Quote
  #6  
Old 11-04-2002, 08:12 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Quote:
Originally posted by Tyhm
Isn't there a command to get the image width and height? If that's set up to work with @ images...
Nah, you gotta give it a filename.
__________________

subliminal message: 1+1=3
Reply With Quote
  #7  
Old 11-04-2002, 09:50 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Re: Text Length

Quote:
Originally posted by Falcor
Some Function is needed to calculate the length (in pixles) of a string at a certain size and font .. like

textlen(string,zoomfactor,font)

Seeing as how fonts are not fixed width. It would be nice for some things I have been making.
just a hunch, but could you tell us what it is you're making? :P

I don't know why, but I am set on the idea that you don't want text to go off screen.. and I want to tell you to use the wraptext command
__________________

Reply With Quote
  #8  
Old 11-04-2002, 10:54 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Re: Re: Text Length

Quote:
Originally posted by CheeToS2


just a hunch, but could you tell us what it is you're making? :P

I don't know why, but I am set on the idea that you don't want text to go off screen.. and I want to tell you to use the wraptext command
You dont need to know what I am making, just that I am making something that requires it. You will probably see the results of it when Oasis is released (or if you get some screenshots soon). Wraptext does not suffice, as I do not need to wrap the text, I just need to know the length of it.
__________________

subliminal message: 1+1=3

Last edited by Falcor; 11-04-2002 at 11:05 AM..
Reply With Quote
  #9  
Old 11-04-2002, 07:50 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Quote:
Originally posted by Falcor


Nah, you gotta give it a filename.
He was suggesting to add to it so it would work with text, instead of making a whole new command. Don't underestimate the Tyhm...
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #10  
Old 11-05-2002, 04:26 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
** HAPPY MEDIUM TIME **

this.textwidth = 8*int(strlen(#s(this.text)));

works fine for me...
Reply With Quote
  #11  
Old 11-05-2002, 04:42 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
...on fixedwidth fonts
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #12  
Old 11-05-2002, 04:55 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by Tyhm
...on fixedwidth fonts
and on a specific zoom x.x
__________________

Reply With Quote
  #13  
Old 11-05-2002, 10:35 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
this.textwidth = 8*int(strlen(#s(this.text)))*imgzoom;

ha!

and

if you dont use fixedwidth fonts....

i hate you :P

*edit*

FIXEDSYS PWNS YOU ALL!!!
Reply With Quote
  #14  
Old 11-05-2002, 12:09 PM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Quote:
Originally posted by R0bin
this.textwidth = 8*int(strlen(#s(this.text)))*imgzoom;

ha!

and

if you dont use fixedwidth fonts....

i hate you :P

*edit*

FIXEDSYS PWNS YOU ALL!!!
Fixedsys also is very limitied in terms of fontsize.
My advice to you: Don't talk. (or post)
__________________

subliminal message: 1+1=3
Reply With Quote
  #15  
Old 11-05-2002, 12:17 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Its probably better or maybe best to use FixedSys for easy reading. Everyone has it. I try to stay away from really fancy fonts as far as game text goes. You want the player to be able to read the text, right?
__________________
Reply With Quote
  #16  
Old 11-05-2002, 12:46 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
I too like fixed-width fonts. If you don't, though, you could probably do some crazy thing with wraptext2 and tokenscount checking to find the length. Completely inefficient, but you might have no choice.
__________________
Reply With Quote
  #17  
Old 11-05-2002, 09:39 PM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Quote:
Originally posted by Kaimetsu
I too like fixed-width fonts. If you don't, though, you could probably do some crazy thing with wraptext2 and tokenscount checking to find the length. Completely inefficient, but you might have no choice.
I was going to do that, but its not worth the time and preformance loss. I'd rather just have a command for getting the width of it. Is this such a hard command to make or something? *shrugs* I'd use Fixedsys, but its not like I can do many fontsizes with it... Plus it kinda looks ugly and I'd rather use Tempus Sans or Verdana or something more human.
__________________

subliminal message: 1+1=3
Reply With Quote
  #18  
Old 11-05-2002, 10:01 PM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
maybe you could just manually count the pixels in every letter of the font you want to use
Reply With Quote
  #19  
Old 11-06-2002, 12:58 AM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Re: Re: Text Length

Quote:
Originally posted by CheeToS2
just a hunch, but could you tell us what it is you're making? :P
This doesn't address me, but I once wanted to make a radio where the text scrolls through a small window (using changeimgpart), but I failed because I needed to know how long the string is (pixel size) to stop scrolling and start displaying the next string... (or to jump back to the start).
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #20  
Old 11-06-2002, 01:50 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
Quote:
Originally posted by R0bin
maybe you could just manually count the pixels in every letter of the font you want to use
Reply With Quote
  #21  
Old 11-06-2002, 03:22 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Quote:
Originally posted by R0bin
maybe you could just manually count the pixels in every letter of the font you want to use
Oh yes, spend tedius extra time to count the pixels of every single font and every single character. I'm sure that is well worth my time.

Please take my prior advice and just stop posting.
__________________

subliminal message: 1+1=3
Reply With Quote
  #22  
Old 11-06-2002, 12:44 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by Falcor

I'd use Fixedsys, but its not like I can do many fontsizes with it... Plus it kinda looks ugly
Easier to read, though.
__________________
Reply With Quote
  #23  
Old 11-06-2002, 07:43 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
Re: Re: Re: Text Length

Quote:
Originally posted by Com013

This doesn't address me, but I once wanted to make a radio where the text scrolls through a small window (using changeimgpart), but I failed because I needed to know how long the string is (pixel size) to stop scrolling and start displaying the next string... (or to jump back to the start).
This is what the script I posted does. (jumps back to start) Took way to long to figure out how to make it work right.
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
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 03:46 PM.


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