Samonella's questions: currently unsolved
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.
Re: move_unit question
That makes sense. ThanksSapient wrote: taking a few peeks into that array should be very speedy, especially when compared to the far greater expense of the initial pathfinding.
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Re: Adding events mid-scenario
Hey — I don't know if you still care, but this is fixed now. From the Micro AI wiki page:Samonella wrote:So apparently goto micro_ais don't work if there is shroud blocking the path?
Of course, 1.13.7 is not quite out yet, but hopefully it won't be too long ...Wesnoth wiki wrote:Before Wesnoth 1.13.7, the Micro AIs did not all work reliably when the AI side is under shroud and it may have been necessary to turn shroud off for the side when using a Micro AI. (Version 1.13.7 and later only) The Micro AIs now all work for sides under shroud. They do this by disregarding shroud for terrain purposes when path finding, consistent with default Wesnoth AI behavior, while still ignoring hidden units (including those hidden under shroud) correctly.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Samonella's questions: currently unsolved
New question: my goal is to make a sort of hand-crafted animation that works independently from preferences->accelerated speed. Basically I want to make the animation always play at the same speed, regardless of the player's set preference.
I do this by using {PLACE_ITEM} to make the frames, with the unit's attack sprites BLIT-ed onto a blank image that's large enough to cover all six hexes he might attack (see the code below). Of course I was initially using [delay] in between each frame, but as I kept removing time between frames, trying to get the right animation speed, I eventually ended up completely removing the [delay]. The code below (without any [delay] at all) actually results in about the speed I want.
(Technically I'm not using {PLACE_ITEM}, instead it's {VOADAR_PLACE_ITEM} which just uses halo= instead of image= so that the image can display over more than one hex. VoaDaR is the acronym of my campaign.)
So my question is why? I'd think that without a [delay] it would cycle through the images invisibly quickly, but a delay is coming from somewhere. Is this just the time it takes my computer to process the IPFs and display the image? In other words, should I be worried about the animation playing faster for someone playing on a faster computer? Or is there some delay built into the redraw that automatically happens?
Why I would want to do such a thing:
(Technically I'm not using {PLACE_ITEM}, instead it's {VOADAR_PLACE_ITEM} which just uses halo= instead of image= so that the image can display over more than one hex. VoaDaR is the acronym of my campaign.)
Code: Select all
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter.png~FL()~RC(magenta>cyan),54,36)" 12 29}
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter-melee-1.png~FL()~RC(magenta>cyan),43,30)" 12 29}
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter-melee-2.png~FL()~RC(magenta>cyan),31,24)" 12 29}
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter-melee-3.png~FL()~RC(magenta>cyan),20,18)" 12 29}
[sound]
name=axe.ogg
[/sound]
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter-melee-4.png~FL()~RC(magenta>cyan),8,12)" 12 29}
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter-melee-5.png~FL()~RC(magenta>cyan),20,18)" 12 29}
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter-melee-5.png~FL()~RC(magenta>cyan),31,24)" 12 29}
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter-melee-6.png~FL()~RC(magenta>cyan),43,30)" 12 29}
{REMOVE_IMAGE 12 29}
{VOADAR_PLACE_IMAGE "blank-big.png~BLIT(units/human-peasants/carpenter.png~FL()~RC(magenta>cyan),54,36)" 12 29}
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Re: Samonella's questions: currently unsolved
Hello again.
Could someone please explain exactly what [variable]contains= does? The wiki says it checks that $name contains the given string value, but does it iterate through $name as an array, to see if any entry is identical to the given string? Or does it check whether the given value is a substring of $name? It doesn't seem to work either way for me, it's just always false.
Could someone please explain exactly what [variable]contains= does? The wiki says it checks that $name contains the given string value, but does it iterate through $name as an array, to see if any entry is identical to the given string? Or does it check whether the given value is a substring of $name? It doesn't seem to work either way for me, it's just always false.
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Re: Samonella's questions: currently unsolved
I have used it as substring check and it has worked.
Re: Samonella's questions: currently unsolved
Thanks for pointing me in the right direction. Turns out I just had a $ where it didn't belong.
Though I think it would be good to clarify that on the wiki.
Though I think it would be good to clarify that on the wiki.
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Re: Samonella's questions: currently unsolved
I have a question about [return].
But it does not. Which seems like undesirable behavior, yes? Is there a way to return without flushing the current event stack down the toilet?
Although I'm not completely clear what the intended behavior is, it seems like the message in the following code should definitely display:The wiki wrote:[return]: Control immediately returns to the Wesnoth engine. No further WML actions are executed in this context. If there was another event queued, that event will be run as usual.
Code: Select all
[event]
name=moveto
[fire_event]
name=return_pls
[/fire_event]
{DEBUG_MSG "Made it back"}
[/event]
[event]
name=return_pls
[return]
[/return]
[/event]
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Samonella's questions: currently unsolved
The intention of [return] is that you'd use it in the midst of a long event inside some [if] or loop structure. The idea is to get out of that [event] block without executing anything else.
In your example, you have an [event] which contains just [return]; which is meaningless.
I would admit that "to the Wesnoth engine" is a bit unclear and should be expanded to explain that *all* [event] blocks terminate.
In your example, you have an [event] which contains just [return]; which is meaningless.
I would admit that "to the Wesnoth engine" is a bit unclear and should be expanded to explain that *all* [event] blocks terminate.
I forked real life and now I'm getting merge conflicts.
Re: Samonella's questions: currently unsolved
I'll just point out that there was no way to know that, just from reading the wiki. It's not mentioned at [return], it's not mentioned at [if]/[switch]/[while] etc. Cross-references and clear explanations may be difficult, but wouldn't concrete examples be possible and easy for whoever implemented whatever feature?Tad_Carlucci wrote:The intention of [return] is that you'd use it in the midst of a long event inside some [if] or loop structure. The idea is to get out of that [event] block without executing anything else.
In your example, you have an [event] which contains just [return]; which is meaningless.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Samonella's questions: currently unsolved
I've updated the wiki, in any case.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Samonella's questions: currently solved
Looks good, thanks! Though I probably would have written "please" instead of "pls" if I had known it would end up on the wiki.Pentarctagon wrote:I've updated the wiki, in any case.
Right, that was just a silly example for making a concise point. Posting my actual code, two events around 100 lines each, would have been pointless. One calls the other, and of course it expects the remainder of itself to be executed regardless of which code paths are taken in the other. Now that I know that's the intended behavior for [return] I guess I'll have to do something messy like wrapping the entire remainder of the second event in an [if].Tad_Carlucci wrote:The intention of [return] is that you'd use it in the midst of a long event inside some [if] or loop structure. The idea is to get out of that [event] block without executing anything else.
In your example, you have an [event] which contains just [return]; which is meaningless.
Kind of defeats the point of [return] if you rarely can use it for fear of messing up other events, doesn't it? It's only useful in very simple situations, when you're not as likely to need it anyway.
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Samonella's questions: currently solved
FixedSamonella wrote:Looks good, thanks! Though I probably would have written "please" instead of "pls" if I had known it would end up on the wiki.Pentarctagon wrote:I've updated the wiki, in any case.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Samonella's questions: currently solved
That's not the conclusion I would draw. No offense to anyone here, but the fact that there is still some confusion illustrates that the example Pentarctagon lifted from Samonella was not helpful and not the kind of example I had in mind.Samonella wrote:Kind of defeats the point of [return] if you rarely can use it for fear of messing up other events, doesn't it? It's only useful in very simple situations, when you're not as likely to need it anyway.
How about a non-trivial example that shows how to use the feature? (Surely the developer who implemented it had a reason to do so, right?)
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Samonella's questions: currently solved
Nor I.
If it were a new tag, I'd quibble over the name: [return] is unfortunate because it has semantics from other programming languages. It means if we ever do add a [function] tag so WML can have true functions, we will either overload the tag with another semantic meaning or we'll need to come up with another tag to do what a function return would do.
If it were a new tag, I'd quibble over the name: [return] is unfortunate because it has semantics from other programming languages. It means if we ever do add a [function] tag so WML can have true functions, we will either overload the tag with another semantic meaning or we'll need to come up with another tag to do what a function return would do.
I forked real life and now I'm getting merge conflicts.
Re: Samonella's questions: currently solved
I guess I just don't see the point of the way the [return] tag works right now, why wouldn't you want it to act like
return;
in any programming language? The only reason you'd want to flush the entire event stack would be if you know precisely which events are on it... and if that's the case, why are they separate events? If the only way the code in event 2 should execute is if event 1 called it in a particular way, doesn't that code belong in event 1?Yeah, this would be nice. Like I said, I'm just not convinced that you'd need, let alone want, a tag that dumps all stacked events. I could post my non-trivial example for wanting to return without said dump, but I think everyone already appreciates this typical (non wml) use of the 'return' keyword.doofus-01 wrote:How about a non-trivial example that shows how to use the feature? (Surely the developer who implemented it had a reason to do so, right?)
The last few months have been nothing but one big, painful reminder that TIMTLTW.
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG