Added a test scenario for the lua interpreter.

This commit is contained in:
Fabian Müller 2009-04-22 20:33:36 +00:00
parent da500bca0f
commit 235fb7af16
2 changed files with 182 additions and 0 deletions

View file

@ -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

181
data/scenario-lua.cfg Normal file
View file

@ -0,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;