Author: silene
Date: Mon Apr 13 13:49:14 2009
New Revision: 34854

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34854&view=rev
Log:
Added example of custom WML tag.

Modified:
    trunk/data/scenario-test.cfg

Modified: trunk/data/scenario-test.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=34854&r1=34853&r2=34854&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Mon Apr 13 13:49:14 2009
@@ -165,6 +165,24 @@
             generate_name=yes
         [/unit]
     [/side]
+
+    [event]
+        name=preload
+        first_time_only=no
+        [lua]
+            code=<<
+                local function f(t)
+                    wesnoth.fire("label", { text =
+                        string.format("Lua says:\n%d units on side %d",
+                            #wesnoth.get_units { side = t.on_side },
+                            t.on_side),
+                        x = 13, y = 3 })
+                    end
+                wesnoth.register_wml_action("my_lua_action", f)
+            >>
+        [/lua]
+    [/event]
+
     [event]
         name=prerecruit
         [message]
@@ -203,14 +221,10 @@
 
     [event]
         name="new turn"
-        [lua]
-            code = <<
-                wesnoth.fire("label", { text =
-                    string.format("Lua says:\n%d units on side 1",
-                        #wesnoth.get_units { side = 1 }),
-                    x = 13, y = 3 })
-            >>
-        [/lua]
+        first_time_only=no
+        [my_lua_action]
+            on_side=1
+        [/my_lua_action]
     [/event]
 
     [event]


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to