URL: <http://gna.org/bugs/?23841>
Summary: a [make_tag] tag to create custom wml tags. Project: Battle for Wesnoth Submitted by: None Submitted on: Di 01 Sep 2015 14:21:55 UTC Category: Feature Request Severity: 1 - Wish Priority: 5 - Normal Item Group: WML Status: None Privacy: Public Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Release: 1.13 Operating System: any _______________________________________________________ Details: I don't know any usecases for it but i tought it was a funny idea: One could add a [make_tag] tag which creates custom wml tags: -- A tag to create new wml tags wesnoth.wml_actions.make_tag = function(cfg) local tagname = cfg.tagname local command = helper.get_child(cfg, "command") wesnoth.wml_actions[tagname] = function(args) local old_args = wesnoth.get_variable("args") wesnoth.set_variable("args", args) wesnoth.wml_actions.command(command) wesnoth.set_variable("args", old_args) end -- TODO: Use wesnoth.game_events.on_load/save to make those tags persistent. end This could then be used for example like this: [make_tag] ## triggers an advancement for the given unit (which shows an advancement dialog) name = "advance_unit" [command] [store_unit] [filter] x = "$args.x" y = "$args.y" [/filter] ## args variable will be cleared automatically variable = "args.unit" [/store_unit] [set_variable] name = "args.unit.experience" add = "args.unit.max_experience" [/set_variable] [unstore_unit] variable = "args.unit" fire_event = yes [/unstore_unit] [/command] [/make_tag] [advance_unit] x,y = 7,4 [/advance_unit] [advance_unit] x,y = 8,4 [/advance_unit] [advance_unit] x,y = 9,4 [/advance_unit] _______________________________________________________ Reply to this item at: <http://gna.org/bugs/?23841> _______________________________________________ Nachricht gesendet von/durch Gna! http://gna.org/ _______________________________________________ Wesnoth-bugs mailing list Wesnoth-bugs@gna.org https://mail.gna.org/listinfo/wesnoth-bugs