Mirage Engine
Clear all Layers - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Clear all Layers (/showthread.php?tid=1209)



Clear all Layers - William - 26-08-2007

GSD tutorial for extra layers is needed, or you'll have to figure out which once you dont need. This code uses more layers than a unedited MSE1.

Add a new command button to the map editor, put this in it:
Code:
Dim y As Long
Dim x As Long
For y = 0 To MAX_MAPY
    For x = 0 To MAX_MAPX
        If frmMapEditor.optLayers.Value = True Then
            With Map.Tile(x, y)
                .Ground = 0
                .Mask = 0
                .Anim = 0
                .Mask2 = 0
                .M2Anim = 0
                .Fringe = 0
                .FAnim = 0
                .Fringe2 = 0
                .F2Anim = 0
            End With
        End If
    Next x
Next y



Re: Clear all Layers - Rezeyu - 26-08-2007

Isn't this the same as the "One-Button clear layer/Attribute button" tutorial that DarkX posted?

EDIT: I mean, I know it's different code, your's looks alot simpler, but I meant, doesn't it do the same thing?


Re: Clear all Layers - William - 26-08-2007

Dunno, guess there is a clear layer button. But I think his code removes the tiles from the option box thats checked. This will remove all the tiles, so you dont need to delete the map.

Just felt like posting it Tongue


Re: Clear all Layers - Dragoons Master - 26-08-2007

Just one thing for performance, replace the
Code:
For y = 0 To MAX_MAPY
    For x = 0 To MAX_MAPX
        If frmMapEditor.optLayers.Value = True Then
with
Code:
If frmMapEditor.optLayers.Value = True Then
    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
This way it will not check the if max_mapy*max_mapx times... It's the same thing, but little faster(unnoticeable)...


Re: Clear all Layers - Matt - 26-08-2007

Dragoons Master Wrote:Just one thing for performance, replace the
Code:
For y = 0 To MAX_MAPY
    For x = 0 To MAX_MAPX
        If frmMapEditor.optLayers.Value = True Then
with
Code:
If frmMapEditor.optLayers.Value = True Then
    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
This way it will not check the if max_mapy*max_mapx times... It's the same thing, but little faster(unnoticeable)...

Does it only loop now if the option is selected? Whereas Will's method, had it looping before it checked..?


Re: Clear all Layers - William - 26-08-2007

It doesnt really matter Tongue


Re: Clear all Layers - Dragoons Master - 26-08-2007

Will's checks it the condition is true every time it loops, and it will always loop, no matter what. With the If before the loops it will only loop if the condition is true, and this if it made only once.