#plugin Quick Generate #author NBOS #desc Generates random systems until the Escape key is pressed '#button ExampleStuff\QuickGenerate.bmp oSector = GetCurrentSector() oSector.RenderMessageSmall = "Press 'Esc' to quit" i = 0 Do While True k = GetKey() if k = 27 then Exit Do 'put ProcessMessags before intensive operations (making a system, creating a surface map) 'to allow the program to respond to the cancel script button. 'make sure you put it before the actual call to the operation so it doesnt interfere 'with checking for a key press above. ProcessMessages i = i + 1 o = CreateBody("") 'creates an 'unassigned' body o.x = (RollDice( 1, oSector.SizeX * 100, 0) / 100) - (oSector.SizeX / 2) o.y = (RollDice( 1, oSector.SizeY * 100, 0) / 100) - (oSector.SizeY / 2) o.z = (RollDice( 1, oSector.SizeZ * 100, 0) / 100) - (oSector.SizeZ / 2) oSector.AddSystem o 'add system to the sector RandomSystem o, true 'run the system through the built-in astro generator, w/ populations 'if system is populated, change the label color if o.ChildPopulation > 0 then o.LabelColor = rgb( 255, 128, 0) end if 'do this so that astro can keep track of things like populations & political affiliations more efficiently o.UpdateRootBody oSector.RenderMessageBig = "Generating System " & i & ": " & NameFromBodyType( o.TypeID) RefreshScene 'check to see if Escape key was pressed Loop oSector.UpdateVisibleCount UpdateCaption oSector.RenderMessageBig = "" oSector.RenderMessageSmall = "" RefreshScene