Little problem

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.
Post Reply
User avatar
Casual User
Posts: 475
Joined: March 11th, 2005, 5:05 pm

Little problem

Post by Casual User »

Good afternoon!

I've defined a little custom macro, and it doesn't work. It's supposed to generate alternativly a ghoul, a blood bat, a soulless and then a ghoul again. The rune and the first ghoul pop out all right, but it doesn't do anything from then on. I've racked my brain trying to figure out how to make it work. Here's the macro:

Code: Select all

#define RUNE_GHOUL SIDE X Y
[event]
name=start
{IMAGE item-rune4.png {X} {Y}}
[set_variable]
name=rotate
equals=1
[/set_variable]
[unit]
side={SIDE}
type=Ghoul
x={X}
y={Y}
[/unit]
[/event]
[event]
name=new turn
first_time_only=no
[if]
[variable]
name=rotate
equals=1
[/variable]
[then]
[unit]
side={SIDE}
type=Blood Bat
x={X}
y={Y}
[/unit]
[set_variable]
name=rotate
equals=2
[/set_variable]
[/then]
[/if]
[if]
[variable]
name=rotate
equals=2
[/variable]
[then]
[unit]
side={SIDE}
type=Soulless
x={X}
y={Y}
[/unit]
[set_variable]
name=rotate
equals=3
[/set_variable]
[/then]
[/if]
[if]
[variable]
name=rotate
equals=3
[/variable]
[then]
[unit]
side={SIDE}
type=Ghoul
x={X}
y={Y}
[/unit]
[set_variable]
name=rotate
equals=1
[/set_variable]
[/then]
[/if]
[/event]
#enddef
Thanks in advance
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Casual User wrote:

Code: Select all

[set_variable]
name=rotate
equals=2
[/set_variable] 
This does not give the variable a new value. The equals, greater_than etc. keys should only be used in an [if] [variable], not in [set_variable]. Use value instead to set a new value:

Code: Select all

[set_variable]
name=rotate
value=2
[/set_variable] 
User avatar
Casual User
Posts: 475
Joined: March 11th, 2005, 5:05 pm

Post by Casual User »

I learned something today :) .
Thanks.
Post Reply