autotile.lua - Build Rome in a Day!

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

Alucard648
Flurry
Flurry
Posts: 181
Joined: Sun Aug 16, 2015 3:45 am

autotile.lua - Build Rome in a Day!

Postby Alucard648 » Thu Apr 03, 2025 10:38 am

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!

Last edited by Alucard648 on Sun Apr 13, 2025 7:09 pm, edited 7 times in total.

Squishy Rex
Tellah
Tellah
Posts: 1985
Joined: Sat Dec 21, 2013 4:30 am
Pronouns: he/him
Contact:

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

Postby Squishy Rex » Thu Apr 03, 2025 4:55 pm

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.

MegaDood
Charged Spiny
Charged Spiny
Posts: 1831
Joined: Wed Nov 01, 2017 2:43 am

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

Postby MegaDood » Fri Apr 04, 2025 4:29 am

Looks amazing! However the download link doesn't work.

Alucard648
Flurry
Flurry
Posts: 181
Joined: Sun Aug 16, 2015 3:45 am

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

Postby Alucard648 » Fri Apr 04, 2025 4:35 am

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

Ice_Blazar
Shy Guy
Shy Guy
Posts: 8
Joined: Wed Sep 04, 2024 10:46 am
Pronouns: he/him

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

Postby Ice_Blazar » Fri Apr 04, 2025 7:56 am

would be interesting to use this.

RunninPigeon
Fighter Fly
Fighter Fly
Posts: 30
Joined: Fri Mar 05, 2021 7:55 am
Flair: I play Video Games and draw sometimes.
Pronouns: He/Him

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

Postby RunninPigeon » Sat Apr 05, 2025 2:53 am

why am i getting this error? Image

Alucard648
Flurry
Flurry
Posts: 181
Joined: Sun Aug 16, 2015 3:45 am

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

Postby Alucard648 » 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 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?
Last edited by Alucard648 on Sat Apr 05, 2025 5:38 am, edited 1 time in total.

RunninPigeon
Fighter Fly
Fighter Fly
Posts: 30
Joined: Fri Mar 05, 2021 7:55 am
Flair: I play Video Games and draw sometimes.
Pronouns: He/Him

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

Postby RunninPigeon » 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?

Alucard648
Flurry
Flurry
Posts: 181
Joined: Sun Aug 16, 2015 3:45 am

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

Postby Alucard648 » 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
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.

RunninPigeon
Fighter Fly
Fighter Fly
Posts: 30
Joined: Fri Mar 05, 2021 7:55 am
Flair: I play Video Games and draw sometimes.
Pronouns: He/Him

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

Postby RunninPigeon » 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
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]

Alucard648
Flurry
Flurry
Posts: 181
Joined: Sun Aug 16, 2015 3:45 am

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

Postby Alucard648 » Sun Apr 06, 2025 11:11 am

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.

Alucard648
Flurry
Flurry
Posts: 181
Joined: Sun Aug 16, 2015 3:45 am

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

Postby Alucard648 » Fri Apr 11, 2025 9:40 pm

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?


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari