mail[Wesnoth-commits] r40368 - /trunk/data/scenario-test.cfg


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on December 24, 2009 - 14:59:
Author: silene
Date: Thu Dec 24 14:59:23 2009
New Revision: 40368

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40368&view=rev
Log:
Converted some tests to use Lua helpers.

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=40368&r1=40367&r2=40368&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Thu Dec 24 14:59:23 2009
@@ -730,35 +730,26 @@
             x,y,side=18,10,1
         [/filter]
 
-        [message]
-            speaker=unit
-            message="Pick your poison"
+        [lua]
             # Uses the special syntax as described at
             # http://www.wesnoth.org/wiki/DescriptionWML
             # The ; doesn't seem to work in the old gui so no need to port 
it.
             #
             # On 800x480 a scrollbar should appear.
-            [option]
-                message="&items/potion-red.png=Something red=Take a sip and 
enjoy"
-            [/option]
-            [option]
-                message="*&items/potion-blue.png=Nice blue=Surely you'll 
like that one"
-            [/option]
-            [option]
-                message="&items/potion-yellow.png=<span color='#ffff00'>Oh 
noes yellow</span>=Oh I'm sure you'll love that one"
-            [/option]
-            [option]
-                message="&scenery/well.png=A nice well=Grab a bucket and 
fetch some water."
-            [/option]
-            [option]
-                message="&items/holy-water.png=Oh nice bottle=Feel the 
divinity"
-            [/option]
-            [option]
-                # Should have an empty first column.
-                # Should show \/\/ell a nice and black drink. Too dark too 
see?.
-                message="=\\/\\/ell a \nice and black drink. Too dark too 
see?=Take a sip and pass the bottle along"
-            [/option]
-        [/message]
+            code = <<
+                local helper = wesnoth.require "lua/helper.lua"
+                local result = helper.get_user_choice(
+                    { speaker = "unit", message = "Pick your poison" },
+                    { "&items/potion-red.png=Something red=Take a sip and 
enjoy",
+                      "*&items/potion-blue.png=Nice blue=Surely you'll like 
that one",
+                      "&items/potion-yellow.png=<span color='#ffff00'>Oh 
noes yellow</span>=Oh I'm sure you'll love that one",
+                      "&scenery/well.png=A nice well=Grab a bucket and fetch 
some water",
+                      "&items/holy-water.png=Oh nice bottle=Feel the 
divinity",
+                      -- Should have an empty first column and a second 
column on two lines.
+                      "=Well a nice and black drink.\nToo dark too see?=Take 
a sip and pass the bottle along" })
+                wesnoth.message(string.format("User selected choice %d.", 
result))
+            >>
+        [/lua]
     [/event]
 
     [label]
@@ -1941,15 +1932,15 @@
             variable=temp_villages_area
         [/store_locations]
 
-        {FOREACH temp_villages_area i}
-            [unit]
-                type=Goblin Spearman
-                side=2
-                x,y=$temp_villages_area[$i].x,$temp_villages_area[$i].y
-            [/unit]
-        {NEXT i}
-
-        {CLEAR_VARIABLE temp_villages_area}
+        [lua]
+            code = <<
+                local helper = wesnoth.require "lua/helper.lua"
+                for i, v in ipairs(helper.get_variable_proxy_array 
"temp_villages_area") do
+                    wesnoth.put_unit(v.x, v.y, { type = "Goblin Spearman", 
side = 2 })
+                end
+                wesnoth.set_variable "temp_villages_area"
+            >>
+        [/lua]
     [/event]
 
     [event]




Related Messages


Powered by MHonArc, Updated Thu Dec 24 15:00:13 2009