-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform_static.dat
233 lines (193 loc) · 7.05 KB
/
form_static.dat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- This file contains the definition of the "static" form for the game system.
The "static" form represents the region at the top of the main window that
is always visible for every actor (hence the term "static"). It's an area of
limited vertical height that spans the entire width of the main window, less
the region needed for the validation button and the dashboard (if visible).
In general, the "static" form should contain the character's name and core
aspects of the character that the user will often want to refer to. However,
there are no hard requirements for what is placed in the "static" form.
NOTE! The unique id of the "static" form is specially recognized by Hero Lab
as the form to be used across the top of the main window. A form with the
id "static" is required within your data files.
-->
<document signature="Hero Lab Data">
<!-- stRace portal
Displays a chooser wherein the user can select the race for the character.
We use the "LargeItem" template for selecting the adjustments, since all we
need is basic information.
The "chosen" script shows the selected race with a suitable prefix. If no
race is yet selected, a prompt it shown with appropriate color highlighting.
<portal
id="stRace"
style="chsNormal"
width="110">
<chooser_table
component="Archetype"
choosetemplate="LargeItem">
<chosen><![CDATA[
if (@ispick = 0) then
@text = "{text clrwarning}Select Archetype"
else
@text = "Archetype: " & field[name].text
endif
]]></chosen>
<titlebar><![CDATA[
@text = "Choose the race for your character"
]]></titlebar>
</chooser_table>
</portal>
-->
<!-- stName template
This template displays the character name and a label to prefix it.
-->
<template
id="stName"
name="Static Panel Name"
compset="useredit">
<portal
id="master"
style="actMaster"
tiptext="Click this button to activate this ally's Master.">
<action
action="master">
</action>
</portal>
<portal
id="label"
style="lblStatic">
<label
text="Name:">
</label>
</portal>
<portal
id="edit"
style="editNormal">
<edit
field="useredit">
</edit>
</portal>
<position><![CDATA[
~only show the master button if the actor is a minion
portal[master].visible = hero.isminion
if (portal[master].visible <> 0) then
perform portal[label].alignrel[ltor,master,8]
endif
~center the label veritcally on the edit portal
perform portal[label].centeron[vert,edit]
~size and position the edit portal next to the label
perform portal[edit].alignrel[ltor,label,6]
portal[edit].width = 175
~our dimensions are the extent of our portals
height = portal[edit].bottom
width = portal[edit].right
]]></position>
</template>
<!-- stActor template
This template displays all the basic state information for the actor, such
as health, power, character points, and cash.
-->
<template
id="stActor"
name="Static Actor"
compset="Actor">
<portal
id="hp"
style="lblStatic">
<label>
<labeltext><![CDATA[
@text = "HP: " & herofield[acWoundSumm].text
]]></labeltext>
</label>
</portal>
<portal
id="cp"
style="lblStatic">
<label>
<labeltext><![CDATA[
@text = "XP: " & hero.child[resXP].field[resShort].text
]]></labeltext>
</label>
</portal>
<portal
id="cash"
style="lblStatic">
<label>
<labeltext><![CDATA[
var moneyvalue as number
var money as string
moneyvalue = herofield[acCashNet].value
call Money
@text = "Cash: " & money
]]></labeltext>
</label>
</portal>
<position><![CDATA[
~all portals are text in the same style, and we set the template height based
~on the height of one of the portals, so vertical alignment can be ignored
~position the portals horizontally
portal[hp].left = 0
perform portal[cp].alignrel[ltor,hp,15]
perform portal[cash].alignrel[ltor,cp,15]
~hide any portals that don't fully fit within the visible horizontal space
if (portal[cp].right > width) then
portal[cp].visible = 0
endif
if (portal[cash].right > width) then
portal[cash].visible = 0
endif
~our height is the bottommost extent of our portals
height = portal[cash].bottom
]]></position>
</template>
<!-- static layout
This layout consists of the character's name, race, and status info, which
are laid out in a ribbon across the top.
-->
<layout
id="static">
<templateref template="stName" thing="heroname" taborder="10"/>
<templateref template="stActor" thing="actor"/>
<!-- This script sizes and positions the layout and its child visual elements. -->
<position><![CDATA[
~position the name template on the left, with a little margin, then render it
~to generate the appropriate dimensions
template[stName].left = 10
perform template[stName].render
~position the race portal to the right of the name, with the actor template
~a little to the right of the race
~portal[stRace].left = template[stName].right + 20
~template[stActor].left = portal[stRace].right + 15
template[stActor].left = template[stName].right + 20
~limit the width of the actor template to the remaining space available and
~then render the template
template[stActor].width = width - template[stActor].left
perform template[stActor].render
~center all visual elements vertically
~Note: We can't do this until after we've calculated the heights for both
~ templates, which is done when we render them.
~portal[stRace].top = (height - portal[stRace].height) / 2
template[stName].top = (height - template[stName].height) / 2
template[stActor].top = (height - template[stActor].height) / 2
]]></position>
</layout>
<!-- static form
This is the "static" form shown at the top of the main window within Hero
Lab.
NOTE! The unique id of this form is specially recognized by Hero Lab as
the form to be used across the top of the main window. A form with this
id is required within your data files.
NOTE! By default, this form is 40 pixels in height, and it must always be
set to be at least 40 pixels in height.
-->
<form
id="static"
name="Static">
<layoutref layout="static"/>
<position><![CDATA[
~we only want to use 20 pixels of height and we want it centered vertically
layout[static].height = 20
layout[static].top = (height - layout[static].height) / 2
]]></position>
</form>
</document>