Macros don´t work! Aaargh!
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Using this, in fully written?
Code: Select all
#define CHG_GOLD SIDE AMOUNT
[store_gold]
variable=gold_inc
[filter]
side={SIDE}
[/filter]
[/store_gold]
{VARIABLE_OP gold_inc add{AMOUNT}}
[modify_side]
gold=$gold_inc
[filter]
side=1
[/filter]
[/modify_side]
{CLEAR_VARIABLE gold_inc}
#enddef
First read, then think. Read again, think again. And then post!
[store_gold]: I just thought it´s the same as [store_unit].zookeeper wrote:Otherwise correct, except that: [store_gold] and [modify_side] do not accept [filter]s, they take just the side key. And your [modify_side] should have side={AMOUNT}, not side=1. Also, add a space after "add" in the {VARIABLE_OP}.
side={AMOUNT}: Huh? I think you meant side={SIDE}
First read, then think. Read again, think again. And then post!
No, youn didn´t understand. I meant for [store_unit], you need filters, and for [store_locations] too. But-alright then.zookeeper wrote:And how could [store_gold] possibly work like [store_unit]? Units don't have gold, only sides do.
First read, then think. Read again, think again. And then post!
For those, you need to filter something - locations or units. To store gold, you don't need to "filter" anything but side. But yeah, I suppose there could be a side filter in addition to unit and location filters (but then again, it would probably be mentioned in the FilterWML page).toms wrote:No, youn didn´t understand. I meant for [store_unit], you need filters, and for [store_locations] too. But-alright then.
Code: Select all
[event]
name=side turn
first_time_only=no
[filter]
side=3
[/filter]
Code: Select all
[event]
name=side turn
first_time_only=no
[if]
[variable]
name=side_number
equals=3
[/variable]
[then]
# this gets executed when side 3 is starting it's turn
[/then]
[/if]
[/event]
I want to shut this thread, but I have one last question: If I use a macro in a macro, do I have to use parantheses?
Example I´m not sure, and I haven´t found it in the wiki.
Example
Code: Select all
{MACRO ({MACRO})}
First read, then think. Read again, think again. And then post!
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
It's ok. I wasn't rebuking you for it, just pointing out that sometimes being there trumps the search function, which is saying a lot.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.