| Mirage Source http://miragesource.net/forums/ |
|
| Clear all Layers http://miragesource.net/forums/viewtopic.php?f=210&t=2538 |
Page 1 of 1 |
| Author: | William [ Sun Aug 26, 2007 2:16 am ] |
| Post subject: | Clear all Layers |
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 |
|
| Author: | Rezeyu [ Sun Aug 26, 2007 2:27 am ] |
| Post subject: | Re: Clear all Layers |
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? |
|
| Author: | William [ Sun Aug 26, 2007 3:06 am ] |
| Post subject: | Re: Clear all Layers |
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 |
|
| Author: | Dragoons Master [ Sun Aug 26, 2007 12:37 pm ] |
| Post subject: | Re: Clear all Layers |
Just one thing for performance, replace the Code: For y = 0 To MAX_MAPY withFor x = 0 To MAX_MAPX If frmMapEditor.optLayers.Value = True Then Code: If frmMapEditor.optLayers.Value = True Then This way it will not check the if max_mapy*max_mapx times... It's the same thing, but little faster(unnoticeable)...
For y = 0 To MAX_MAPY For x = 0 To MAX_MAPX |
|
| Author: | Matt [ Sun Aug 26, 2007 12:44 pm ] |
| Post subject: | Re: Clear all Layers |
Dragoons Master wrote: Just one thing for performance, replace the Code: For y = 0 To MAX_MAPY withFor x = 0 To MAX_MAPX If frmMapEditor.optLayers.Value = True Then Code: If frmMapEditor.optLayers.Value = True Then This way it will not check the if max_mapy*max_mapx times... It's the same thing, but little faster(unnoticeable)...For y = 0 To MAX_MAPY For x = 0 To MAX_MAPX Does it only loop now if the option is selected? Whereas Will's method, had it looping before it checked..? |
|
| Author: | William [ Sun Aug 26, 2007 12:48 pm ] |
| Post subject: | Re: Clear all Layers |
It doesnt really matter |
|
| Author: | Dragoons Master [ Sun Aug 26, 2007 12:49 pm ] |
| Post subject: | Re: Clear all Layers |
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. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|