Trying to understand automapping

Hello,

I’m trying to figure out automapping rules. At first I had troubles because it seems that it changed a lot accross versions, and I was reading old tutorials. But eventually I got some basic rule working. But for this case, I can’t figure it out:

I wanna turn the wall of block at the bottom left, to the nice one on the right. It’s a bit different than the automapping tutorials I followed, because it has to happen inside - not outside (or the 2-blocks-thin walls wouldn’t work).

Anyway, I have no idea yet how to make a working rule for this, but I wanted to start simple, and the very first test was to turn the rightmost 2x2 blocks into a nice wall-end.
So I created this basic rule, when there are 4 blocks surrounded on their right by nothing, they change to the wall-end.
And… it does not work.

-however- I found out that it does work if, instead of surrounding those 4 blocks by nothing, I surround them by any tile.
But in the tutorials I followed, it was like “if the editor find this pattern and there is nothing above, then it’s replaced”. But how does it work?
Is it that the region means “there has to be something in the region, but it HAS to be something, anything will work”? What I don’t understand is that it seems to work fine in this tutorial: https://www.youtube.com/watch?v=aQd3pDHhm3c

Has anyone made/met a rule for this kind of wall system btw? Again, the “fill the inner, the outline will be added” cannot work here, because a 2-tiles thick wall would have no inner part.
Also, this was just a first test, but in reality it also can’t work by testing if there is “nothing around the blocks”, because there will be something. Only that something can be anything but a block. I’ve read about the “inputnot” layers, will they allow this to work?

Also: it seems that a rule has to be linked to a specific layer. But can’t a rule apply to any leter (or the selected one maybe)? So that those walls could be replaced in any layer they happen to be in?

Thanks

Edit: it appears that with an additional “inputnot” layer that covers the surrounding, it does work like it should. Even though I still have no idea why without that layer it does not work like in the video tutorial. Note that I had also tried “regions_input” and “regions_output” layers, without more success.

Edit2: it of course doesn’t work well at all if I define all corners, and I would like to know if “NoOverlappingRules” set to true would help, however I have the problem that the editor is entirely localized, and I can’t find where to change it to english, as I suspect that either “NoOverlappingRules” or “true” has been localized, and won’t work if I add it in english(?)

Finally, I believe (correct me if I’m wrong) that what also makes it difficult to work with is that the rules have feedback, that is, the input isn’t a copy of the original input, but the running, current input, to which rules have already been applied.

I’ve more or less given up on the idea of converting a layer’s tiles into others, due to the feedback problem which scales up complexity exponentially. I’m gonna take the input from an extra invisible layer that will mark the tiles to be converted.

Here’s a suggestion that would make it possible to convert a layer’s own tiles into others: a new “OriginalInput[not]_layer”.
OriginalInput would be a copy of the layer before processing the whole map. Using this, feedback wouldn’t be a problem anymore.

Edit: ok, it looks like using an extra layer as the source only makes things worse. Possibly due to bugs, or maybe the ordering of events, I don’t know, but even the simple existence of two input sources, like “input_walls” and “input_auto” makes things not work anymore, even if the new “input_auto” layer is totally empty.

Anyway, here’s what I’d like to achieve. It’s designed in 8x8 (not 16x16, even though the game will work in 16x16).
While I’ve managed to make a rule work for the walls (using only 4 “inputnot_walls” layers), I don’t think it’s possible for the water, because the amount of “inputnot” will scale up logarithmically, as after each pass the input can be this tile from the last result, or this tile, or this other tile, etc.
If I were to make this transformation by code, I wouldn’t use tile indexes, but tile ID’s or group numbers.
An “originalinput_xxx” system would allow to check if neighboring tiles are the single water tile.

But maybe I’m missing something & there is really a way to do this?