Mirage Source
1Fill/1Clear button - Printable Version

+- Mirage Source (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: 1Fill/1Clear button (/showthread.php?tid=361)



1Fill/1Clear button - DarkX - 14-10-2006

Tutorial By: DarkX
Codes Tested on: MS3.0.3.;MS3.0.7. and MSE They all worked

Ok I was getting annoyed with havingto re-edit the code in each thing, when I added a new layer or attribute, so I decided to write up a code that makes it so you only have to use one of the buttons.

Code:
Private Sub cmdFill_Click()
Dim Y As Long
Dim X As Long

X = MsgBox("Are you sure you want to fill the map?", vbYesNo)
If X = vbNo Then
    Exit Sub
End If

If optAttribs.Value = False Then
    For Y = 0 To MAX_MAPY
        For X = 0 To MAX_MAPX
            With Map.Tile(X, Y)
                If optGround.Value = True Then .Ground = EditorTileY * 14 + EditorTileX
                If optMask.Value = True Then .Mask = EditorTileY * 14 + EditorTileX
                If optAnim.Value = True Then .Anim = EditorTileY * 14 + EditorTileX
                If optMask2.Value = True Then .Mask2 = EditorTileY * 14 + EditorTileX
                If optM2Anim.Value = True Then .M2Anim = EditorTileY * 14 + EditorTileX
                If optFringe.Value = True Then .Fringe = EditorTileY * 14 + EditorTileX
                If optFAnim.Value = True Then .FAnim = EditorTileY * 14 + EditorTileX
                If optFringe2.Value = True Then .Fringe2 = EditorTileY * 14 + EditorTileX
                If optF2Anim.Value = True Then .F2Anim = EditorTileY * 14 + EditorTileX
            End With
        Next X
    Next Y
Else
        For Y = 0 To MAX_MAPY
            For X = 0 To MAX_MAPX
                With Map.Tile(X, Y)
                  If frmMirage.optBlocked.Value = True Then .Type = TILE_TYPE_BLOCKED
                  If frmMirage.optWarp.Value = True Then .Type = TILE_TYPE_WARP
                  If frmMirage.optKill.Value = True Then .Type = TILE_TYPE_KILL
                  If frmMirage.optItem.Value = True Then .Type = TILE_TYPE_ITEM
                  If frmMirage.optHeal.Value = True Then .Type = TILE_TYPE_HEAL
                  If frmMirage.optNpcAvoid.Value = True Then .Type = TILE_TYPE_NPCAVOID
                  If frmMirage.optKey.Value = True Then .Type = TILE_TYPE_KEY
                  If frmMirage.optKeyOpen.Value = True Then .Type = TILE_TYPE_KEYOPEN
            End With
        Next X
    Next Y
End If
End Sub
This is the code for 1 fill button for both attribute and layers.

PART 2

Also I made a code that makes use of only using one cmdClear button, the code is rather simple, here it is.
Code:
Private Sub cmdClear_Click()
If optAttribs.Value = False Then
    Call EditorClearLayer
    Else
    Call EditorClearAttribs
  End If
End Sub
Most of you are probably saying, how stupid is that, if you don't like it don't use it, if you feel free.