Enter hex event and allow undo
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.
Enter hex event and allow undo
Hi,
I've been trying to debug this, but I've given up, I need help.
This code:
Is a fragment of a larder util, which allows soldiers to speak when selected, moved, and make footstep sounds.
The problem is, that this piece of code always cancels any ability to undo a move. And I don't get it why.
If global_soldier_sounds is disabled through a menu item, then the undo works. If it's enabled and this event fires, no undo can be done.
Is this a wesnoth bug, or am I missing something?
I'm using wesnoth 1.12.6
Thanks for your help,
WhiteWolf
I've been trying to debug this, but I've given up, I need help.
This code:
Code: Select all
[event]
name=enter hex
first_time_only=no
[filter]
side=1
[not]
race=bat,drake
[/not]
[filter_location]
[not]
terrain=W*,Ss
[/not]
[/filter_location]
[/filter]
[filter_condition]
[variable]
name=global_soldier_sounds
equals=enabled
[/variable]
[/filter_condition]
{RANDOM_VARIABLE footstep (00,01,02,03,04,05,06,07,08,09)}
[sound]
name=footsteps/Footstep_Dirt_$footstep|.ogg
[/sound]
{CLEAR_VARIABLE footstep}
[allow_undo]
[/allow_undo]
[/event]
The problem is, that this piece of code always cancels any ability to undo a move. And I don't get it why.
If global_soldier_sounds is disabled through a menu item, then the undo works. If it's enabled and this event fires, no undo can be done.
Is this a wesnoth bug, or am I missing something?
I'm using wesnoth 1.12.6
Thanks for your help,
WhiteWolf
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: Enter hex event and allow undo
WML random invalidates undo.
Re: Enter hex event and allow undo
So I see.
What would then be a workaround? Can [sound]name= take a comma separated list from which it can choose one random sound? (it's not detailed in the wiki what a comma-separated list would mean)
Or is the only way to somehow write a "custom random generator", that yields a number for example from $x1 and $y1 with a tricky formula? And then [switch] on this number to determine the sound.
Any other ways?
What would then be a workaround? Can [sound]name= take a comma separated list from which it can choose one random sound? (it's not detailed in the wiki what a comma-separated list would mean)
Or is the only way to somehow write a "custom random generator", that yields a number for example from $x1 and $y1 with a tricky formula? And then [switch] on this number to determine the sound.
Any other ways?
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: Enter hex event and allow undo
I guess formula could work, but easier to just use lua.
Re: Enter hex event and allow undo
Yes.WhiteWolf wrote:Can [sound]name= take a comma separated list from which it can choose one random sound?
name=footsteps/Footstep_Dirt_00.ogg,footsteps/Footstep_Dirt_01.ogg,footsteps/Footstep_Dirt_02.ogg,footsteps/Footstep_Dirt_03.ogg
If you don't know what it means, how did you think to ask if it can be used here?WhiteWolf wrote:(it's not detailed in the wiki what a comma-separated list would mean)
Re: Enter hex event and allow undo
Thanks.
What I meant was that here it doesn't say what it does. Without having tried it, I guessed it could mean playing all of the list elements in the specified order (since there is also a repeat attribute to make loops), which is not what I wanted... sorry if the question was obviously stupid...
What I meant was that here it doesn't say what it does. Without having tried it, I guessed it could mean playing all of the list elements in the specified order (since there is also a repeat attribute to make loops), which is not what I wanted... sorry if the question was obviously stupid...
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny