Page 1 of 1

autotile.lua - Build Rome in a Day!

Posted: Thu Apr 03, 2025 10:38 am
by Alucard648

Image

Autotile.lua is LunaLua API for making blocks called Autotile Seeds and if pattern is provided, these blocks transform into connecting landscape, when level loads. More info in Readme file and example level inside download.
SCREENSHOTS: show
Image
Image
Image
Image
Image
Image
Image
Image
Image
CHANGELOG: show
v1.0.1
Fixed parsing of tilesets made in X2 beta 4 or older.

DOWNLOAD

Credits: CircleFiendo from SMWCentral, for inspiration about workaround for editor incapabilities.

Requires Beta 5 and newer.

Bugs? Issues? Setup questions? Post here.

Have fun putting level building onto industrial rails!


Re: autotile.lua - Build Rome in a Day!

Posted: Thu Apr 03, 2025 4:55 pm
by Squishy Rex
I am really interested in trying this out. Been watching this take shape over on Discord and I can’t wait to mess around with it. I have a few tilesets I want to test it out on to how it handles them. Really nice work, I love all the neat little tools that have been coming out recently.

Re: autotile.lua - Build Rome in a Day!

Posted: Fri Apr 04, 2025 4:29 am
by MegaDood
Looks amazing! However the download link doesn't work.

Re: autotile.lua - Build Rome in a Day!

Posted: Fri Apr 04, 2025 4:35 am
by Alucard648
MegaDood wrote:
Fri Apr 04, 2025 4:29 am
Looks amazing! However the download link doesn't work.
Fixed.

Re: autotile.lua - Build Rome in a Day!

Posted: Fri Apr 04, 2025 7:56 am
by Ice_Blazar
would be interesting to use this.

Re: autotile.lua - Build Rome in a Day!

Posted: Sat Apr 05, 2025 2:53 am
by RunninPigeon
why am i getting this error? Image

Re: autotile.lua - Build Rome in a Day!

Posted: Sat Apr 05, 2025 4:52 am
by Alucard648
RunninPigeon wrote:
Sat Apr 05, 2025 2:53 am
why am i getting this error? Image
What is your SMBX2 version? Mine works on Beta 5 p3
Looks like you used older SMBX2 version.
EDIT: Have you tried to open the level in beta 5 and re-save all tilesets used as autotile patterns?

Re: autotile.lua - Build Rome in a Day!

Posted: Sat Apr 05, 2025 5:17 am
by RunninPigeon
Alucard648 wrote:
Sat Apr 05, 2025 4:52 am
RunninPigeon wrote:
Sat Apr 05, 2025 2:53 am
why am i getting this error? Image
What is your SMBX2 version? Mine works on Beta 5p3
Looks like you used older SMBX2 version.
EDIT: Have you tried to open the level un beta5 and re-save all tilesets used as autotile patterns?
uhhh how do i do that?

Re: autotile.lua - Build Rome in a Day!

Posted: Sat Apr 05, 2025 5:48 am
by Alucard648
RunninPigeon wrote:
Sat Apr 05, 2025 5:17 am
Alucard648 wrote:
Sat Apr 05, 2025 4:52 am
RunninPigeon wrote:
Sat Apr 05, 2025 2:53 am
why am i getting this error? Image
What is your SMBX2 version? Mine works on Beta 5p3
Looks like you used older SMBX2 version.
EDIT: Have you tried to open the level un beta5 and re-save all tilesets used as autotile patterns?
uhhh how do i do that?
1. Update SMBX2 to beta 5 or newer. Better apply latest patches.
2. Launch editor.
3. Open your level in question.
4. Go to tileset item box.
5. For each tileset used as autotile pattern, click on pencil button next to it.
6. Inside tileset editor, hit "save" without editing tileset.

If this bug happed after creating new autotile tileset in B4, this might help.

Re: autotile.lua - Build Rome in a Day!

Posted: Sat Apr 05, 2025 6:47 pm
by RunninPigeon
Alucard648 wrote:
Sat Apr 05, 2025 5:48 am
RunninPigeon wrote:
Sat Apr 05, 2025 5:17 am
Alucard648 wrote:
Sat Apr 05, 2025 4:52 am

What is your SMBX2 version? Mine works on Beta 5p3
Looks like you used older SMBX2 version.
EDIT: Have you tried to open the level un beta5 and re-save all tilesets used as autotile patterns?
uhhh how do i do that?
1. Update SMBX2 to beta 5 or newer. Better apply latest patches.
2. Launch editor.
3. Open your level in question.
4. Go to tileset item box.
5. For each tileset used as autotile pattern, click on pencil button next to it.
6. Inside tileset editor, hit "save" without editing tileset.

If this bug happed after creating new autotile tileset in B4, this might help.
apparently it happens cuz it doesnt scan the tileset again for new changes?
edit: it actually happens bc its looking for [item 0-0] then [item 1-0] instead of [item 0-0] then [0-1]

Re: autotile.lua - Build Rome in a Day!

Posted: Sun Apr 06, 2025 11:11 am
by Alucard648
RunninPigeon wrote:
Sat Apr 05, 2025 6:47 pm
Alucard648 wrote:
Sat Apr 05, 2025 5:48 am
RunninPigeon wrote:
Sat Apr 05, 2025 5:17 am

uhhh how do i do that?
1. Update SMBX2 to beta 5 or newer. Better apply latest patches.
2. Launch editor.
3. Open your level in question.
4. Go to tileset item box.
5. For each tileset used as autotile pattern, click on pencil button next to it.
6. Inside tileset editor, hit "save" without editing tileset.

If this bug happed after creating new autotile tileset in B4, this might help.
apparently it happens cuz it doesnt scan the tileset again for new changes?
edit: it actually happens bc its looking for [item 0-0] then [item 1-0] instead of [item 0-0] then [0-1]
It happens because it tries to look for entry in tileset ID called "type", which denotes item type in tileset(block, BGO, NPC) in mixed tileset (to avoid including NPC IDS, should they happen to be in tileset). This line in each tileset entry is missing in tilesets made in Beta 4 or prior editor. And when script tries to read old tileset, it fails to find line labeled "type" and causes aforementioned error. Re-saving tileset in B5 editor adds those lines for all entries, and script runs normally.
The loading procedure, in fact, reads entries in sequential manner, putting IDs of found entries in respective slots of output 2D array, whose dimensions are defined prior by reading "rows" and "cols" lines in tileset file.

If the error still persists after re-saving all tilesets, check every tileset that is used as pattern by opening it in Notepad++ or other plain text editor. If it has missing " type=* " under each entry, open SMBX2 editor and repeat instructions above.
Example of tileset made in B4: https://drive.google.com/file/d/19xR4ep ... sp=sharing
Example of tileset made in B5: https://drive.google.com/file/d/1opPy83 ... sp=sharing
Open them in Notepad and see how they are structured.

Re: autotile.lua - Build Rome in a Day!

Posted: Fri Apr 11, 2025 9:40 pm
by Alucard648
Double post - small update. Fixed Beta 4 tileset parsing. Check OP for more info.
Anyone could test this script on X2 beta 4 or older versions?