#plugin Clone Selected #author NBOS #desc Clones/duplicates the selected systems Dim b, j, i, sector Randomize sector = GetCurrentSector() j = sector.SelectedCount() For i = 1 to j b = sector.GetSelected(i-1) If not b.Loaded Then sector.DynaLoad( b) End If CloneBody( b) Next Sub CloneBody( o) Dim c c = CreateBody("") o.CopyTo( c) RegenUABI( c) c.x = c.x + 0.5 'shift it over to make it selectable c.y = c.y + 0.5 c.z = c.z + 0.5 c.Selected = false sector.AddSystem( c) c.ModifySystem() End Sub 'Generates Unique ID strings for the new cloned bodies Sub RegenUABI( o) Dim c, i newid = NewUABI() o.IDString = newid n = o.ChildrenCount() For i = 1 to n c = o.GetChild( i-1) RegenUABI( c) Next End Sub Function NewUABI NewUABI = "{" & RandStr(8) & "-" & RandStr(4) & "-" & RandStr(4) & "-" & RandStr(4) & "-" & RandStr(12) & "}" End Function Function RandStr( n) Dim i, c, v c = "0123456789ABCDEF" RandStr = "" For i = 1 to n v = Round( (Rnd() * 16)) + 1 RandStr = RandStr & Mid( c, v, 1) Next End Function