Chili:Tutorial Dynamic Label Content: Difference between revisions
| Line 1: | Line 1: | ||
== Dynamic label updating == | == Dynamic label updating == | ||
=== Preparation === | |||
Having windows with labels on screen is a fun thing. Although you probably want to change the contents of those labels if some event happens ingame. For this tutorial we are going to change a label everytime a unit gets destroyed. | Having windows with labels on screen is a fun thing. Although you probably want to change the contents of those labels if some event happens ingame. For this tutorial we are going to change a label everytime a unit gets destroyed. | ||
| Line 11: | Line 12: | ||
In the messages.lua we are going to put global constants that will prefix interface messages between the engine rules code and the widget ui code. Utilities.lua will contain handy utitliy functions like tokenizing strings or array debug code. Units_destroyed_counter.lua will be used as engine rule code to keep track of the amount of units destroyed. Gui_chili_unitdestroyedwindow.lua will contain the code to display the amount of units destroyed. | In the messages.lua we are going to put global constants that will prefix interface messages between the engine rules code and the widget ui code. Utilities.lua will contain handy utitliy functions like tokenizing strings or array debug code. Units_destroyed_counter.lua will be used as engine rule code to keep track of the amount of units destroyed. Gui_chili_unitdestroyedwindow.lua will contain the code to display the amount of units destroyed. | ||
=== Units_destroyed_counter.lua === | |||
Revision as of 14:39, 19 June 2011
Dynamic label updating
Preparation
Having windows with labels on screen is a fun thing. Although you probably want to change the contents of those labels if some event happens ingame. For this tutorial we are going to change a label everytime a unit gets destroyed.
as before we are going to establish a basic structure for our code. However we are going to need 4 scripts now.
- LuaRules\Gadgets\Includes\messages.lua - LuaRules\Gadgets\Includes\utilities.lua - LuaRules\Gadgets\units_destroyed_counter.lua - LuaUI\widgets\gui_chili_unitdestroyedwindow.lua
In the messages.lua we are going to put global constants that will prefix interface messages between the engine rules code and the widget ui code. Utilities.lua will contain handy utitliy functions like tokenizing strings or array debug code. Units_destroyed_counter.lua will be used as engine rule code to keep track of the amount of units destroyed. Gui_chili_unitdestroyedwindow.lua will contain the code to display the amount of units destroyed.