The [time_area] tag

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
alda
Posts: 49
Joined: December 2nd, 2009, 4:06 pm

The [time_area] tag

Post by alda »

Hi, it's me again :) . Well, since I've begun to create a campaign few days ago, I'm only discovering WML so I have lots of small problems. Now this one concerns the [time_area] tag. I think its functionment is quite buggy :?.

From various tests, here is what I've gathered so far :

If you use [time_area] alone (in no [event] tag), it won't accept Standard Location Filter arguments, only x,y= (or at least the radius= attribute that I've tested). Otherwise it works fine.

But sometimes, only attributing x,y won't be enough.

So you can use [time_area] into an event (here I did at a prestart event).
For example, here is a macro I've tried to write for a brazier :

Code: Select all

#define ANIMATED_BRAZIER_HALO_UNDERGROUND X Y RADIUS
	
	{ANIMATED_BRAZIER {X} {Y}}	
	
	[event]
		name=prestart
		
		[sound_source]
			id={X},{Y}
			sounds=ambient/campfire.ogg
			x,y={X},{Y}
			loop=-1
			delay=0
			chance=100
			check_fogged=true
			check_shrouded=true
			full_range=2
			fade_range=8
		[/sound_source]
		
		{VARIABLE radius {RADIUS}}
		
		[if]
			[variable]
				name=radius
				numerical_equals=1
			[/variable]
			
			[then]
				[item]
					x={X}
					y={Y}
					halo=halo/illuminates-aura.png
				[/item]
			[/then]
			
			[else]
				[if]
					[variable]
						name=radius
						greater_than_equal_to=2
					[/variable]
				
					[then]
						[item]
							x={X}
							y={Y}
							halo=halo/fire-aura.png
						[/item]
					[/then]
				[/if]
			[/else]
		[/if]
		
		[time_area]
			id={X},{Y}
			[time]
				id=underground_illum
				name= _ "Underground"
				image=misc/schedule-underground-illum.png
			[/time]
			x,y={X},{Y}
			radius={RADIUS}
		[/time_area]

		{CLEAR_VARIABLE radius}
	[/event]
	
#enddef
And hurray ! It works ! There is illuminated underground in all the circle around the fire !

But :

- first, what's surprising is that [time_area] seems to work differently if it is outside or inside an event. Actually, I don't really know what's the difference between an event=prestart and no event, just that you can't do some things outside an event. But in our case it is quite confusing and I think it should be fixed.

- second and most of all, I lied. Actually, it doesn't perfectly work. It works only if you load the scenario from the beginning, but if you load the game from a save, well, there will be no illuminated underground at all. So it should come from the functionning of savefiles and here again, I have really no idea how it works (interesting thing is that if we use [time_area] outside an event with x,y= as above, this problem won't happen). But I think this is a bug and here again it should be fixed.


Finally, can anyone find an other way that I've not found to make this fire macro work properly ? :P
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: The [time_area] tag

Post by silene »

alda wrote:- first, what's surprising is that [time_area] seems to work differently if it is outside or inside an event. Actually, I don't really know what's the difference between an event=prestart and no event, just that you can't do some things outside an event. But in our case it is quite confusing and I think it should be fixed.
As a rule of thumb, things inside events are more powerful. Explained otherwise: things outside events are loaded directly by the engine, as if they were out of a savefile. So, I would stay away from things outside of events, and rely only on things inside events. Note that all the developers don't agree with this opinion, but I think that the loading process should stay as dumb as possible. So I don't agree this particular discrepancy should be fixed.
alda wrote:- second and most of all, I lied. Actually, it doesn't perfectly work. It works only if you load the scenario from the beginning, but if you load the game from a save, well, there will be no illuminated underground at all. So it should come from the functionning of savefiles and here again, I have really no idea how it works (interesting thing is that if we use [time_area] outside an event with x,y= as above, this problem won't happen). But I think this is a bug and here again it should be fixed.
I may be mistaken, but I think this is already fixed; so it should work better in the next release.
User avatar
alda
Posts: 49
Joined: December 2nd, 2009, 4:06 pm

Re: The [time_area] tag

Post by alda »

Hehehe I just saw the bug fix in the 1.7.10 version changelog :roll: . And I have only 1.7.8 version. Silly me, I should have last version or at least consult changelog before posting for a bug !

Anyway, it's quite amazing to see that a bug I've just found is fixed in the last version :shock:

Okay, I'll download 1.7.10 and now it should work.

P.S. : thank you for being always so quick to respond, silene.
Post Reply