Template XML
Example:
<?xml version="1.0"?>
<root w="500" h="70" image="banner_bg.png">
<image id="guild_logo" x="3" y="3" parent="" posref="TL TL"/>
<text id="name" x="5" y="0" parent="guild_logo" posref="TR TL" color="ABCDEFFF"/>
<text id="txt0" x="0" y="0" parent="" posref="BL BL" size="70" angle="2"
font="tryker.ttf" color="rgb(100,100,255, 100)" shadow="rgb(255,0,0, 127)">S A M P L E</text>
</root>
Root element:
- w="500" h="70" will define output image size
- image="banner_bg.png" will set background image
Child elements:
- image id="guild_logo" will draw guild logo to the x="3" y="3" from output image top left corner.
- text id="name" will draw Character name at the x="5" y="0" position relative to guild_logo TopRight corner.
- text id="txt0" will draw custom text S A M P L E using angle, size, font and semi transparent color with custom shadow color
Root element
- root
- Attributes:
- type - output image type. values png or jpg. default is jpg.
- w and h - output image size in pixels.
- color - background color even if image is set. see color.
- image - background image.
For race and cult specific backgrounds, background image name format is:
- use name_race.png if found (banner_bg_tryker.png)
- fallback to name.png if name_civ.png not found (banner_bg.png)
- use either
- name_cult.png - banner_bg_karavan.png
- name_race_cult.png - banner_bg_tryker_karavan.png
depending if name_race.png was found or not.
NOTE: if image is set to "bg_tryker.png", then race specific name would be "bg_tryker_tryker.png", "bg_tryker_zorai.png", "bg_tryker_zorai_kami.png", etc.
- ryzom_link - will define "www.ryzom.com" location. can be set to TL, TR, BL, BR or empty value to disable it. default is TR
Draw nodes
- text
- <text id="txt0" x="0" y="0" w="200" h="20" size="14">text to display</text>
- for text nodes. Custom text can have defined variables or reserver id's as $var, $name etc.
<text id="name">My name is "{$name}"</text>
Will become
My name is "Apihomin"
- image
- Can draw predefined images like guild_logo, civ_log, cult_logo or custom uploaded image.
extra attributes:
- opacity - range 0 to 100, controls image visibility. 0 means completely transparet and 100 means completely visible
<image id="img0" x="10" y="10" w="200" h="30" parent="" posref="BR BR" opacity="75" >image_file.png</image>
note: image name can only have chars A-Z, numbers 0-9, minus '-', underscore "_" and dot ".". Found $var or ID's will be expanded.
- poly
- can be used to draw filled or non-filled polygons.
extra attributes:
- color - polygon border color
- shadow - polygon fill color. if not set, polygon is not filled
- thickness - polygon border thickness in pixels. range 1 to 50
Childs are 3 or more point nodes with attributes:
- x and y - relative coorinates to posref x/y
- pos - if set to rel, then x/y will be relative to last point. for example <point x="10" y="10" pos="rel"/>
At least 3 points are needed for polygon to work.
Example: This polygon will draw filled rectangle:
<poly id="poly0" parent="root" w="0" h="0" x="0" y="0" posref="ML TL" thickness="5" color="rgb(100,100,255,200)" shadow="rgb(255,0,0,50)">
<point x="10" y="-25"/>
<point x="490" y="-25"/>
<point x="490" y="25"/>
<point x="10" y="25"/>
</poly>
Non-draw nodes
- var
- this will define variable that can be used later in XML.
Can be used to define color for example and later use it on different elements.
<var id="var0">rgb(255,200,100,100)</var>
<var id="var1">rgb(255,200,100,100)</var>
<var id="imf0">file</var>
and later in code
<text id="name" color="$var0" />
<text id="txt0" />Color used is "$var0"</text>
<image id="img0" />image_{$imf0}.png</image>
Variable name can have chars A-Z, numbers 0-9, underscore "_" and colon ":" and later called with simple $var or {$var}
- when, otherwise
- Idea is to allow to control template on the fly based all kind of external data like atys date (night day might have different backgrounds), season, guild member rank etc
- otherwise must be right after when
<when test="$titleid = 'title00079'">
<-- block that is only executed when titleid is title00079 -->
<text id="txt0" x="0" y="0" w="200" h="20" size="14">text to display when title is "title00079"</text>
<text id="txt1" x="0" y="20" w="200" h="20" size="14">more text..."</text>
</when>
<otherwise>
<-- block that is only executed if when test fails -->
<text id="txt0" x="0" y="0" w="200" h="20" size="14">title check failed</text>
</otherwise>
- Can be nested up to 5 levels deep.
- test expression is left_side expr right_side where:
- left_side is var name or one of reserver id's like $var0
- right_side is string value in single quotes. found var/id's are expanded.
- expr is one of
| = | equal |
| != | not-equal |
| > | greater than (>) |
| >= | greater than or equal(>=) |
| < | lower than (<) |
| <= | lower than or equal (<=) |
note: xml does not allow < and > and so they must be written like < >
note2: reserver id's will return slightly different values:
| $titleid | will not be translated and returned as-is |
| $status | online or offline |
| $atys:season | 1=spring, 2=summer, 3=autumn, 4=winter |
| $atys:time | returns number 0-23 (not 00h - 23h) |
| |
| |
| |
Common attributes
- id
- each node should have unique id attribute. It might be useful to have duplicate id's in when/otherwise blocks so nodes after when/otherwise can use them as parent.
reserved id's are:
- name - character's name
- shard - shard name
- guild - guild name if present
- cult - cult name (neutral/kami/karavan)
- civ - civilization name (neutral/tryker/matis/fyros/zorai)
- race - race (tryker/matis/fyros/zorai)
- titleid - translated title if present
- status - online or offline based login/logout dates
- last_seen - last login or logout date formated based language locale settings
- last_seen_status - if user apprears online, then show Online, else show last logout date
- played_time - played time in DD days, HH:MM:SS format ('day'/'days' will be translated if possible)
reserved id's for images are:
- guild_logo - displays guild logo if present
- cult_logo - displays cult logo if present
- civ_logo - displays civ logo if present
reserved id's for translated strings are:
- uiName
- uiGuild
- uiShard
- uiPlayed
- uiLastSeen
- lang- return currently used language (en, fr, de)
for external data
- atys:date - atys date without time
- atys:time - hour (00h) by default
- atys:year - year in 4 digit
- atys:season - current season
- color
- font color - can be RRGGBBAA hex value, or 'rgb(R,G,B,A)' string.
Value can be 0 to 255. for alpha, 0 is completely opaque while 255 completely transparent.
Alpha component component is optional and defaults to 255 if not set.
<text id="name" color="rgb(255,200,100)" />
<text id="name" color="rgb(255,200,100,150)" />
- shadow, shadow_x, shadow_y
- font shadow color - same as color. if unset, defaults back to black. set to empty to disable.
shadow_x and shadow_y attributes control text shadow position. by default they both +1.
- font
- font name - default is 'basic.ttf'. available font names are basic.ttf, bremenb.ttf, ingame.ttf, outgame.ttf, fyros.ttf, matis.ttf, tryker.ttf, zorai.ttf and with UTF8/russian support 'ryzom.ttf'.
- size
- text size - default 10.0. from 0.0 to 100.0
- angle
- text drawing angle - 0.0 to +/-360.0 with default 0
- parent
- parent node ID. if unset, empty or 'root', then full banner image is used. parent node must come before node that depend on it.
- posref
- default is 'TL TL'. need to be pair of:
- TL - top-left
- TR - top-right
- BL - bottom-left
- BR - bottom-right
- ML - middle-left
- MR - middle-right
- MM - middle-center
- TM - top-center
- BM - bottom-center
First is parent, second is node. 'BR TL' will position node's top-left position to parent's bottom-right position.
<text id="name" parent="" posref="TL TL"/>
- x and y
- X and Y will be applied after parent and posref position is found. They can be +/- with output image size as limits
- w and h
- default is 0. if set to 0, then w/h is automatically calculated (except for polygons where w/h will default to 0).
For images, they will be image size, for text depending how much space text takes (depends on font too).
If set, then those values will be used even if 'real' values would be bigger/smaller. For text nodes, 'h' should be set if 'pixel accuracy' with parent is needed.
Example
Day/Night and time of day
A bit long, but quite possible...
<!-- 3-6 = dawn, 6-20 =day, 20-22=twilight, 22-3=night -->
<var id="is_day">false</var>
<var id="time_of_day">night</var>
<when test="$atys:time >= '3'">
<when test="$atys:time < '22'">
<var id="is_day">true</var>
<var id="time_of_day">twilight</var>
<when test="$atys:time < '20'">
<var id="time_of_day">day</var>
</when>
<when test="$atys:time < '6'">
<var id="time_of_day">dawn</var>
</when>
</when>
<!-- otherwise night -->
</when>
<!-- otherwise night -->
<when test="$is_day = 'true'">
<text id="txt0" x="0" y="0" parent="" posref="BL BL">DAY ($time_of_day) : $atys:datetime</text>
</when>
<otherwise>
<text id="txt0" x="0" y="0" parent="" posref="BL BL">NIGHT : $atys:datetime</text>
</otherwise>