SphereCommunity
dynamic gump text question. - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: dynamic gump text question. (/Thread-dynamic-gump-text-question)



dynamic gump text question. - amonvangrell - 05-02-2014 05:05 PM

Hi guys, I need help.

I'm doing this gump.
Code:
[DIALOG d_props]
50,50
resizepic 124 44 9200 226 96//grey
gumppictiled 137 59 198 67 9274//blue
gumppictiled 138 60 70 21 3004//white1
gumppictiled 209 60 95 21 3004//white2
button 314 63 5601 5605 0 1 1 1//button
dtext 142 60 0 Item Name
dtext 220 60 0 <tag0.name>
gumppictiled 138 82 70 21 3004//white1
gumppictiled 209 82 95 21 3004//white2
dtext 142 83 0 Item ID
dtext 220 83 0 <tag0.ID>
gumppictiled 138 104 70 21 3004//white1
gumppictiled 209 104 95 21 3004//white2
dtext 142 105 0 Item Pos
dtext 220 105 0 <tag0.P>

My question is related to <tag0.name>, when the tag name is too big the text end up passing the gump limits....

its there a way to show x amount of characters on this dtext?

like
Code:
dtext <x> <y> <color> "<max number of chars>" <text>
And also how can I make a gump that stretches it size according to the values of tags.... like this name tag...

thanks


RE: dynamic gump text question. - XuN - 05-02-2014 05:36 PM

if (STRLEN(<tag.bla>)> 35)
dtext x y color <strsub 0 35 <tag.bla>>
endif


RE: dynamic gump text question. - amonvangrell - 05-02-2014 06:22 PM

thanks XuN, I know that for you this is a ridiculous question but it makes a big difference for me.
Btw what about the gump itself... anyway to make it dynamic too?


RE: dynamic gump text question. - Alaric - 05-02-2014 06:22 PM

I use cropped text.

Code:
dcroppedtext x y width height colour text

Set the boundaries inside your gump and if it goes behind the boundaries, it hides the rest of the text. "Fades".


RE: dynamic gump text question. - amonvangrell - 05-02-2014 06:45 PM

Thanks Alaric!
This gump section in the tutorial is so no much helpful... i got so confused.
The gump itself cannot be stretched can it?


RE: dynamic gump text question. - Alaric - 05-02-2014 06:58 PM

What do you mean? Setting the gumps size acording to the longest name or so?

Or bigger spaces between letters? - This one is almost impossible, you would have to put letter by letter and change their position by x pixels.
Gump size - calculating everything makes it dynamic. Checking the longest name and evaluating the size of gump etc.


RE: dynamic gump text question. - amonvangrell - 05-05-2014 08:15 AM

Thanks for the reply Alaric, I'm asking the second option.
Can u help me by showing an example!? thx!


RE: dynamic gump text question. - Alaric - 05-05-2014 08:47 AM

The cropped text?


[dialog ddd]
0,0
resizepic 100 100 01400 670 350
dcroppedtext 115 180 150 20 100 This is a very long text and it won't go behind the boundaries.

x = 115
y = 180
x-sizeoftheblock = 150
y-sizeoftheblock = 20 (20 is height of a common text)
colour = 100


E: That probably is not what you mean, I'm lost.
I'm really trying!!! I read the whole thread like 10 times.


RE: dynamic gump text question. - Coruja - 05-05-2014 11:30 AM

you must adjust the dialog background width/height based on your text length
almost impossible to get a 100% perfectly align since texts length may vary (both "iiiiiiiiiiiiiii" and "wwwwwwwwwwwwwww" has the same length of 15 characters). Most of times the background won't resize perfectly but it works

something like this
Code:
resizepic 0 0 100 <eval (STRLEN(<TAG.A>)/100)*20> 3000



RE: dynamic gump text question. - amonvangrell - 05-06-2014 08:58 AM

thanks guys, tomorrow Ill try your guys suggestions.

Big Grin