./hud_qte.lua

  1. --Document handle 
  2. Hud_qte_key_doc_h = 0 
  3.  
  4. -- handles 
  5. Hud_qte_btn_1_grp_h = 0 
  6. Hud_qte_btn_1_h = 0 
  7. Hud_qte_btn_2_h = 0 
  8. Hud_qte_sticks_grp_h = 0 
  9. Hud_qte_stick_pad_h = 0 
  10. Hud_qte_stick_base_h = 0 
  11. Hud_qte_stick_arrow_h = 0 
  12. Hud_qte_stick_label_h = 0 
  13. Hud_qte_success_grp_h = 0 
  14. Hud_qte_kb_grp_h = 0 
  15. Hud_qte_mouse_grp_h = 0 
  16.  
  17. --QTE Vdo Objects 
  18. Hud_qte_kb_key = 0 
  19.  
  20.  
  21. -- button_index values 
  22. HUD_QTE_BTN_HIDDEN 	= -1 
  23. HUD_QTE_BTN_A 			= 0 
  24. HUD_QTE_BTN_X 			= 1 
  25. HUD_QTE_BTN_Y 			= 2 
  26. HUD_QTE_BTN_LT 		= 3 
  27. HUD_QTE_BTN_RT 		= 4 
  28. HUD_QTE_STICK_UP		= 5 
  29. HUD_QTE_STICK_DOWN	= 6 
  30. HUD_QTE_STICK_RIGHT	= 7 
  31. HUD_QTE_STICK_LEFT	= 8 
  32.  
  33. -- button_animation values 
  34. HUD_QTE_ANIM_NONE							= -1 
  35. HUD_QTE_ANIM_MASH_STANDARD				= 0 
  36. HUD_QTE_ANIM_MASH_FAST					= 1 
  37. HUD_QTE_ANIM_ALTERNATE_TRIGGERS		= 2 
  38.  
  39. -- storage 
  40. Hud_qte_prev_btn = 0 
  41. Hud_qte_prev_anim = 0 
  42.  
  43. --Mouse key inputs... 
  44. local MOUSE_KEY_INVALID 	= -1 
  45. local MOUSE_KEY_LEFT 		= 0 
  46. local MOUSE_KEY_MIDDLE 		= 1 
  47. local MOUSE_KEY_RIGHT 		= 2 
  48. local MOUSE_KEY_4 			= 3 
  49. local MOUSE_KEY_5 			= 4 
  50. local MOUSE_KEY_WHEEL_UP 	= 5 
  51. local MOUSE_KEY_WHEEL_DOWN	= 6 
  52. 				 
  53. --mouse highlights... 
  54. local Hud_qte_mouse_highlights = { 
  55. 	[MOUSE_KEY_LEFT] 			= "ui_qte_mouse_0", 
  56. 	[MOUSE_KEY_MIDDLE] 		= "ui_qte_mouse_2", 
  57. 	[MOUSE_KEY_RIGHT] 		= "ui_qte_mouse_1", 
  58. 	[MOUSE_KEY_4] 				= "ui_qte_mouse_base_highlight", 
  59. 	[MOUSE_KEY_5] 				= "ui_qte_mouse_base_highlight", 
  60. 	[MOUSE_KEY_WHEEL_UP] 	= "ui_qte_mouse_scroll_up", 
  61. 	[MOUSE_KEY_WHEEL_DOWN] 	= "ui_qte_mouse_scroll_down", 
  62. } 
  63.  
  64. --mouse icons... 
  65. local Hud_qte_mouse_icons = { 
  66. 	[MOUSE_KEY_LEFT] 			= "ui_qte_mouse_fluer", 
  67. 	[MOUSE_KEY_MIDDLE] 		= "ui_qte_mouse_fluer", 
  68. 	[MOUSE_KEY_RIGHT] 		= "ui_qte_mouse_fluer", 
  69. 	[MOUSE_KEY_4] 				= "ui_qte_mouse_3", 
  70. 	[MOUSE_KEY_5] 				= "ui_qte_mouse_5", 
  71. 	[MOUSE_KEY_WHEEL_UP] 	= "ui_qte_mouse_fluer", 
  72. 	[MOUSE_KEY_WHEEL_DOWN] 	= "ui_qte_mouse_fluer", 
  73. } 
  74. Hud_qte_mouse_success_bitmaps = {} 
  75. Hud_qte_mouse_success_anims = {} 
  76.  
  77. function hud_qte_init() 
  78. 	Hud_qte_key_doc_h = vint_document_find("hud_qte") 
  79. 	 
  80. 	-- assign handles 
  81. 	Hud_qte_btn_1_grp_h = vint_object_find("btn_1_grp") 
  82. 	Hud_qte_btn_1_h = vint_object_find("btn_1")		 
  83. 	Hud_qte_btn_2_h = vint_object_find("btn_2") 
  84. 	 
  85. 	Hud_qte_sticks_grp_h 	= vint_object_find("qte_sticks_grp") 
  86. 	Hud_qte_stick_pad_h 		= vint_object_find("stick_pad") 
  87. 	Hud_qte_stick_base_h 	= vint_object_find("stick_base_bmp") 
  88. 	Hud_qte_stick_arrow_h 	= vint_object_find("stick_arrow") 
  89. 	Hud_qte_stick_label_h 	= vint_object_find("stick_label") 
  90. 	Hud_qte_kb_grp_h 			= vint_object_find("qte_keyboard_grp") 
  91. 	Hud_qte_kb_key 			= Vdo_qte_key:new("qte_key", 0, Hud_qte_key_doc_h) 
  92. 	Hud_qte_mouse_grp_h 		= vint_object_find("qte_mouse_grp") 
  93. 	 
  94. 	 
  95. 	Hud_qte_success_grp_h 	= vint_object_find("qte_success_grp") 
  96.  
  97. 	-- set animation loops for QTE's 
  98. 	local btn_1_off_standard_twn_h = vint_object_find("btn_1_off_standard") 
  99. 	local btn_1_off_fast_twn_h 	= vint_object_find("btn_1_off_fast") 
  100. 	local stick_pressed_twn_h 		= vint_object_find("stick_pressed_twn") 
  101. 	vint_set_property(btn_1_off_standard_twn_h, "end_event", "vint_anim_loop_callback")		 
  102. 	vint_set_property(btn_1_off_fast_twn_h, "end_event", "vint_anim_loop_callback")		 
  103. 	vint_set_property(stick_pressed_twn_h, "end_event", "vint_anim_loop_callback")		 
  104. 	 
  105. 	-- subscription 
  106. 	vint_dataitem_add_subscription("hud_qte", "update", "hud_qte_update") 
  107. end 
  108.  
  109. function hud_qte_update(di_h, event) 
  110. 	local button_index, button_animation, x, y, is_ps3, kbm_name, success, mouse_button_number = vint_dataitem_get(di_h) 
  111. 	 
  112. 	-- set button group position 
  113. 	vint_set_property(Hud_qte_btn_1_grp_h, 	"anchor", x, y)		 
  114. 	vint_set_property(Hud_qte_sticks_grp_h, 	"anchor", x, y)		 
  115. 	vint_set_property(Hud_qte_success_grp_h, 	"anchor", x, y)		 
  116. 	vint_set_property(Hud_qte_kb_grp_h, 		"anchor", x, y) 
  117. 	vint_set_property(Hud_qte_mouse_grp_h, 	"anchor", x, y) 
  118. 	 
  119. 	-- determine button visibility 
  120. 	vint_set_property(Hud_qte_btn_1_h, "visible", false) 
  121. 	vint_set_property(Hud_qte_btn_2_h, "visible", false) 
  122. 	vint_set_property(Hud_qte_sticks_grp_h, "visible", false) 
  123. 	vint_set_property(Hud_qte_success_grp_h, "visible", false) 
  124.  
  125. 	vint_set_property(Hud_qte_kb_grp_h, "visible", false) 
  126. 	vint_set_property(Hud_qte_mouse_grp_h, "visible", false) 
  127. 	 
  128. 	if (button_index ~= HUD_QTE_BTN_HIDDEN) then  
  129. 		if game_is_active_input_gamepad() == false then 
  130. 			--determine if mouse or key... 
  131. 			if mouse_button_number == -1 then 
  132. 				--Show the keyboard key... 
  133. 				vint_set_property(Hud_qte_kb_grp_h, "visible", true) 
  134. 				 
  135. 				--Set text... 
  136. 				Hud_qte_kb_key:set_text(kbm_name) 
  137. 				 
  138. 				--Trigger animation... 
  139. 				Hud_qte_kb_key:mash(button_animation) 
  140. 				 
  141. 				--Center QTE 
  142. 				local width = Hud_qte_kb_key:get_width() 
  143. 				local x, y = vint_get_property(Hud_qte_kb_key.handle, "anchor") 
  144. 				vint_set_property(Hud_qte_kb_key.handle, "anchor", -width * .5, y) 
  145. 				 
  146. 				--Play succes animation? 
  147. 				Hud_qte_kb_key:success(success) 
  148. 			else 
  149.  
  150. 				--Show mouse 
  151. 				vint_set_property(Hud_qte_mouse_grp_h, "visible", true) 
  152. 				 
  153. 				--Update buttons 
  154. 				local mouse_highlight_h = vint_object_find("mouse_highlight") 
  155. 				local mouse_icon_h = vint_object_find("mouse_icon") 
  156. 				 
  157. 				local mouse_highlight = Hud_qte_mouse_highlights[mouse_button_number] 
  158. 				local mouse_icon = Hud_qte_mouse_icons[mouse_button_number] 
  159. 				vint_set_property(mouse_highlight_h, "image", mouse_highlight) 
  160. 				vint_set_property(mouse_icon_h, "image", mouse_icon) 
  161.  
  162. 				if	(button_animation == HUD_QTE_ANIM_NONE) then 		 
  163. 					hud_qte_pause_all() 
  164. 					vint_set_property(mouse_highlight_h, "alpha", 0) 
  165. 				elseif (button_animation == HUD_QTE_ANIM_MASH_STANDARD or button_animation == HUD_QTE_ANIM_MASH_FAST) then 
  166. 					lua_play_anim(vint_object_find("mouse_mash_standard_anim")) 
  167. 				end 
  168. 				 
  169. 				local mouse_success_anim_h = vint_object_find("mouse_success_anim") 
  170. 				local mouse_success_h = vint_object_find("mouse_success") 
  171. 				vint_set_property(mouse_success_h, "alpha", 0) 
  172. 				 
  173. 				if #Hud_qte_mouse_success_bitmaps ~= 0 then 
  174. 					for i = 1, #Hud_qte_mouse_success_bitmaps do 
  175. 						vint_object_destroy(Hud_qte_mouse_success_bitmaps[i]) 
  176. 						vint_object_destroy(Hud_qte_mouse_success_anims[i]) 
  177. 					end 
  178. 					Hud_qte_mouse_success_bitmaps = {} 
  179. 					Hud_qte_mouse_success_anims = {} 
  180. 				end 
  181. 				 
  182. 				if success then 
  183. 					--create mouse success items 
  184. 					for i = 1, 4 do 
  185. 						Hud_qte_mouse_success_bitmaps[i] = vint_object_clone(mouse_success_h) 
  186. 						Hud_qte_mouse_success_anims[i] = vint_object_clone(mouse_success_anim_h) 
  187. 						vint_set_property(Hud_qte_mouse_success_anims[i], "target_handle", Hud_qte_mouse_success_bitmaps[i]) 
  188. 						lua_play_anim(Hud_qte_mouse_success_anims[i], (i - 1) * .1) 
  189. 					end 
  190. 					vint_set_property(mouse_highlight_h, "visible", false) 
  191. 				else 
  192. 					vint_set_property(mouse_highlight_h, "visible", true) 
  193. 				end 
  194. 			end 
  195. 		else 
  196. 			--Show buttons if index is lower than the stick indexes... 
  197. 			if button_index < HUD_QTE_STICK_UP then 
  198. 				vint_set_property(Hud_qte_btn_1_h, "visible", true) 
  199. 				-- if animation exists make second image visible 
  200. 				if (button_animation ~= HUD_QTE_ANIM_NONE) then 
  201. 					vint_set_property(Hud_qte_btn_2_h, "visible", true) 
  202. 				end		 
  203. 			end 
  204. 			 
  205. 			--Adjust stuff if button_index is a stick... 
  206. 			if (button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then 
  207. 				--Uses stick index so show stick and adjust settings accordingly... 
  208. 				vint_set_property(Hud_qte_sticks_grp_h, "visible", true) 
  209. 				local stick_pressed_twn_h = vint_object_find("stick_pressed_twn") 
  210. 				 
  211. 				--Set Callback to playback anim... 
  212. 				vint_set_property(stick_pressed_twn_h, "end_event", "vint_anim_loop_callback")		 
  213. 				lua_play_anim(vint_object_find("stick_direction")) 
  214. 				 
  215. 				if (button_index == HUD_QTE_STICK_UP) then -- R2 
  216. 					-- Rotate arrow pointing up... 
  217. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 0) 
  218. 					 
  219. 					--Modify Tweens to move stick up... 
  220. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, -15) 
  221. 					vint_set_property(stick_pressed_twn_h, "end_value", 0, -15) 
  222. 					 
  223. 				elseif (button_index == HUD_QTE_STICK_DOWN) then 
  224. 					--Rotate arrow pointing down.. 
  225. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 3.147) 
  226. 					 
  227. 					--Modify Tweens to move stick down... 
  228. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, 15) 
  229. 					vint_set_property(stick_pressed_twn_h, "end_value", 0, 15) 
  230. 				elseif (button_index == HUD_QTE_STICK_RIGHT) then -- R2 
  231. 					-- Rotate arrow pointing right... 
  232. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 90 * DEG_TO_RAD) 
  233. 					 
  234. 					--Modify Tweens to move stick right... 
  235. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, 0) 
  236. 					vint_set_property(stick_pressed_twn_h, "end_value", 15, 0) 
  237. 					 
  238. 				elseif (button_index == HUD_QTE_STICK_LEFT) then 
  239. 					--Rotate arrow pointing left.. 
  240. 					vint_set_property(Hud_qte_stick_arrow_h, "rotation", 270 * DEG_TO_RAD) 
  241. 					 
  242. 					--Modify Tweens to move stick left... 
  243. 					vint_set_property(stick_pressed_twn_h, "start_value", 0, 0) 
  244. 					vint_set_property(stick_pressed_twn_h, "end_value", -15, 0)				 
  245. 				end 
  246. 			end 
  247. 			 
  248. 			-- Set button images 
  249. 			if (is_ps3 == true) then		 
  250. 				-- use PS3 button images 
  251. 				if			(button_index == HUD_QTE_BTN_A) then -- CROSS 
  252. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_cross_up_ps3") 
  253. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_cross_down_ps3")													 
  254. 				elseif	(button_index == HUD_QTE_BTN_X) then -- SQUARE 
  255. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_square_up_ps3") 
  256. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_square_down_ps3") 
  257. 				elseif	(button_index == HUD_QTE_BTN_Y) then -- TRIANGLE 
  258. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_triangle_up_ps3") 
  259. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_triangle_down_ps3") 
  260. 				elseif	(button_index == HUD_QTE_BTN_LT) then -- L1 
  261. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_l1_up_ps3") 
  262. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_l1_down_ps3")			 
  263. 				elseif	(button_index == HUD_QTE_BTN_RT) then -- **CHANGING RT TO MAP TO R1 ON PS3 BECAUSE R1 IS USED FOR SHOOTING ON PS3** 
  264. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_r1_up_ps3") 
  265. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_r1_down_ps3")	 
  266. 				elseif	(button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then --Stick			 
  267. 					vint_set_property(Hud_qte_stick_pad_h, "image", "ui_qte_stick_ps3") 
  268. 					vint_set_property(Hud_qte_stick_base_h, "image", "ui_qte_base_ps3") 
  269. 					vint_set_property(Hud_qte_stick_arrow_h, "image", "ui_qte_arrow_ps3") 
  270. 					vint_set_property(Hud_qte_stick_label_h, "text_tag", "L") 
  271. 				else 
  272. 					--If btn value isn't accounted for throw up a garbage texture to let us know in game 
  273. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_hud_not_police") 
  274. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_hud_not_police")			 
  275. 				end					 
  276. 			else	 
  277. 				-- use XBOX2 button images 
  278. 				if			(button_index == HUD_QTE_BTN_A) then  
  279. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_a_up_xbox2") 
  280. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_a_down_xbox2")													 
  281. 				elseif	(button_index == HUD_QTE_BTN_X) then  
  282. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_x_up_xbox2") 
  283. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_x_down_xbox2") 
  284. 				elseif	(button_index == HUD_QTE_BTN_Y) then  
  285. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_y_up_xbox2") 
  286. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_y_down_xbox2") 
  287. 				elseif	(button_index == HUD_QTE_BTN_LT) then  
  288. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_lt_up_xbox2") 
  289. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_lt_down_xbox2")			 
  290. 				elseif	(button_index == HUD_QTE_BTN_RT) then  
  291. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_qte_rt_up_xbox2") 
  292. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_qte_rt_down_xbox2")			 
  293. 				elseif	(button_index >= HUD_QTE_STICK_UP and button_index <= HUD_QTE_STICK_LEFT ) then --Stick 
  294. 					vint_set_property(Hud_qte_stick_pad_h, "image", "ui_qte_stick_xbox2") 
  295. 					vint_set_property(Hud_qte_stick_base_h, "image", "ui_qte_base_xbox2") 
  296. 					vint_set_property(Hud_qte_stick_arrow_h, "image", "ui_qte_arrow_xbox2") 
  297. 					vint_set_property(Hud_qte_stick_label_h, "text_tag", "LS") 
  298. 				else 
  299. 					--If btn value isn't accounted for throw up a garbage texture to let us know in game 
  300. 					vint_set_property(Hud_qte_btn_1_h, "image", "ui_hud_not_police") 
  301. 					vint_set_property(Hud_qte_btn_2_h, "image", "ui_hud_not_police")			 
  302. 				end			 
  303. 			end 
  304. 			 
  305. 			--adjust success graphic anchor for buttons 
  306. 			 
  307. 			if (button_index >= HUD_QTE_BTN_A and button_index <= HUD_QTE_BTN_RT ) then 
  308. 				local button_width, button_height = vint_get_property(Hud_qte_btn_1_h, "screen_size")--element_get_actual_size(Hud_qte_btn_1_h) 
  309. 				local qte_x, qte_y = vint_get_property(Hud_qte_success_grp_h, "anchor") 
  310. 				local new_y = qte_y - button_height * 0.5 
  311. 				 
  312. 				vint_set_property(Hud_qte_success_grp_h, "anchor", qte_x, new_y)			 
  313. 			end 
  314.  
  315. 			-- Play mash anim... 
  316. 			if			(button_animation == HUD_QTE_ANIM_NONE) then 		 
  317. 				hud_qte_pause_all() 
  318. 			elseif	(button_animation == HUD_QTE_ANIM_MASH_STANDARD) then 	 
  319. 				lua_play_anim(vint_object_find("mash_standard")) 
  320. 			elseif	(button_animation == HUD_QTE_ANIM_MASH_FAST) then 	 
  321. 				lua_play_anim(vint_object_find("mash_fast"))			 
  322. 			end 
  323. 				 
  324. 				-- if the qte is successful play the animation 
  325. 			if success then 
  326. 				vint_set_property(Hud_qte_success_grp_h, "visible", true) 
  327. 				hud_qte_play_success_anim() 
  328. 			end 
  329. 		end	 
  330. 	else 
  331. 		--Hide and pause everything 
  332. 		vint_set_property(Hud_qte_btn_1_h, "visible", false) 
  333. 		vint_set_property(Hud_qte_btn_2_h, "visible", false)		 
  334. 		vint_set_property(Hud_qte_sticks_grp_h, "visible", false) 
  335. 		vint_set_property(Hud_qte_success_grp_h, "visible", false) 
  336.  
  337. 		vint_set_property(Hud_qte_kb_grp_h, "visible", false) 
  338. 		vint_set_property(Hud_qte_mouse_grp_h, "visible", false) 
  339. 		 
  340. 		hud_qte_pause_all() 
  341. 	end	 
  342. 	 
  343. 	-- store current btn and anim 
  344. 	Hud_qte_prev_btn = button_index 
  345. 	Hud_qte_prev_anim = button_animation 
  346. 	 
  347. 	debug_print("vint", "button_animation: " .. var_to_string(button_animation) .. "\n") 
  348. end 
  349.  
  350. -- Pause all animations 
  351. function hud_qte_pause_all() 
  352. 	vint_set_property(vint_object_find("mash_standard"),"is_paused", true)	 
  353. 	vint_set_property(vint_object_find("mash_fast"),"is_paused", true)	 
  354. 	vint_set_property(vint_object_find("stick_direction"),"is_paused", true)	 
  355. 	vint_set_property(vint_object_find("success"),"is_paused", true) 
  356. 	 
  357. 	vint_set_property(vint_object_find("mouse_mash_standard_anim"),"is_paused", true) 
  358. 	vint_set_property(vint_object_find("mouse_mash_fast_anima"),"is_paused", true) 
  359. 	Hud_qte_kb_key:mash(HUD_QTE_ANIM_NONE) 
  360. end 
  361.  
  362.  
  363. --Play "success" Animation 
  364. function hud_qte_play_success_anim() 
  365. 	lua_play_anim(vint_object_find("success")) 
  366. end 
  367.  
  368.  
  369.  
  370. ------------------------------------------------------------------------------- 
  371. -- TEST FUNCTIONS 
  372. -- 
  373. function hud_qte_update_key_test() 
  374. --[[ 
  375. 	local Hud_qte_key_doc_h = vint_document_find("`hud_qte") 
  376. 	Pc_qte_key = Vdo_qte_key:new("qte_pc_key", 0, Hud_qte_key_doc_h, "hud_qte.lua", "Pc_qte_key") 
  377. 	local qte_key = Pc_qte_key 
  378. 	qte_key:set_text("W") 
  379. 	--qte_key:fast_mash() 
  380.  
  381. 	local delay_time = 2 
  382.  
  383. 	delay(delay_time) 
  384.  
  385. 	qte_key:set_text("I'M A BAD ASS") 
  386. 	delay(delay_time) 
  387.  
  388. 	qte_key:set_text("I'M A BAD ASSSSSSSSSSSSSSSSFFFFFFSSSSSS") 
  389. 	delay(delay_time) 
  390.  
  391. 	qte_key:set_text("SAACK") 
  392. 	delay(delay_time) 
  393.  
  394. 	qte_key:set_text("DICKFACE") 
  395. 	 
  396. 	delay(delay_time) 
  397. 	qte_key:set_text("TABULATION") 
  398. 	 
  399. 	delay(delay_time) 
  400.  
  401.  
  402. 	qte_key:set_text("W") 
  403. ]] 
  404. end