PDA

View Full Version : Simple Default Text Alignment?



Ranzarok
August 2nd, 2020, 22:33
This seems like it should be fairly simple to do, but I'm stumbling with it.

I would like to get the <Default> text in a template to align to the right. I've tried using offset, the font tag, even html markup in the text to no avail. Any advice would be appreciated.

Picture of what I have...wanting to align text to the right. The circle and the bar are two separate frames.

38281

Related code below:


<!-- template for horz bar background with default "sanity" text -->
<template name="saves_label">
<label>
<frame mergerule="replace" name="statframe_rt_ms" offset="0,0,0,0" />
<static />
<disabled />
<tooltip />
<anchored position="belowleft" offset="10,12" width="91" height="38" />
</label>
</template>

<!-- circle number box -->
<template name="number_saves">
<basicnumbernh_ms>
<frame mergerule="replace" name="statbox_rt_ms" offset="0,0,0,0" />
<tooltip><text>Click to Edit.</text></tooltip>
<anchored position="belowleft" offset="0,12" width="38" height="38" />
</basicnumbernh_ms>
</template>

<!-- Frame for horz bar with default tex -->
<framedef name="statframe_rt_ms">
<bitmap file="graphics/frames/statlabelbg_r_ms.png" />
<offset>0,0,0,0</offset>
</framedef>

<!-- Character Saves -->
<saves_label name="label_sanity">
<anchored to="charstats" position="insidetopleft" offset="250,35" />
<default>SANITY</default>
</saves_label>

<number_saves name="sanity" >
<anchored to="charstats" position="insidetopleft" offset="341,35" />
<tooltip textres="" />
</number_saves>

damned
August 2nd, 2020, 22:52
define the number first and then anchor to the number

Ranzarok
August 2nd, 2020, 22:56
Thanks, I will give it a shot.

Ranzarok
August 2nd, 2020, 23:06
Gave it a shot, getting the same result unless I misunderstood your suggestion.

38282

Here is the new code


<!-- Character Saves -->

<number_saves name="sanity" >
<anchored to="charstats" position="insidetopleft" offset="341,35" />
<tooltip textres="" />
</number_saves>

<saves_label name="label_sanity">
<anchored to="sanity" position="insidetopleft" offset="-91,0" />
<default>SANITY</default>
</saves_label>

damned
August 2nd, 2020, 23:15
try something like this:

<anchored to="sanity">
<top />
<right anchor="left" relation="relative" offset="-5" />
</anchored>

i have to trial and error my anchors a lot but I think you want to anchor to an object "right"
its very likely my example is not correct but try some others in that direction

Ranzarok
August 3rd, 2020, 00:05
Thanks damned. Played around with the anchors and got it to work, but decided to go with a string label instead of the default tag for the element. I guess the string would be better for future localization and the like anyway?

This is what I have now and how it looks:
38284



<!-- Character Saves -->

<saves_label name="label_sanity">
<anchored to="charstats" position="insidetopleft" offset="250,35" />
</saves_label>

<string_label name="char_saves_sanity">
<anchored to="charstats" position="insidetopleft" offset="292,44" />
<default>SANITY</default>
</string_label>

<number_saves name="sanity" >
<anchored to="charstats" position="insidetopleft" offset="341,35" />
<tooltip textres="" />
</number_saves>