Author: fendrin
Date: Wed Apr 22 22:33:36 2009
New Revision: 35126
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35126&view=rev
Log:
Added a test scenario for the lua interpreter.
Added:
trunk/data/scenario-lua.cfg
Modified:
trunk/data/_main.cfg
Modified: trunk/data/_main.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/_main.cfg?rev=35126&r1=35125&r2=35126&view=diff
==============================================================================
--- trunk/data/_main.cfg (original)
+++ trunk/data/_main.cfg Wed Apr 22 22:33:36 2009
@@ -21,6 +21,7 @@
{scenario-formula.cfg}
{scenario-formula-recruitment.cfg}
{scenario-poisoning.cfg}
+{scenario-lua.cfg}
{ai/scenarios/scenario-AI_Arena_small.cfg}
#endif
Added: trunk/data/scenario-lua.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-lua.cfg?rev=35126&view=auto
==============================================================================
--- trunk/data/scenario-lua.cfg (added)
+++ trunk/data/scenario-lua.cfg Wed Apr 22 22:33:36 2009
@@ -1,0 +1,181 @@
+#textdomain wesnoth
+[test]
+ name="Test scenario"
+ turns=-1
+ id=lua_wml
+ map_data="{multiplayer/maps/4p_Lagoon.map}"
+ victory_when_enemies_defeated=no
+
+ [side]
+ side=1
+ controller=human
+ type=Elvish Archer
+ canrecruit=yes
+ [/side]
+
+ [event]
+ name=prestart
+
+ [wml_action]
+ name=wml_subtag
+
+ [attribute]
+ name=name
+ [/attribute]
+
+ [attribute]
+ name=lua_function
+ [/attribute]
+
+ lua_function= << return function(cfg) return end >>
+ [/wml_action]
+
+ [wml_subtag]
+ name=location
+ wiki=""
+ lua_function= << return function(cfg) return end >>
+ [/wml_subtag]
+
+ [wml_subtag]
+ name=standard_unit_filter
+ wiki=""
+ [location]
+ [/location]
+ [attribute]
+ name=id
+ [/attribute]
+ [attribute]
+ name=typ
+ [/attribute]
+ [/wml_subtag]
+
+ [wml_subtag]
+ name=option
+ [/wml_subtag]
+
+ [wml_subtag]
+ name=and
+ [conditions]
+ lua_function= << return function(t) wesnoth.message "Hello
World!" end >>
+ [/conditions]
+ [/wml_subtag]
+
+ [wml_subtag]
+ name=or
+ wiki=""
+ [conditions]
+
+ [/conditions]
+ lua_function= << return function(cfg) end >>
+ [/wml_subtag]
+
+ [wml_subtag]
+ name=not
+ [conditions]
+
+ [/conditions]
+ lua_function= << return function(cfg) end >>
+ [/wml_subtag]
+
+ [wml_subtag]
+ name=actions
+ lua_function= << return function(cfg) end >>
+ [/wml_subtag]
+
+ [wml_subtag]
+ name=conditions
+ [subtag]
+ name=have_unit
+ [/subtag]
+ [subtag]
+ name=have_location
+ [/subtag]
+ [subtag]
+ name=variable
+ [/subtag]
+ #Meta Condition Tags
+ [subtag]
+ name=and
+ [/subtag]
+ [subtag]
+ name=or
+ [/subtag]
+ [subtag]
+ name=not
+ [/subtag]
+ [/wml_subtag]
+
+ [wml_action]
+ name=if
+ wiki="Blah blah"
+
+ [conditions]
+
+ [/conditions]
+
+ [subtag]
+ name=then
+ optional=no
+ [/subtag]
+ [subtag]
+ name=else
+ [/subtag]
+ lua_function= << return function(cfg) return end >>
+ [/wml_action]
+
+ [wml_subtag]
+ name=then
+ wiki=
+ parent=
+ [actions]
+ [/actions]
+ [/wml_subtag]
+
+ [wml_action]
+ name="message"
+ [standart_unit_filter]
+ [/standart_unit_filter]
+
+ [attribute]
+ name=message
+ type=string
+ wiki="(translatable) the text to display to the right of the
image. message is sometimes multiple lines; if it is, be sure to use quotes"
+ [/attribute]
+ [attribute]
+ name=speaker
+ type=enum
+ enum=narrator,unit,second_unit
+ wiki=""
+ [/attribute]
+
+ lua_function= << return function(cfg) wesnoth.fire("message", {
speaker=cfg.speaker, message=cfg.message }) end >>
+ [/wml_action]
+
+ [/event]
+
+ [event]
+ name=turn 3
+ [if]
+ [variable]
+ boolean_equals=true
+ name=conditional_test
+ [/variable]
+ [then]
+ [message]
+ speaker=narrator
+ message="Yes, it's true!"
+ [/message]
+ [/then]
+ [else]
+ [message]
+ speaker=narrator
+ message="No, it's false!"
+ [/message]
+ [/else]
+ [/if]
+ [/event]
+
+[/test]
+
+# vim: tabstop=4: shiftwidth=4: expandtab: softtabstop=4: autoindent:
+# kate: indent-mode normal; space-indent on;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits