How do I fire an event like side end turn?

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
winkr7
Posts: 53
Joined: May 16th, 2019, 2:09 pm

How do I fire an event like side end turn?

Post by winkr7 »

Hello;

When my unit (id=bleys) has only 1 move left I want the turn to end without having
to click the turn end button. I am not sure how to fire the event side 1 end (since bleys is on side 1).
I tried something like you see below, but while it correctly filters as it should the turn does not end.
Thanks for your time.
yours
winkr7

Code: Select all

	[event]
		name=enter_hex
		first_time_only=no
		[filter]
			id=bleys
			formula="self.moves = 1"
		[/filter]
		[command]
			[fire_event]
				id=side 1 end
			[/fire_event]
		[/command]
	[/event]
Last edited by WhiteWolf on September 22nd, 2022, 3:16 pm, edited 1 time in total.
Reason: please use [code]
User avatar
Pentarctagon
Project Manager
Posts: 5533
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How do I fire an event like side end turn?

Post by Pentarctagon »

Firing events don't work that way, same as how firing a die event won't kill a unit. What you'd want is [end_turn].
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
winkr7
Posts: 53
Joined: May 16th, 2019, 2:09 pm

Re: How do I fire an event like side end turn?

Post by winkr7 »

Thankyou Pentarctagon. [end_turn] works.
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How do I fire an event like side end turn?

Post by beetlenaut »

In case this is still unclear, the [event] tag is for creating an event handler that responds to things happening in the game.

(If you need [fire_event], it's probably because you have an event with a custom name key.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
winkr7
Posts: 53
Joined: May 16th, 2019, 2:09 pm

Re: How do I fire an event like side end turn?

Post by winkr7 »

Thanks beetlenaut, I am looking at examples, your "tester" campaign for ITEM_DROPS has been helpful,
the menu item that brings up inspector is extremely useful.
Post Reply