Xudo questions about WML.
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.
Xudo questions about WML.
When I check stderr.txt, I face strange error.
All pieces of code, what can be linked to this problem:
What can be a reason for this error?
Spoiler:
Spoiler:
Last edited by Xudo on September 17th, 2014, 2:56 pm, edited 4 times in total.
Re: Something goes wrong, but I don't know what. Help, please.
To me, that error message usually appears when something is wrong on the unit type(s) in the [side] tag(s), but I am not really sure.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Re: Something goes wrong, but I don't know what. Help, please.
Unsurprisingly, it's this bit:
That's simply not valid syntax. There are no multi-dimensional arrays in WML. If you need a 2-dimensional array, then you need to use something like variable=floor[6].foo[1].
However, the last time I tried, it was impossible to store a unit into a sub-array in the first place. That is, variable=foo[1] simply won't work. I'm sure you can work around that by storing it into a regular variable/array first (variable=foo) and then using [set_variables] to copy it into whatever sub-array you want to place it in.
Code: Select all
variable=floor[6][1]
However, the last time I tried, it was impossible to store a unit into a sub-array in the first place. That is, variable=foo[1] simply won't work. I'm sure you can work around that by storing it into a regular variable/array first (variable=foo) and then using [set_variables] to copy it into whatever sub-array you want to place it in.
Re: Something goes wrong, but I don't know what. Help, please.
It is also possible, though a bit complicated, to turn units into strings and rebuild them.
Re: Something goes wrong, but I don't know what. Help, please.
Today I found, what BfW don' want to store units to cells of array.
wrong syntax.(cause error)
right syntax.
It's good, what know what units will be stored and can create individual variables.
Thanks to all, who answered my post.
Code: Select all
[store_unit]
variable=foo[1]
...
[/store_unit]
Code: Select all
[store_unit]
variable=garbage
...
[/store_unit]
{VARIABLE foo[1] $garbage}
Code: Select all
[store_unit]
variable=foo
...
[/store_unit]
It's good, what know what units will be stored and can create individual variables.
Thanks to all, who answered my post.
Re: Something goes wrong, but I don't know what. Help, please.
It definitely should work. If not, please file a bug report.zookeeper wrote: However, the last time I tried, it was impossible to store a unit into a sub-array in the first place. That is, variable=foo[1] simply won't work. I'm sure you can work around that by storing it into a regular variable/array first (variable=foo) and then using [set_variables] to copy it into whatever sub-array you want to place it in.
FYI, some lesser used features of WML may have been broken by the extensive lua-related changes in 1.7 branch.
The sooner these bugs get reported, the better.
(So we can have a good stable 1.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: Something goes wrong, but I don't know what. Help, please.
Come on, stop putting the blame of every WML failure on Lua...Sapient wrote:It definitely should work. If not, please file a bug report.
FYI, some lesser used features of WML may have been broken by the extensive lua-related changes in 1.7 branch.
How can you expect [store_unit] to store several units (!) into the single variable foo[1]? As zookeeper already explained, there are no multidimensional arrays in WML. So this can't work and this doesn't have anything to do Lua (and this is actually caused by your code written in 2007, e.g. commit 19367).
Re: Something goes wrong, but I don't know what. Help, please.
It is counter-intuitive that [store_unit] cannot store a single unit to a single array position. I'd even consider it a bug. It needs to support more intelligent array operations, much like [set_variables].silene wrote:Come on, stop putting the blame of every WML failure on Lua...Sapient wrote:It definitely should work. If not, please file a bug report.
FYI, some lesser used features of WML may have been broken by the extensive lua-related changes in 1.7 branch.
How can you expect [store_unit] to store several units (!) into the single variable foo[1]? As zookeeper already explained, there are no multidimensional arrays in WML. So this can't work and this doesn't have anything to do Lua (and this is actually caused by your code written in 2007, e.g. commit 19367).
While Lua can't be blamed for everything of course, it was a HUGE RECENT CHANGE and therefore I expect it introduced a fair number of bugs. If it did not, then I will be pleasantly surprised. However, it already has introduced bugs which were detected and presumably fixed, if I recall correctly. My nervousness as we approach 1.8 is nothing personal against you, I promise! I'm just scared of big changes and that is my nature I guess.
In this case, the bug is due to my failure to anticipate this particular usage.
However, I feel that storing to subarrays such as variable=foo1.foo2 should work in the current stable and dev versions. And this was something that did not work before my changes to [store_unit] in 2007. So that is mainly what I wanted to respond to, where zookeeper wrote it would not work, and I say yes it should. Going back over his words now, it seems that by "sub-array" he meant an explicit index of an array, so perhaps I misunderstood him.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: Something goes wrong, but I don't know what. Help, please.
Let's put things into perspective a bit. Lua support is just 2'000 lines isolated in two C++ files. If you want "huge recent change", look at the AI instead, which went from 6'000 lines to 20'000 lines during the 1.7 cycle and which now spans 84 files. Now, what about bugs? On the top of my head, I can think of only two noticeable ones that were caused by the Lua support (dwarf leaders having 1hp and some menu options behaving badly). I don't doubt that other bugs will appear, but for now it is presumably one of the "huge changes" of Wesnoth that has experienced the lowest amount of bugs.Sapient wrote:While Lua can't be blamed for everything of course, it was a HUGE RECENT CHANGE and therefore I expect it introduced a fair number of bugs. If it did not, then I will be pleasantly surprised. However, it already has introduced bugs which were detected and presumably fixed, if I recall correctly.
Re: Something goes wrong, but I don't know what. Continued.
I don't know exactly, but Lua is a interface between developer and Game. WML too.
Lua can have influence on WML, just because it can call to some WML functions/variables/libraries... with new commands. here can be conflict between them. AI just became larger. I don't say, what he haven't bugs, but storing units and choosing target for attack have difference. [acronym="It's my opinion"]IMO[/acronym]
Also want to know bug or not.
I think, what this code
same as
But WML think not. Who right?
Lua can have influence on WML, just because it can call to some WML functions/variables/libraries... with new commands. here can be conflict between them. AI just became larger. I don't say, what he haven't bugs, but storing units and choosing target for attack have difference. [acronym="It's my opinion"]IMO[/acronym]
Also want to know bug or not.
I think, what this code
Spoiler:
Spoiler:
Re: Something goes wrong, but I don't know what. Continued.
WML is right. Fill the truth table of your logical condition if you are not convinced.xudojnik wrote:But WML think not. Who right?
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Something goes wrong, but I don't know what. Continued.
@xudojnik
Note that what you want can probably be achieved more easily by simply filtering with a comma separated list (which also creates the or-condition that you need):
@(somehow) topic:
However, I know that in 1.6, storing a unit to the variables of another unit works:
[store_unit]variable=unit_var
...
[store_unit]variable=unit_var.variables.another_unit_var
...
This should be the same like unit_var[0].variables.another_unit_var, although in my actual code the filter for the second store_unit is built in such a way that there can be only a single matching unit (filtering by id).
Note that what you want can probably be achieved more easily by simply filtering with a comma separated list (which also creates the or-condition that you need):
Code: Select all
[event]
name=moveto
[filter]
x=18,19,20
y=17,18,18
[/filter]
#...
[/event]
However, I know that in 1.6, storing a unit to the variables of another unit works:
[store_unit]variable=unit_var
...
[store_unit]variable=unit_var.variables.another_unit_var
...
This should be the same like unit_var[0].variables.another_unit_var, although in my actual code the filter for the second store_unit is built in such a way that there can be only a single matching unit (filtering by id).
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: Something goes wrong, but I don't know what. Continued.
Yes, the code above is supposed to work, even in 1.8. What doesn't work is unit_var.variables.another_unit_var[17] (notice the index at the end).Anonymissimus wrote:@(somehow) topic:
However, I know that in 1.6, storing a unit to the variables of another unit works:
[store_unit]variable=unit_var.variables.another_unit_var
Re: Something goes wrong, but I don't know what. Continued.
I check conditional variable before "filtering", but you give me nice idea... Now I make my code more simple to read.
Re: Something goes wrong, but I don't know what. Continued.
Now I face "20091213 20:34:37 error engine: failed to auto-store $unit at (-999,-999)" in stderr.txt (65MB of this strings)
I think, what this message appear, because some event haven't attributes x and y. But I have no idea where and what can be broken. Or there are some infinity cycle with broken action.
Someone face this error before? If you solve this problem, tell me where can I search my mistake, or tell me how do you fix this.
I think, what this message appear, because some event haven't attributes x and y. But I have no idea where and what can be broken. Or there are some infinity cycle with broken action.
Someone face this error before? If you solve this problem, tell me where can I search my mistake, or tell me how do you fix this.