Macros don´t work! Aaargh!

The place to post your WML questions and answers.

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.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Macros don´t work! Aaargh!

Post by toms »

I made a scenario without own-built macros and then I replaced some things with macros.
All of sudden, it doesn´t work any more.

Another thing is that I already had a macro in another scenario and it worked except for the macro.

Help please! :(

(the attachment is the file wich suddenly didn´t work because of inserting macros)
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Code: Select all

{@data/campaigns/Scout/utils/utils.cfg}
I would put such includes in the campaign file, inside the #ifdef instead of including them in every scenario file. Also, the {@data/campaigns/Scout part looks a bit odd. I think I've only seen the form {@campaigns/Scout used. Perhaps changing that would help?

Also...

Code: Select all

[side]
no_leader=yes
[/side]
...seems completely redundant, since it doesn't define anything for that side (even what side it's supposed to be).
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

I´ve changed the binary path the way you told. But there is still the same error msg. :(

(the side stuff shouldn´t cause problems because it worked all fine before adding the utils)
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

toms wrote:I´ve changed the binary path the way you told. But there is still the same error msg. :(
Could you post all the relevant WML files (campaign file, utils.cfg)? Also, I wouldn't call the "{} includes" binary paths, since a [binary_path] is something very different. With the "{} includes" you can only include WML code from a file into that location, whereas with [binary_path] you add paths from which external files (like images given in an profile= key) are searched.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Yep, I can. :roll:

And maybe the craziest thing of all: I think the death macros work, but I can´t check it now when it doesn´t work.
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Code: Select all

[campaign]
	id=campaign_scout

...

#ifdef CAMPAIGN_SCOUT
I think the #ifdef symbol and the campaign id should be the same. My guess is that they're case sensitive ;)

EDIT: Sorry, my bad. I confused id with define. Nevermind the above.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Removing lines 165-200 from prologue.cfg did the trick. You use the macro place_image which is not defined anywhere, and the macro PLACE_IMAGE, which takes three arguments whereas you've only given it one.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

So far, so good, but every macroed thing has no effect. (looks really odd :evil: )
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

In utils.cfg, #enddef's are missing on lines 52 and 88.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

This is fixed now, but I have another problem: the [removeitem] tag doesn´t work. :o
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

toms wrote:This is fixed now, but I have another problem: the [removeitem] tag doesn´t work. :o
As the WML reference says, you need to give it the coordinates from which to remove the items.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

zookeeper wrote:
toms wrote:This is fixed now, but I have another problem: the [removeitem] tag doesn´t work. :o
As the WML reference says, you need to give it the coordinates from which to remove the items.
I´ve made your change. I´ve just seen so many .cfg-s without this. :?

Result: The animation doesn´t work anyway now :(
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

toms wrote:
zookeeper wrote:As the WML reference says, you need to give it the coordinates from which to remove the items.
I´ve made your change. I´ve just seen so many .cfg-s without this. :?
My guess is that if it works on those scenarios, it works without the coordinates when used in a moveto event. So if you don't give the exact coordinates, items at the target hex of the moveto event get removed. Just a guess.
toms wrote:Result: The animation doesn´t work anyway now :(
Make sure that when you try to animate by using items, you [redraw][/redraw] after placing an item and put a sufficient delay after that. Then you can remove the previous item, place the next, redraw, delay, etc. I think I once had some problems with such animations because I didn't redraw at the right spots.

BTW, if you intend your campaign to be 1.1 compatible, you can use the [extra_anim] and [animate_unit] tags for any custom unit animations you want. It'll probably be much more convenient.
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Ok, the campaign goes again but this doesn´t work:

Code: Select all

#define CHG_GOLD SIDE AMOUNT
 [gold]
 side={SIDE}
 amount={AMOUNT}
 [/gold]
#enddef
First read, then think. Read again, think again. And then post!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

toms wrote:Ok, the campaign goes again but this doesn´t work:
I don't really know why that wouldn't work, provided the macro is used correctly (the definition has no errors). The only way I can think of how it could be used wrong would be to try to use it outside an event. But in any case, you could use [modify_side] instead if [gold] really doesn't want to work. You just need to [store_gold], increment the variable by {AMOUNT} and set the new gold amount with [modify_side].
Post Reply