T_ScObj_CardHortBox
Tamriel_Data.esm
Variables
4
Local Variables
hasCards
control
button
activateMe
Source
1Begin T_ScObj_CardHortBox
2
3short hasCards
4short control
5short button
6short activateMe
7
8if ( CellChanged )
9 ; reset on cellchange
10 Set T_Glob_CardHortState to 0
11 Set T_Glob_CardHortTop to 0
12 Set T_Glob_CardHortTracker to 0
13 set T_Glob_CardHortActiveLen to 0
14 set control to 0
15 Return
16endif
17
18if ( control >= 3 )
19 ; setup
20 if ( control == 3 )
21 set control to 4
22 PlaySound "T_SndObj_TileDown"
23 Set T_Glob_CardHortState to 1
24 PlaceAtMe T_De_CardHortSpawn 1 45 3
25 elseif ( control == 4 )
26 if ( T_Glob_CardHortState >= 6 )
27 set control to 0
28 endif
29 endif
30 Return
31elseif ( control == -1 )
32 set control to 0
33 PlaySound "T_SndObj_TileUp"
34 set T_Glob_CardHortState to 0
35 set T_Glob_CardHortTracker to 0
36 set T_Glob_CardHortTop to 0
37 set T_Glob_CardHortActiveLen to 0
38 Return
39elseif ( control > 0 )
40 set button to GetButtonPressed
41 if ( button == -1 )
42 Return
43 elseif ( button == 0 )
44 if ( control == 1 )
45 set activateMe to 1
46 set control to 0
47 else
48 set control to -1
49 endif
50 elseif ( button == 1 )
51 if ( control == 1 )
52 set control to 3
53 else
54 set control to 0
55 endif
56 endif
57 Return
58endif
59
60if ( MenuMode )
61 Return
62endif
63
64if ( OnActivate == 1 )
65
66 if ( T_Glob_CardHortTop <= -10 )
67 set control to 2
68 MessageBox "You have won the game! Clean up?" "Yes" "No"
69 Return
70 elseif ( T_Glob_CardHortState > 0 )
71 set control to 2
72 MessageBox "Abandon game?" "Yes" "No"
73 Return
74 endif
75
76 set hasCards to 0
77 if ( GetItemCount T_De_CardMiscDres_01 > 0 )
78 set hasCards to ( hasCards + 1 )
79 endif
80 if ( GetItemCount T_De_CardMiscDres_02 > 0 )
81 set hasCards to ( hasCards + 1 )
82 endif
83 if ( GetItemCount T_De_CardMiscDres_03 > 0 )
84 set hasCards to ( hasCards + 1 )
85 endif
86 if ( GetItemCount T_De_CardMiscDres_04 > 0 )
87 set hasCards to ( hasCards + 1 )
88 endif
89 if ( GetItemCount T_De_CardMiscDres_05 > 0 )
90 set hasCards to ( hasCards + 1 )
91 endif
92 if ( GetItemCount T_De_CardMiscDres_06 > 0 )
93 set hasCards to ( hasCards + 1 )
94 endif
95 if ( GetItemCount T_De_CardMiscInd_01 > 0 )
96 set hasCards to ( hasCards + 1 )
97 endif
98 if ( GetItemCount T_De_CardMiscInd_02 > 0 )
99 set hasCards to ( hasCards + 1 )
100 endif
101 if ( GetItemCount T_De_CardMiscInd_03 > 0 )
102 set hasCards to ( hasCards + 1 )
103 endif
104 if ( GetItemCount T_De_CardMiscInd_04 > 0 )
105 set hasCards to ( hasCards + 1 )
106 endif
107 if ( GetItemCount T_De_CardMiscInd_05 > 0 )
108 set hasCards to ( hasCards + 1 )
109 endif
110 if ( GetItemCount T_De_CardMiscInd_06 > 0 )
111 set hasCards to ( hasCards + 1 )
112 endif
113 if ( GetItemCount T_De_CardMiscHla_01 > 0 )
114 set hasCards to ( hasCards + 1 )
115 endif
116 if ( GetItemCount T_De_CardMiscHla_02 > 0 )
117 set hasCards to ( hasCards + 1 )
118 endif
119 if ( GetItemCount T_De_CardMiscHla_03 > 0 )
120 set hasCards to ( hasCards + 1 )
121 endif
122 if ( GetItemCount T_De_CardMiscHla_04 > 0 )
123 set hasCards to ( hasCards + 1 )
124 endif
125 if ( GetItemCount T_De_CardMiscHla_05 > 0 )
126 set hasCards to ( hasCards + 1 )
127 endif
128 if ( GetItemCount T_De_CardMiscHla_06 > 0 )
129 set hasCards to ( hasCards + 1 )
130 endif
131 if ( GetItemCount T_De_CardMiscRed_01 > 0 )
132 set hasCards to ( hasCards + 1 )
133 endif
134 if ( GetItemCount T_De_CardMiscRed_02 > 0 )
135 set hasCards to ( hasCards + 1 )
136 endif
137 if ( GetItemCount T_De_CardMiscRed_03 > 0 )
138 set hasCards to ( hasCards + 1 )
139 endif
140 if ( GetItemCount T_De_CardMiscRed_04 > 0 )
141 set hasCards to ( hasCards + 1 )
142 endif
143 if ( GetItemCount T_De_CardMiscRed_05 > 0 )
144 set hasCards to ( hasCards + 1 )
145 endif
146 if ( GetItemCount T_De_CardMiscRed_06 > 0 )
147 set hasCards to ( hasCards + 1 )
148 endif
149 if ( GetItemCount T_De_CardMiscTel_01 > 0 )
150 set hasCards to ( hasCards + 1 )
151 endif
152 if ( GetItemCount T_De_CardMiscTel_02 > 0 )
153 set hasCards to ( hasCards + 1 )
154 endif
155 if ( GetItemCount T_De_CardMiscTel_03 > 0 )
156 set hasCards to ( hasCards + 1 )
157 endif
158 if ( GetItemCount T_De_CardMiscTel_04 > 0 )
159 set hasCards to ( hasCards + 1 )
160 endif
161 if ( GetItemCount T_De_CardMiscTel_05 > 0 )
162 set hasCards to ( hasCards + 1 )
163 endif
164 if ( GetItemCount T_De_CardMiscTel_06 > 0 )
165 set hasCards to ( hasCards + 1 )
166 endif
167
168 if ( hasCards == 30 )
169 set control to 1
170 MessageBox "The box contains a complete deck of cards." "Open the box" "Play Hortator"
171 Return
172 else
173 set activateMe to 1
174 endif
175
176endif
177
178if ( activateMe == 1 )
179 set activateMe to 0
180 Activate
181endif
182
183End