Commit graph

1093 commits

Author SHA1 Message Date
Celtic Minstrel
c4bb4c2536 Fix WML unit tests 2015-09-23 22:22:25 -04:00
CelticMinstrel
f07e463882 Merge pull request #493 from CelticMinstrel/foreach
Enhanced looping tags
2015-09-23 00:50:30 -04:00
Celtic Minstrel
7e26e09061 Fix erroneous handling of [break]/[continue] in [elseif] 2015-09-23 00:25:31 -04:00
Celtic Minstrel
33a43990ad Add an explanatory comment to [foreach] 2015-09-22 22:13:36 -04:00
Celtic Minstrel
d5eea2abbf Fix [show_if] in [message][option] 2015-09-22 16:16:08 -04:00
gfgtdf
58512935d4 add [message] wait_description=
the description provided in wait_description is used when other players
wait for this [message] input.
2015-09-21 15:50:14 +02:00
gfgtdf
4c3e00b3bb readd side_for parameter for [message] with input
this was lost when porting the code to lua.
2015-09-21 15:46:00 +02:00
Elvish_Hunter
650f21e582 Fixed [role] not working if type= was not specified 2015-09-21 12:29:13 +02:00
Charles Dang
acdc67fe56 [object] don't show unit reach when highlighting unit 2015-09-21 10:47:21 +11:00
Charles Dang
00d96b3016 Fixed a variable typo pointed out by Elvish_Hunter 2015-09-20 23:49:06 +11:00
Celtic Minstrel
d527ea4740 Fix up loop implementations to reflect recent changes 2015-09-20 01:05:55 -04:00
Celtic Minstrel
2fec74a6ac Add default scope_type to handle_event_commands 2015-09-20 01:01:57 -04:00
Celtic Minstrel
0ffda44b27 Add break/continue support to the new loops 2015-09-20 01:01:52 -04:00
Celtic Minstrel
aec99429c4 Merge branch 'break-continue' into foreach 2015-09-20 00:48:39 -04:00
Celtic Minstrel
3c329408ce Implement [break], [continue], [return] tags (they take no arguments) 2015-09-20 00:47:23 -04:00
Celtic Minstrel
bda61536b0 Use [do] subtags with [repeat] 2015-09-20 00:31:47 -04:00
Celtic Minstrel
d895b18659 [foreach] now raises error if array length changes during iteration 2015-09-20 00:31:28 -04:00
Celtic Minstrel
65263bfc32 Propagate modifications to item_var back into the array 2015-09-20 00:31:09 -04:00
Celtic Minstrel
6c5cf1eb88 Implement [foreach] tag, based on Elvish_Hunter's implementation 2015-09-20 00:30:18 -04:00
Celtic Minstrel
f5bd414b69 New WML tags to replace macro loop constructs
- [for] can replace {FOREACH} ... {NEXT}, but it's really intended for running over an integral range
- [repeat] can replace {REPEAT}
2015-09-20 00:30:08 -04:00
Charles Dang
45aa0d4ae8 Fixup 9ea9c88356 2015-09-20 10:23:34 +11:00
Charles Dang
9ea9c88356 Fixed bug where unit at x1,y1 would be considered for object even if filter failed
Note that this was only present the 1.13 Lua implementation of [object]
and as such does not affect 1.12
2015-09-20 10:19:10 +11:00
Charles Dang
660647f7d8 Strip newline whitespace 2015-09-20 04:46:34 +11:00
Charles Dang
e96f1c1bc1 Cleaned out implementation of legacy function 2015-09-20 03:36:15 +11:00
Celtic Minstrel
907d527cc3 Lua API: Replace wesnoth.skipping_replay() with is_skipping_messages() and skip_messages() 2015-09-19 12:13:40 -04:00
Celtic Minstrel
03580ed9a9 Allow spaces in [object]id= and show error if invalid characters are present 2015-09-19 12:13:38 -04:00
Celtic Minstrel
a93ce122ff Add [found_item] ConditionalWML that checks if an [object] ActionWML has been taken 2015-09-19 12:13:36 -04:00
Celtic Minstrel
376020097f Port [object] ActionWML tag from C++ to Lua
Lua API additions:
- wesnoth.show_popup_dialog()
- optional write_to_mods parameter to wesnoth.add_modification
2015-09-19 12:13:25 -04:00
Celtic Minstrel
d4835b0157 Port [message] ActionWML tag from C++ to Lua
Lua API additions:
- wesnoth.skipping_replay()
- wesnoth.deselect_hex()

Note: vultraz and aetheryn deserve partial credit for the Lua implementation
2015-09-19 12:13:23 -04:00
Celtic Minstrel
6200f60c79 Split some utility functions from wml-tags.lua into a new file 2015-09-19 12:13:21 -04:00
gfgtdf
f01252a42c add [unsynced] actionwml
This can be used like in the following example (note that without the
[unsynced] it would cause OOS becasue rand= might or might not be
called.):

[unsynced]
[store_side]
variable = "side"
side = "$side_number"
[/store_side]
[if]
[variable]
name = "side.controller"
equals = "human"
[/variable]
[then]
[set_variable]
name = "num"
rand = _ "two,four,seven"
[/set_variable]
[message]
message = _ "I want $num stones"
[/message]
[/then]
[/if]
[unsynced]
2015-09-11 22:33:30 +02:00
Charles Dang
1a606a51b1 Allow [modify_unit] to modify [advancement] 2015-09-03 01:24:14 +11:00
gfgtdf
0038448fcb make helper.shuffle synced
using helper.shuffle now doesn't casue OOS anymore used. It is possible
to get the old behaviour by passing math.random as a second parameter.
2015-08-04 22:36:54 +02:00
Elvish_Hunter
79d44d0486 Bugfixes in [role] tag
The following fixes were applied:
* cfg.__shallow_literal -> helper.shallow_literal, to allow calling the tag
  from Lua as wesnoth.wml_actions.role
* added trim() to the for cycle
* deleted filter.role and filter.type after having copied their data, because
  when calling the tag from Lua they ended up being deleted too early
* unit.role = cfg.role -> unit.role = role
2015-06-13 21:19:56 +02:00
Elvish_Hunter
787bd1b9c5 Moved [role] to Lua
This fixes indirectly bug #23630
2015-06-10 22:36:08 +02:00
Elvish_Hunter
88c0eb33e7 [label]: added SLF support when used inside an event 2015-05-24 21:34:54 +02:00
Charles Dang
f69d0e07e7 Simplified [switch] implementation 2015-05-24 13:00:10 +11:00
Charles Dang
435aafad3e Removed an unused var causing issues in [unit_worth] 2015-04-18 14:04:31 +11:00
Chris Beck
f3a639fc62 move [print] to game_lua_kernel 2015-04-11 22:55:14 -04:00
Chris Beck
a5d3c64d10 move "modify_ai" to the game lua kernel 2015-04-11 22:09:40 -04:00
gfgtdf
cd0029eac1 add accelerate in [delay]
If accelerate =yes (default no) then the delay time will be affected by
the acceleration set in the preferences.
See https://gna.org/bugs/?21335
2015-04-06 00:48:48 +02:00
Bär Halberkamp
ae0a2fe2cc Removed [full_heal] 2015-04-03 19:34:16 +02:00
Charles Dang
7533cc79ae Dropped support for [gold][filter_side] 2015-04-03 07:13:14 +11:00
gfgtdf
ed5650c758 add wesnoth.advance_unit lua function
previously this was only possible by storing the unit and then unstoring
with advance=yes. Unstoring a unit can cause a lot of overhead if the
unit is complicated. so i added a way to do it without [unstore_unit]
2015-03-28 21:37:26 +01:00
Charles Dang
d8b36e5d08 Add a newline between objective sections
This is set up that there will be no newlines at the end of any section, unless you have
only a summary key, which no one would do. However, there will be a newline at the top of
the dialog if you don't have a win objective, but no one would do that either.

Note that because of newlines not showing up properly on Windows, this won't be viable
on that platform.
2015-03-21 20:55:38 +11:00
Charles Dang
3a6579b9c2 Further simplify [if] implementation 2015-02-13 19:55:07 +11:00
Charles Dang
c1e95bcf14 Simplified [if] implementation 2015-02-13 05:49:58 +11:00
Charles Dang
9c9cbf2901 Fixup 84a7f3fb31, use shallow_parsed 2015-02-03 11:06:59 +11:00
Charles Dang
84a7f3fb31 Parse [terrain] config. This fixes bug #23236 2015-02-03 11:03:37 +11:00
gfgtdf
78d6808e1a support wml arrays in [sync_variable] 2015-01-28 22:49:41 +01:00