TickHook: Fix crash when TickHook isn't set.
[gemrb.git] / gemrb / GUIScripts / bg2 / GUIOPT10.py
blob2accde330ca3e1f175d4b74693ae67de0665160e
1 # GemRB - Infinity Engine Emulator
2 # Copyright (C) 2003 The GemRB Project
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #autopause
20 import GemRB
22 def OnLoad():
23 global AutoPauseWindow, TextAreaControl
25 GemRB.LoadWindowPack("GUIOPT", 640, 480)
27 AutoPauseWindow = GemRB.LoadWindow(10)
28 TextAreaControl = AutoPauseWindow.GetControl(15)
30 ChHitButton = AutoPauseWindow.GetControl(17)
31 ChHitButtonB = AutoPauseWindow.GetControl(1)
33 ChInjured = AutoPauseWindow.GetControl(18)
34 ChInjuredB = AutoPauseWindow.GetControl(2)
36 ChDeath = AutoPauseWindow.GetControl(19)
37 ChDeathB = AutoPauseWindow.GetControl(3)
39 ChAttacked = AutoPauseWindow.GetControl(20)
40 ChAttackedB = AutoPauseWindow.GetControl(4)
42 WeaponUnusable = AutoPauseWindow.GetControl(21)
43 WeaponUnusableB = AutoPauseWindow.GetControl(5)
45 TargetDestroyed = AutoPauseWindow.GetControl(22)
46 TargetDestroyedB = AutoPauseWindow.GetControl(13)
48 EndOfRound = AutoPauseWindow.GetControl(24)
49 EndOfRoundB = AutoPauseWindow.GetControl(25)
51 EnemySighted = AutoPauseWindow.GetControl(27)
52 EnemySightedB = AutoPauseWindow.GetControl(26)
54 SpellCast = AutoPauseWindow.GetControl(30)
55 SpellCastB = AutoPauseWindow.GetControl(34)
57 TrapFound = AutoPauseWindow.GetControl(33)
58 TrapFoundB = AutoPauseWindow.GetControl(31)
60 AutopauseCenter = AutoPauseWindow.GetControl(36)
61 AutopauseCenterB = AutoPauseWindow.GetControl(37)
63 OkButton = AutoPauseWindow.GetControl(11)
64 CancelButton = AutoPauseWindow.GetControl(14)
65 TextAreaControl.SetText(18044)
66 OkButton.SetText(11973)
67 CancelButton.SetText(13727)
69 ChHitButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChHitButtonPress)
70 ChHitButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
71 ChHitButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChHitButtonPress)
73 ChInjured.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChInjuredPress)
74 ChInjuredB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
75 ChInjuredB.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChInjuredPress)
77 ChDeath.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChDeathPress)
78 ChDeathB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
79 ChDeathB.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChDeathPress)
81 ChAttacked.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChAttackedPress)
82 ChAttackedB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
83 ChAttackedB.SetEvent(IE_GUI_BUTTON_ON_PRESS, ChAttackedPress)
85 WeaponUnusable.SetEvent(IE_GUI_BUTTON_ON_PRESS, WeaponUnusablePress)
86 WeaponUnusableB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
87 WeaponUnusableB.SetEvent(IE_GUI_BUTTON_ON_PRESS, WeaponUnusablePress)
89 TargetDestroyed.SetEvent(IE_GUI_BUTTON_ON_PRESS, TargetDestroyedPress)
90 TargetDestroyedB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
91 TargetDestroyedB.SetEvent(IE_GUI_BUTTON_ON_PRESS, TargetDestroyedPress)
93 EndOfRound.SetEvent(IE_GUI_BUTTON_ON_PRESS, EndOfRoundPress)
94 EndOfRoundB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
95 EndOfRoundB.SetEvent(IE_GUI_BUTTON_ON_PRESS, EndOfRoundPress)
97 EnemySighted.SetEvent(IE_GUI_BUTTON_ON_PRESS, EnemySightedPress)
98 EnemySightedB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
99 EnemySightedB.SetEvent(IE_GUI_BUTTON_ON_PRESS, EnemySightedPress)
101 SpellCast.SetEvent(IE_GUI_BUTTON_ON_PRESS, SpellCastPress)
102 SpellCastB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
103 SpellCastB.SetEvent(IE_GUI_BUTTON_ON_PRESS, SpellCastPress)
105 TrapFound.SetEvent(IE_GUI_BUTTON_ON_PRESS, TrapFoundPress)
106 TrapFoundB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
107 TrapFoundB.SetEvent(IE_GUI_BUTTON_ON_PRESS, TrapFoundPress)
109 AutopauseCenter.SetEvent(IE_GUI_BUTTON_ON_PRESS, AutopauseCenterPress)
110 AutopauseCenterB.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
111 AutopauseCenterB.SetEvent(IE_GUI_BUTTON_ON_PRESS, AutopauseCenterPress)
113 OkButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OkPress)
114 OkButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
115 CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
116 CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
118 AutopauseCenterB.SetVarAssoc("Auto Pause Center",1)
120 ChHitButtonB.SetVarAssoc("Auto Pause State",1)
121 ChInjuredB.SetVarAssoc("Auto Pause State",2)
122 ChDeathB.SetVarAssoc("Auto Pause State",4)
123 ChAttackedB.SetVarAssoc("Auto Pause State",8)
124 WeaponUnusableB.SetVarAssoc("Auto Pause State",16)
125 TargetDestroyedB.SetVarAssoc("Auto Pause State",32)
126 EndOfRoundB.SetVarAssoc("Auto Pause State",64)
127 EnemySightedB.SetVarAssoc("Auto Pause State",128)
128 SpellCastB.SetVarAssoc("Auto Pause State",256)
129 TrapFoundB.SetVarAssoc("Auto Pause State",512)
131 AutoPauseWindow.SetVisible(WINDOW_VISIBLE)
132 return
134 def ChHitButtonPress():
135 TextAreaControl.SetText(18032)
136 return
138 def ChInjuredPress():
139 TextAreaControl.SetText(18033)
140 return
142 def ChDeathPress():
143 TextAreaControl.SetText(18034)
144 return
146 def ChAttackedPress():
147 TextAreaControl.SetText(18035)
148 return
150 def WeaponUnusablePress():
151 TextAreaControl.SetText(18036)
152 return
154 def TargetDestroyedPress():
155 TextAreaControl.SetText(18037)
156 return
158 def EndOfRoundPress():
159 TextAreaControl.SetText(10640)
160 return
162 def EnemySightedPress():
163 TextAreaControl.SetText(23514)
164 return
166 def SpellCastPress():
167 TextAreaControl.SetText(58171)
168 return
170 def TrapFoundPress():
171 TextAreaControl.SetText(31872)
172 return
174 def AutopauseCenterPress():
175 TextAreaControl.SetText(10571)
176 return
178 def OkPress():
179 if AutoPauseWindow:
180 AutoPauseWindow.Unload()
181 GemRB.SetNextScript("GUIOPT8")
182 return
184 def CancelPress():
185 if AutoPauseWindow:
186 AutoPauseWindow.Unload()
187 GemRB.SetNextScript("GUIOPT8")
188 return