Private Sub chkPlanet_Click() If chkPlanet.Value = 1 Then chanceText.Enabled = True If chkPlanet.Value = 0 Then chanceText.Enabled = False End Sub Private Sub cmdCancel_Click() breakFlag = True End Sub Private Sub cmdStar_Click() Dim i, j, k, cnt, planetClass, moonClass, planetChance As Integer Dim noMoons, noPlanets, moon, cntPlanet As Integer Dim noTextures, noRingTextures, lumClass, lumSub As Integer Dim bit As Long Dim r, e, d, planetRadius, starMag, moonRadius, rndColor, varColor, albedo As Double Dim min, sec, ra, dec, mult, axis, axisCount, moonAxis, innerRing, outerRing As Double Dim redAt, greenAt, blueAt, semiAxis, period, rotation, mean, incline, ecc As Double Dim distance, distR, raDist, decDist, multPlanets, lastRadius, lastAxis As Double Dim lumStar, starRadius, starTemp, absMag, appMag, atHeight As Double Dim s As String * 1 Dim decAdd, planetTexture, planetBump, planetSpec, planetColor, errText As String Dim planetClouds, specColor, hazeColor, upColor, skyColor, planetType, lumStr As String Dim moonType, planetNight As String Dim atmosphere, custBool(50) As Boolean 'On Error GoTo errorGenerate breakFlag = False starValue = Val(starText.Text) If starValue < 1 Or starValue > 100000 Then Exit Sub If Val(hipText.Text) < 300001 Or Val(hipText.Text) > 99999999 Then Exit Sub planetBuffer = "" starBuffer = "" planetScript = "" starScript = "" radiusValue = Val(radText.Text) * 2 prgReport.Max = starValue + 1 noTextures = Val(optForm.texText.Text) noRingTextures = Val(optForm.ringText.Text) min = (Val(ramText.Text) / 60) sec = (Val(rasText.Text) / 3600) ra = (Val(rahText.Text) + min + sec) ra = ra * 15 min = (Val(decmText.Text) / 60) sec = (Val(decsText.Text) / 3600) dec = Val(dechText.Text) decAdd = Str(dec) & Str(min + sec) dec = Val(decAdd) magValue = Val(varText.Text) If aText.Text = "" Then aText.Text = "1.0" Randomize Timer If optForm.chkSeed.Value = True Then Randomize Val(optForm.seedText.Text) For i = 1 To starValue DoEvents If breakFlag = True Then breakFlag = False prgReport.Value = 0 prgPlanet.Value = 0 Exit Sub End If If breakFlag = True Then Exit Sub r = Rnd(1) e = Rnd(1) d = Rnd(1) r = r - Rnd(1) e = e - Rnd(1) d = d - Rnd(1) ' 100 / + (starValue - i) r = r / ((radiusValue / Val(cText.Text)) + (starValue - i) / Val(cText.Text)) e = e / ((radiusValue / Val(cText.Text)) + (starValue - i) / Val(cText.Text)) d = d / ((radiusValue / Val(cText.Text)) + (starValue - i) / Val(cText.Text)) r = r * (radiusValue / Val(aText.Text)) '2.75 & 0.65 e = e * (radiusValue / Val(rText.Text)) d = d * (radiusValue * (radiusValue * Val(dText.Text))) d = d * (Val(distText.Text) / (133 * radiusValue)) raValue = ra + r decValue = dec + e distValue = Val(distText.Text) + d specType = Int(100 * Rnd(1)) s = "G" If specType < 1 And specType > -1 Then s = "Q" If specType < 2 And specType > 0 Then s = "O" If specType < 3 And specType > 1 Then s = "B" If specType < 5 And specType > 2 Then s = "A" If specType < 20 And specType > 4 Then s = "F" If specType < 50 And specType > 19 Then s = "G" If specType < 60 And specType > 49 Then s = "K" If specType < 75 And specType > 59 Then s = "M" If specType < 101 And specType > 74 Then s = "R" lumClass = Int(Rnd(1) * 8) lumSub = Int(Rnd(1) * 8) lumStr = "V" If lumClass = 0 Then lumStr = "Ia-O" If lumClass = 1 Then lumStr = "Ia" If lumClass = 2 Then lumStr = "Ib" If lumClass = 3 Then lumStr = "II" If lumClass = 4 Then lumStr = "III" If lumClass = 5 Then lumStr = "IV" If lumClass = 6 Then lumStr = "V" If lumClass = 7 Then lumStr = "VI" If s = "Q" Then lumSub = 0 lumStr = "V" End If If i = 1 And optForm.chkCenter.Value = 1 Then raValue = ra decValue = dec distValue = Val(distText.Text) s = "S" lumSub = 0 lumStr = "V" End If prgReport.Value = i If Len(starScript) > 5000 Then starBuffer = starBuffer & starScript starScript = "" End If starScript = starScript & "# HIP " & (Val(hipText.Text) + i - 1) starScript = starScript & Chr$(13) & Chr$(10) & (Val(hipText.Text) + i - 1) & " {" starScript = starScript & Chr$(13) & Chr$(10) & Chr$(9) & "RA " & Format$(raValue, "0.00000000") starScript = starScript & Chr$(13) & Chr$(10) & Chr$(9) & "Dec " & Format$(decValue, "0.00000000") starScript = starScript & Chr$(13) & Chr$(10) & Chr$(9) & "Distance " & Format$(distValue, "0.0000") starScript = starScript & Chr$(13) & Chr$(10) & Chr$(9) & "SpectralType " & Chr$(34) & s & lumSub & lumStr & Chr$(34) starMag = Int(Val(magText.Text) + ((Rnd(1) * magValue) - (Rnd(1) * magValue))) If s = "Q" Then starMag = starMag + 15 If s = "S" And chkBlack.Value = 1 Then starMag = starMag + 25 If s = "S" And chkBlack.Value = 0 Then starMag = starMag - 10 ' find the luminosity and the radius appMag = starMag absMag = (appMag + 5 - 5 * Log10(distValue / LY_PER_PARSEC)) lumStar = Exp((SOLAR_ABSMAG - absMag) / LN_MAG) Select Case s Case "O" starTemp = oTemp(lumSub) Case "B" starTemp = bTemp(lumSub) Case "A" starTemp = aTemp(lumSub) Case "F" starTemp = fTemp(lumSub) Case "G" starTemp = gTemp(lumSub) Case "K" starTemp = kTemp(lumSub) Case "M" starTemp = mTemp(lumSub) Case "R" starTemp = mTemp(lumSub) Case "S" starTemp = mTemp(lumSub) Case Else starTemp = 10000 End Select starRadius = SOLAR_RADIUS starRadius = starRadius * Sqr(lumStar) starRadius = starRadius * (SOLAR_TEMP / starTemp) ^ 2 starRadius = starRadius / SOLAR_RADIUS starScript = starScript & Chr$(13) & Chr$(10) & Chr$(9) & "AppMag " & Format$(starMag, "0.00") & " # Radii: " & starRadius starScript = starScript & Chr$(13) & Chr$(10) & "}" & Chr$(13) & Chr$(10) If chkPulsar.Value = 1 Then If s = "Q" Then planetScript = planetScript & "# HIP " & (Val(hipText.Text) + i - 1) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(34) & "PSR " & (Val(hipText.Text) + i - 1) & "+" & i & Chr$(34) planetScript = planetScript & " " & Chr$(34) & "HIP " & (Val(hipText.Text) + i - 1) & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & "{" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Mesh " & Chr$(34) & "pulsar.3ds" & Chr$(34) planetRadius = ((starRadius * (distValue / 1000)) * 750000) * 36 planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Radius " & Format$(planetRadius, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Emissive true" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "EllipticalOrbit {" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Period 1000" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "SemiMajorAxis 0.0" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Eccentricity 0.0" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Inclination 0.0" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "RotationPeriod 0.001" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Albedo 1" planetScript = planetScript & Chr$(13) & Chr$(10) & "}" & Chr$(13) & Chr$(10) End If End If If chkBlack.Value = 1 And optForm.chkCenter.Value = 1 Then If i = 1 Then planetScript = planetScript & "# HIP " & (Val(hipText.Text) + i - 1) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(34) & "X " & (Val(hipText.Text) + i - 1) & "+" & i & Chr$(34) planetScript = planetScript & " " & Chr$(34) & "HIP " & (Val(hipText.Text) + i - 1) & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & "{" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Texture " & Chr$(34) & "gc_black.jpg" & Chr$(34) planetRadius = ((starRadius * (distValue / 100)) * 850000) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Radius " & Format$(planetRadius, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Emissive true" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Color [ 0.01 0 0 ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Atmosphere {" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Height " & Format$(planetRadius * 3, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Lower [ 0 0 0 ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Upper [ 0 0 0 ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "EllipticalOrbit {" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Period 1000" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "SemiMajorAxis 10e-" & Format$((starMag / 4), "0") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Eccentricity 0.0" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Inclination 0.0" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "RotationPeriod 0.001" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Albedo 0.01" planetScript = planetScript & Chr$(13) & Chr$(10) & "}" & Chr$(13) & Chr$(10) End If End If planetChance = Int(Rnd(1) * 100) ' Sun must be less than 2 and a half times bigger than our sun to possess planets If chkPlanet.Value = 1 And planetChance < Val(chanceText.Text) And lumClass > 3 And starRadius < 2.1 Then noPlanets = 0 cntPlanet = 0 raDist = (Abs(raValue - ra) / 0.0046) decDist = (Abs(decValue - dec) / 0.004) distance = Abs(distValue - Val(distText.Text)) distR = (raDist + decDist + distance) / 3 multPlanets = Val(radText.Text) / 1.5 'noPlanets = Int(Rnd(1) * (10 * starRadius)) If s = "G" Then noPlanets = Int(Rnd(1) * (10 * starRadius)) If optForm.chkExplicit.Value = 1 Then noPlanets = Int(Rnd(1) * ((20 / multPlanets) * starRadius * (distR / 2))) specColor = "[ 0.8 0.8 0.4 ]" End If 'noPlanets = Int(Rnd(1) * (10 * starRadius)) If s = "F" Then noPlanets = Int(Rnd(1) * (10 * starRadius)) If optForm.chkExplicit.Value = 1 Then noPlanets = Int(Rnd(1) * ((20 / multPlanets) * starRadius * (distR / 2))) specColor = "[ 0.8 0.8 0.4 ]" End If 'noPlanets = Int(Rnd(1) * (10 * starRadius)) If s = "K" Then noPlanets = Int(Rnd(1) * (10 * starRadius)) If optForm.chkExplicit.Value = 1 Then noPlanets = Int(Rnd(1) * ((20 / multPlanets) * starRadius * (distR / 2))) specColor = "[ 0.8 0.8 0.4 ]" End If 'noPlanets = Int(Rnd(1) * (6 * starRadius)) If s = "M" Then noPlanets = Int(Rnd(1) * (6 * starRadius)) If optForm.chkExplicit.Value = 1 Then noPlanets = Int(Rnd(1) * ((12 / multPlanets) * starRadius * (distR / 2))) specColor = "[ 0.8 0.4 0.4 ]" End If 'noPlanets = Int(Rnd(1) * (6 * starRadius)) If s = "R" Then noPlanets = Int(Rnd(1) * (6 * starRadius)) If optForm.chkExplicit.Value = 1 Then noPlanets = Int(Rnd(1) * ((12 / multPlanets) * starRadius * (distR / 2))) specColor = "[ 0.8 0.2 0.2 ]" End If 'noPlanets = Int(Rnd(1) * (3 * starRadius)) If s = "O" Then noPlanets = Int(Rnd(1) * (3 * starRadius)) If optForm.chkExplicit.Value = 1 Then noPlanets = Int(Rnd(1) * ((6 / multPlanets) * starRadius * (distR / 2))) specColor = "[ 0.5 0.5 1 ]" End If 'noPlanets = Int(Rnd(1) * (3 * starRadius)) If s = "B" Then noPlanets = Int(Rnd(1) * (3 * starRadius)) If optForm.chkExplicit.Value = 1 Then noPlanets = Int(Rnd(1) * ((6 / multPlanets) * starRadius * (distR / 2))) specColor = "[ 0.3 0.3 0.8 ]" End If ' 0.5 will produce earthlike world If optForm.chkPlanet.Value = 0 And optForm.chkStar.Value = 0 Then GoTo skipPlanets If noPlanets > 0 And lumClass > 3 Then If noPlanets > 20 Then noPlanets = 20 prgPlanet.Max = noPlanets + 1 lastRadius = 100 lastAxis = starRadius * 0.05 axis = (Rnd(1) * starRadius / 4) + starRadius / 4 For j = 1 To noPlanets DoEvents If breakFlag = True Then prgReport.Value = 0 prgPlanet.Value = 0 breakFlag = False Exit Sub End If prgPlanet.Value = j planetChance = Int(Rnd(1) * 100) planetClass = 7 planetType = "asteroid" If planetChance < 40 And planetChance > -1 And optForm.chkPlanet.Value = 1 Then planetClass = 2 'moontype planetType = "Lunar" End If If planetChance < 55 And planetChance > 39 And optForm.chkPlanet.Value = 1 Then planetClass = 1 'rocky planetType = "Rocky" End If If planetChance < 85 And planetChance > 54 And optForm.chkPlanet.Value = 1 Then planetClass = 0 'jovan planetType = "Gas Giant" End If If planetChance < 101 And planetChance > 84 And optForm.chkPlanet.Value = 1 Then planetClass = 7 'asteroid planetType = "Asteroid" End If planetChance = Int(Rnd(1) * 100) If planetChance < 10 And planetChance > -1 And optForm.chkStar.Value = 1 Then planetClass = 5 'star planetType = "Companion Star" End If If planetChance < 20 And planetChance > 9 And optForm.chkStar.Value = 1 Then planetClass = 6 'brown dwarf planetType = "Substellar Obj" End If ' figure planetary orbits If planetClass = 0 Then planetRadius = (Rnd(1) * 50000) + 50000 If planetClass = 1 Then planetRadius = (Rnd(1) * 10000) + 1000 If planetClass = 2 Then planetRadius = (Rnd(1) * 5000) + 1000 If planetClass = 5 Then planetRadius = (Rnd(1) * 1500000) + 500000 If planetClass = 6 Then planetRadius = (Rnd(1) * 200000) + 100000 If planetClass = 7 Then planetRadius = (Rnd(1) * 400) + 400 semiAxis = lastAxis + (axis * ((starRadius / 4 * (j / 2)) * starRadius)) + _ (planetRadius / 500000 + lastRadius / 500000) If semiAxis > starRadius * 1.5 Then semiAxis = lastAxis + (axis * ((starRadius / 3 * (j ^ 1.5)) * starRadius)) + _ (planetRadius / 250000 + lastRadius / 250000) End If Select Case planetClass Case 1, 2, 7 If semiAxis > (starRadius - 0.3) And semiAxis < starRadius And semiAxis > 0.7 _ And s <> "Q" And optForm.chkPlanet.Value = 1 And starTemp > 5000 And starTemp < 6500 Then planetClass = 3 'earthtype planetType = "Earthlike" End If If semiAxis > (starRadius - 0.6) And semiAxis < (starRadius - 0.3) And semiAxis > 0.5 _ And s <> "Q" And optForm.chkPlanet.Value = 1 And starTemp > 5500 And starTemp < 7000 Then planetClass = 10 'earthtype II planetType = "Desert Planet" End If Case 0 planetChance = Int(Rnd(1) * 100) If planetChance < 34 And j = 1 And optForm.chkPlanet.Value = 1 And starTemp < 7000 Then planetClass = 8 planetType = "Epistellar Giant" semiAxis = starRadius / 20 End If End Select If j = 1 And starTemp < 7001 Then planetChance = Int(Rnd(1) * 100) If planetClass = 1 Or planetClass = 2 And planetChance < 34 And optForm.chkPlanet.Value = 1 Then planetClass = 9 planetType = "Internally Hot" semiAxis = starRadius / 10 End If End If If starTemp > 7000 Then If optForm.chkPlanet.Value = 1 And semiAxis < (0.0015 * starTemp) Then planetClass = 9 planetType = "Internally Hot" End If End If If planetClass = 1 Or planetClass = 2 Then If semiAxis > (0.005 * starTemp) And optForm.chkPlanet.Value = 1 Then planetClass = 4 'arctic planetType = "Arctic" End If End If If planetClass = 3 Then planetRadius = (Rnd(1) * 5000) + 5000 If planetClass = 4 Then planetRadius = (Rnd(1) * 5000) + 1000 If planetClass = 8 Then planetRadius = (Rnd(1) * 50000) + 50000 If planetClass = 9 Then planetRadius = (Rnd(1) * 6000) + 6000 If planetClass = 10 Then planetRadius = (Rnd(1) * 5000) + 5000 lastRadius = planetRadius lastAxis = semiAxis If optForm.chkPlanet.Value = 1 Or optForm.chkStar.Value = 1 Then cntPlanet = cntPlanet + 1 planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(34) & _ Chr$(97 + cntPlanet) & "-" & planetType & Chr$(34) planetScript = planetScript & " " & Chr$(34) & "HIP " & (Val(hipText.Text) + i - 1) & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & "{" 'Texture planetChance = Int(Rnd(1) * noTextures) + 1 If planetClass < 5 Or planetClass = 10 Then planetTexture = dataList.List(planetClass) & Format$(planetChance, "00") & ".jpg" planetBump = dataList.List(planetClass) & Format$(planetChance, "00") & "-bump.jpg" cnt = Int(Rnd(1) * noTextures) + 1 planetClouds = dataList.List(planetClass) & Format$(cnt, "00") & "-clouds.png" planetSpec = "" If planetClass = 0 Or planetClass = 3 Or planetClass = 4 Then planetSpec = dataList.List(planetClass) & Format$(planetChance, "00") & "-spec.jpg" End If End If If planetClass = 5 Then planetTexture = "gc_star.jpg" planetBump = "" If planetClass = 5 Then planetClouds = "no-clouds.png" planetSpec = "" End If If planetClass = 6 Then planetTexture = "gc_gasgt_" & Format$(planetChance, "00") & ".jpg" planetBump = "" If planetClass = 6 Then planetClouds = "gc_gasgt_" & Format$(planetChance, "00") & "-clouds.png" planetSpec = "" End If If planetClass = 7 Then planetTexture = dataList.List(2) & Format$(planetChance, "00") & ".jpg" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Mesh " & Chr$(34) & "asteroid.cms" & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Class " & Chr$(34) & "asteroid" & Chr$(34) End If If planetClass = 8 Then planetTexture = "gc_epigt.jpg" planetBump = "gc_epigt-bump.jpg" planetClouds = "gc_epigt-clouds.png" planetSpec = "gc_epigt-spec.jpg" End If If planetClass = 9 Then planetTexture = dataList.List(planetClass) & Format$(planetChance, "00") & ".jpg" planetBump = dataList.List(planetClass) & Format$(planetChance, "00") & "-bump.jpg" planetNight = dataList.List(planetClass) & Format$(planetChance, "00") & "-night.jpg" planetSpec = dataList.List(planetClass) & Format$(planetChance, "00") & "-spec.jpg" End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Texture " & Chr$(34) & planetTexture & Chr$(34) If planetClass = 9 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "NightTexture " & Chr$(34) & planetNight & Chr$(34) End If If planetClass < 5 Or planetClass > 7 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "BumpMap " & Chr$(34) & planetBump & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "BumpHeight 2" End If If planetClass = 0 Or planetClass = 3 Or planetClass = 4 Or _ planetClass = 8 Or planetClass = 9 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "SpecularTexture " & Chr$(34) & planetSpec & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "SpecularColor " & specColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "SpecularPower 45.0" End If redAt = Rnd(1) * 0.8 greenAt = Rnd(1) * 0.8 blueAt = Rnd(1) * 0.8 albedo = (redAt + greenAt + blueAt) / 3 varColor = albedo / 2 planetColor = "Color [ " & Format$(redAt, "0.00") & " " & Format$(greenAt, "0.00") planetColor = planetColor & " " & Format$(blueAt, "0.00") & " ]" If planetClass = 4 Or planetClass = 7 Then planetColor = "Color [ " & Format$(((Rnd(1) * 0.2) + 0.5), "0.00") planetColor = planetColor & " " & Format$(((Rnd(1) * 0.2) + 0.5), "0.00") planetColor = planetColor & " " & Format$(((Rnd(1) * 0.2) + 0.5), "0.00") planetColor = planetColor & " ]" End If If planetClass = 5 Or planetClass = 6 Then planetColor = "Color [ " & Format$(redAt + 0.2, "0.00") & " " & Format$(greenAt + 0.2, "0.00") planetColor = planetColor & " " & Format$(blueAt + 0.2, "0.00") & " ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Emissive true" End If If planetClass = 6 Then planetColor = "Color [ " & Format$(redAt / 2, "0.00") & " " & Format$(greenAt / 2, "0.00") planetColor = planetColor & " " & Format$(blueAt / 2, "0.00") & " ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Emissive true" varColor = varColor / 2 End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & planetColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "BlendTexture true" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Radius " & Format$(planetRadius, "0.00") ' atmosphere code planetChance = Int(Rnd(1) * 100) atmosphere = False If planetChance < 50 Then atmosphere = True If semiAxis < starRadius / 3 Then atmosphere = False If planetRadius < 1001 Then atmosphere = False If s = "Q" And planetClass <> 0 Then atmosphere = False If planetClass = 4 Or planetClass = 7 Then atmosphere = False If planetClass = 0 Or planetClass = 3 Or planetClass = 5 Or _ planetClass = 6 Or planetClass = 8 Or planetClass = 10 Then atmosphere = True If atmosphere = True Then If planetClass < 5 Or planetClass > 7 Then hazeColor = "[ " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & _ " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " ]" upColor = "[ " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & _ " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " ]" skyColor = "[ " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & _ " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "HazeColor " & hazeColor End If If planetClass < 5 Or planetClass > 8 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "HazeDensity 0.5" End If If planetClass = 8 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "HazeDensity 0.8" End If If planetClass = 5 Then hazeColor = "[ " & Format$(redAt + 0.2, "0.00") & " " & Format$(greenAt + 0.2, "0.00") & _ " " & Format$(blueAt + 0.2, "0.00") & " ]" upColor = "[ " & Format$(Rnd(1) * 1, "0.00") & " " & Format$(Rnd(1) * 1, "0.00") & _ " " & Format$(Rnd(1) * 1, "0.00") & " ]" skyColor = "[ " & Format$(Rnd(1) * 1, "0.00") & " " & Format$(Rnd(1) * 1, "0.00") & _ " " & Format$(Rnd(1) * 1, "0.00") & " ]" End If If planetClass = 6 Then hazeColor = "[ " & Format$(redAt / 2, "0.00") & " " & Format$(greenAt / 2, "0.00") & _ " " & Format$(blueAt / 2, "0.00") & " ]" upColor = "[ " & Format$((Rnd(1) * 1) / 3, "0.00") & " " & Format$((Rnd(1) * 1) / 3, "0.00") & _ " " & Format$((Rnd(1) * 1) / 3, "0.00") & " ]" skyColor = "[ " & Format$((Rnd(1) * 1) / 3, "0.00") & " " & Format$((Rnd(1) * 1) / 3, "0.00") & _ " " & Format$((Rnd(1) * 1) / 3, "0.00") & " ]" End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Atmosphere {" If planetClass < 5 And planetClass > 0 Then atHeight = planetRadius / ((Rnd(1) + 0.5) * 80) If planetClass > 8 Then atHeight = planetRadius / ((Rnd(1) + 0.5) * 80) If planetClass = 5 Then atHeight = planetRadius * 3 If planetClass = 6 Then atHeight = planetRadius / ((Rnd(1) + 0.5) * 10) If planetClass = 0 Or planetClass = 8 Then atHeight = planetRadius / ((Rnd(1) + 0.5) * 35) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Height " & Format$(atHeight, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Lower " & hazeColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Upper " & upColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Sky " & skyColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "CloudHeight " & Format$(atHeight / 10, "0.00") If planetClass < 8 Or planetClass > 8 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "CloudSpeed " & Format$(planetRadius / 133, "0.00") Else planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "CloudSpeed 0" End If planetChance = Int(Rnd(1) * 100) If planetChance < 34 Then If planetClass = 1 Or planetClass = 2 Or planetClass = 9 Then cnt = Int(Rnd(1) * 6) + 1 planetClouds = "gc_gener_" & Format$(cnt, "00") & "-clouds.png" End If End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "CloudMap " & Chr$(34) & planetClouds & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" End If period = Sqr(semiAxis * semiAxis * semiAxis) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "EllipticalOrbit {" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Period " & Format$(period, "0.0000") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "SemiMajorAxis " & Format$(semiAxis, "0.0000") If planetClass < 7 Or planetClass > 7 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Eccentricity " & Format$(((Rnd(1) / 1000) * semiAxis), "0.0000") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Inclination " & Format$(((Rnd(1) / 100) * semiAxis), "0.0000") End If If planetClass = 7 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Eccentricity " & Format$(((Rnd(1) / 100) * semiAxis), "0.0000") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Inclination " & Format$((Rnd(1) * (semiAxis / 10)), "0.0000") End If If planetClass <> 8 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "MeanAnomaly " & Format$((Rnd(1) * 360), "0.00") End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" 'rings If planetClass = 0 Or planetClass = 3 Or planetClass = 6 Or planetClass > 8 Then planetChance = Int(Rnd(1) * 100) If planetChance < 34 And planetRadius > 8000 Then cnt = Int(Rnd(1) * noRingTextures) + 1 planetTexture = "gc_rings_" & Format$(cnt, "00") & ".png" innerRing = planetRadius * 1.2375 * ((Rnd(1) * 0.75) + 1) outerRing = planetRadius * 1.2375 * ((Rnd(1) * 2) + 1) planetColor = "[ " & Format$(varColor + redAt / 3.5, "0.00") & " " & Format$(varColor + greenAt / 3.5, "0.00") planetColor = planetColor & " " & Format$(varColor + blueAt / 3.5, "0.00") & " ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Rings {" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Inner " & Format$(innerRing, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Outer " & Format$(outerRing, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Texture " & Chr$(34) & planetTexture & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Color " & planetColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" End If End If If planetClass < 8 Or planetClass > 8 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "RotationPeriod " & Format$((planetRadius / 250) * ((Rnd(1) * 2) + 1), "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Obliquity " & Format$((Rnd(1) * 90) - (Rnd(1) * 90), "0.00") End If If planetClass = 9 And j > 1 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "RotationPeriod " & Format$((planetRadius / 250) * ((Rnd(1) * 2) + 1), "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Obliquity " & Format$((Rnd(1) * 90) - (Rnd(1) * 90), "0.00") End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Albedo " & Format$(albedo, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & "}" & Chr$(13) & Chr$(10) If Len(planetScript) > 8000 Then planetBuffer = planetBuffer & planetScript planetScript = "" End If End If ' moons If semiAxis > starRadius / 1.5 And planetRadius > 2000 And optForm.chkPlanet.Value = 1 Then If planetClass = 0 Then noMoons = Int(Rnd(1) * ((0.0075 * semiAxis) * (planetRadius / 1000))) + 1 If planetClass = 1 Then noMoons = Int(Rnd(1) * (0.5 * (planetRadius / 1000))) + 1 If planetClass = 2 Then noMoons = Int(Rnd(1) * (1 * (planetRadius / 1000))) + 1 If planetClass = 3 Then noMoons = Int(Rnd(1) * (0.5 * (planetRadius / 1000))) + 1 If planetClass = 4 Then noMoons = Int(Rnd(1) * (0.5 * (planetRadius / 1000))) + 1 If planetClass = 5 Then noMoons = Int(Rnd(1) * ((0.0002 * semiAxis) * (planetRadius / 1000))) + 1 If planetClass = 6 Then noMoons = Int(Rnd(1) * ((0.002 * semiAxis) * (planetRadius / 1000))) + 1 If planetClass = 9 Then noMoons = Int(Rnd(1) * (0.5 * (planetRadius / 1000))) + 1 If planetClass = 10 Then noMoons = Int(Rnd(1) * (0.5 * (planetRadius / 1000))) + 1 If noMoons > 20 Then noMoons = 20 For moon = 1 To noMoons DoEvents If breakFlag = True Then prgReport.Value = 0 prgPlanet.Value = 0 breakFlag = False Exit Sub End If moonClass = 7 moonType = "Asteroid" If planetChance < 10 And planetChance > -1 And planetClass = 5 Then moonClass = 0 'jovan moonType = "Gas Giant" End If If planetChance < 35 And planetChance > 9 Then moonClass = 1 'rocky moonType = "Rocky" End If If planetChance < 55 And planetChance > 34 Then moonClass = 2 'moontype moonType = "Lunar" End If If planetChance < 75 And planetChance > 54 Then moonClass = 7 'asteroid moonType = "Asteroid" End If If planetChance < 101 And planetChance > 74 And _ semiAxis > (0.005 * starTemp) And planetClass <> 5 And _ optForm.chkPlanet.Value = 1 Then moonClass = 4 'arctic moonType = "Arctic" End If If planetClass = 0 Then If semiAxis > (starRadius - 0.3) And semiAxis < starRadius And _ starTemp > 5000 And starTemp < 6500 Then moonClass = 3 'earthtype moonType = "Terrain" End If If semiAxis > (starRadius - 0.6) And semiAxis < (starRadius - 0.3) And _ starTemp > 5500 And starTemp < 7000 Then moonClass = 10 'earthtype moonType = "Sub Terrain" End If End If If planetClass = 5 Then planetChance = Int(Rnd(1) * 100) If moon = 3 And starTemp > 5500 And starTemp < 7000 And planetChance < 34 Then moonClass = 10 'earthtype moonType = "Sub Terrain" End If If moon = 4 And starTemp > 5000 And starTemp < 6500 And planetChance < 34 Then moonClass = 3 'earthtype moonType = "Terrain" End If End If planetScript = planetScript & "# " & moonType planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(34) & "moon " & moon & " of " & Chr$(97 + j) & Chr$(34) planetScript = planetScript & " " & Chr$(34) & "HIP " & (Val(hipText.Text) + i - 1) & "/" & _ Chr$(97 + j) & "-" & planetType & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & "{" 'Texture planetChance = Int(Rnd(1) * noTextures) + 1 planetTexture = dataList.List(moonClass) & Format$(planetChance, "00") & ".jpg" planetBump = dataList.List(moonClass) & Format$(planetChance, "00") & "-bump.jpg" planetClouds = dataList.List(moonClass) & Format$(planetChance, "00") & "-clouds.png" planetSpec = "" If moonClass = 0 Or moonClass = 3 Then planetSpec = dataList.List(moonClass) & Format$(planetChance, "00") & "-spec.jpg" End If If moonClass = 7 Then planetTexture = dataList.List(2) & Format$(planetChance, "00") & ".jpg" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Mesh " & Chr$(34) & "asteroid.cms" & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Class " & Chr$(34) & "asteroid" & Chr$(34) End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Texture " & Chr$(34) & planetTexture & Chr$(34) If moonClass < 5 Or planetClass > 8 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "BumpMap " & Chr$(34) & planetBump & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "BumpHeight 2" End If If moonClass = 0 Or moonClass = 3 Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "SpecularTexture " & Chr$(34) & planetSpec & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "SpecularColor " & specColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "SpecularPower 45.0" End If planetColor = "Color [ " & Format$(Rnd(1) * 0.8, "0.00") & " " & Format$(Rnd(1) * 0.8, "0.00") planetColor = planetColor & " " & Format$(Rnd(1) * 0.8, "0.00") & " ]" redAt = Rnd(1) * 0.8 greenAt = Rnd(1) * 0.8 blueAt = Rnd(1) * 0.8 albedo = (redAt + greenAt + blueAt) / 3 planetColor = "Color [ " & Format$(redAt, "0.00") & " " & Format$(greenAt, "0.00") planetColor = planetColor & " " & Format$(blueAt, "0.00") & " ]" If planetClass = 4 Or moonClass = 7 Then planetColor = "Color [ " & Format$(((Rnd(1) * 0.2) + 0.5), "0.00") planetColor = planetColor & " " & Format$(((Rnd(1) * 0.2) + 0.5), "0.00") planetColor = planetColor & " " & Format$(((Rnd(1) * 0.2) + 0.5), "0.00") planetColor = planetColor & " ]" End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & planetColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "BlendTexture true" If moonClass = 0 Then moonRadius = (Rnd(1) * 50000) + 50000 If moonClass = 1 Then moonRadius = (Rnd(1) * 5000) + 2000 If moonClass = 2 Then moonRadius = (Rnd(1) * 500) + 500 If moonClass = 3 Then moonRadius = (Rnd(1) * 5000) + 3000 If moonClass = 7 Then moonRadius = (Rnd(1) * 200) + 200 If moonClass = 10 Then moonRadius = (Rnd(1) * 5000) + 3000 If moonRadius > (planetRadius / 2) Then moonRadius = moonRadius / 2 planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Radius " & Format$(moonRadius, "0.00") ' atmosphere code for moons planetChance = Int(Rnd(1) * 100) atmosphere = False If planetChance < 50 Then atmosphere = True If moonRadius < 1001 Then atmosphere = False If s = "Q" And moonClass <> 0 Then atmosphere = False If planetClass = 4 Or moonClass = 7 Then atmosphere = False If moonClass = 0 Or moonClass = 3 Or moonClass = 10 Then atmosphere = True If atmosphere = True Then hazeColor = "[ " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & _ " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " ]" upColor = "[ " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & _ " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " ]" skyColor = "[ " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & _ " " & Format$((Rnd(1) * albedo + 0.1), "0.00") & " ]" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "HazeColor " & hazeColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "HazeDensity 0.5" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Atmosphere {" If moonClass < 11 And moonClass > 0 Then atHeight = moonRadius / ((Rnd(1) + 0.5) * 100) If moonClass = 0 Then atHeight = moonRadius / ((Rnd(1) + 0.5) * 50) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Height " & Format$(atHeight, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Lower " & hazeColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Upper " & upColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Sky " & skyColor planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "CloudHeight " & Format$(atHeight / 10, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "CloudSpeed " & Format$(moonRadius / 133, "0.00") planetChance = Int(Rnd(1) * 100) If planetChance < 34 Then If moonClass = 1 Or moonClass = 2 Then cnt = Int(Rnd(1) * 6) + 1 planetClouds = "gc_gener_" & Format$(cnt, "00") & "-clouds.png" End If End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "CloudMap " & Chr$(34) & planetClouds & Chr$(34) planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" End If moonAxis = (planetRadius * 6) * (moon * (moon / 1.75)) * (Rnd(1) + 1) period = moonAxis / 5000 planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "EllipticalOrbit {" planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Period " & Format$(period, "0.0000") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "SemiMajorAxis " & Format$(moonAxis, "0.0000") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Eccentricity " & Format$(((Rnd(1) / 1000) * semiAxis), "0.0000") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "Inclination " & Format$(((Rnd(1) / 100) * semiAxis), "0.0000") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & Chr$(9) & "MeanAnomaly " & Format$((Rnd(1) * 360), "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "}" If moonAxis > (planetRadius * 6.645) Then planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "RotationPeriod " & Format$((moonRadius / 250) * ((Rnd(1) * 2) + 1), "0.00") End If planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Obliquity " & Format$((Rnd(1) * 90) - (Rnd(1) * 90), "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & Chr$(9) & "Albedo " & Format$(albedo, "0.00") planetScript = planetScript & Chr$(13) & Chr$(10) & "}" & Chr$(13) & Chr$(10) If Len(planetScript) > 8000 Then planetBuffer = planetBuffer & planetScript planetScript = "" End If Next moon End If skipPlanets: Next j prgPlanet.Value = 0 End If End If Next i prgReport.Value = 0 prgPlanet.Value = 0 planetBuffer = planetBuffer & planetScript planetScript = "" starBuffer = starBuffer & starScript starScript = "" starData.Text = starBuffer planetData.Text = planetBuffer Exit Sub errorGenerate: errText = "Error " & Err.Description & "! May be due to one or more variables " & _ "defined in boxes R, D or d equal to zero. Please " & _ "check all variables and recompute." errBox.Visible = True errBox.errMsg.Caption = errText End Sub Private Sub cmdView_Click() edForm.Visible = True End Sub Private Sub Form_Load() optForm.Visible = False errBox.Visible = False edForm.Visible = False tipsForm.Visible = False optForm.texText.Text = "4" optForm.ringText.Text = "6" breakFlag = False cfgDir = "c:\Generator" 'values at 1000 ly oTemp(0) = 50000: oTemp(1) = 50000: oTemp(2) = 50000: oTemp(3) = 50000: oTemp(4) = 47000 oTemp(5) = 44500: oTemp(6) = 41000: oTemp(7) = 38000: oTemp(8) = 35800: oTemp(9) = 33000 bTemp(0) = 30000: bTemp(1) = 25400: bTemp(2) = 22000: bTemp(3) = 18700: bTemp(4) = 17000 bTemp(5) = 15400: bTemp(6) = 14000: bTemp(7) = 13000: bTemp(8) = 11900: bTemp(9) = 10500 aTemp(0) = 9520: aTemp(1) = 9230: aTemp(2) = 8970: aTemp(3) = 8720: aTemp(4) = 8460 aTemp(5) = 8200: aTemp(6) = 8020: aTemp(7) = 7850: aTemp(8) = 7580: aTemp(9) = 7390 aTemp(0) = 9520: aTemp(1) = 9230: aTemp(2) = 8970: aTemp(3) = 8720: aTemp(4) = 8460 aTemp(5) = 8200: aTemp(6) = 8020: aTemp(7) = 7850: aTemp(8) = 7580: aTemp(9) = 7390 fTemp(0) = 7200: fTemp(1) = 7050: fTemp(2) = 6890: fTemp(3) = 6740: fTemp(4) = 6590 fTemp(5) = 6440: fTemp(6) = 6360: fTemp(7) = 6280: fTemp(8) = 6200: fTemp(9) = 6110 gTemp(0) = 6030: gTemp(1) = 5940: gTemp(2) = 5860: gTemp(3) = 5830: gTemp(4) = 5800 gTemp(5) = 5770: gTemp(6) = 5700: gTemp(7) = 5630: gTemp(8) = 5570: gTemp(9) = 5410 kTemp(0) = 5250: kTemp(1) = 5080: kTemp(2) = 4900: kTemp(3) = 4730: kTemp(4) = 4590 kTemp(5) = 4350: kTemp(6) = 4200: kTemp(7) = 4060: kTemp(8) = 3990: kTemp(9) = 3920 kTemp(0) = 5250: kTemp(1) = 5080: kTemp(2) = 4900: kTemp(3) = 4730: kTemp(4) = 4590 kTemp(5) = 4350: kTemp(6) = 4200: kTemp(7) = 4060: kTemp(8) = 3990: kTemp(9) = 3920 mTemp(0) = 3850: mTemp(1) = 3720: mTemp(2) = 3580: mTemp(3) = 3470: mTemp(4) = 3370 mTemp(5) = 3240: mTemp(6) = 3050: mTemp(7) = 2940: mTemp(8) = 2640: mTemp(9) = 2600 SOLAR_RADIUS = 696000 SOLAR_TEMP = 5860 SOLAR_ABSMAG = 4.83 LN_MAG = 1.085736 LY_PER_PARSEC = 3.26167 dataList.AddItem "gc_gasgt_" dataList.AddItem "gc_rocky_" dataList.AddItem "gc_moons_" dataList.AddItem "gc_earth_" dataList.AddItem "gc_froze_" dataList.AddItem "gc_subst_" dataList.AddItem "gc_stars_" dataList.AddItem "gc_aster_" dataList.AddItem "gc_epist_" dataList.AddItem "gc_vulca_" dataList.AddItem "gc_deser_" clusterLabel.Text = "(none)" starText.Text = "1000" hipText.Text = "110000" rahText.Text = "00" ramText.Text = "00" rasText.Text = "00.0" dechText.Text = "00" decmText.Text = "00" decsText.Text = "00.0" magText.Text = "20" varText.Text = "5" '13370 distText.Text = "10000" radText.Text = "100" chanceText.Text = "15" rText.Text = "2.75" dText.Text = "0.5" aText.Text = "1.0" cText.Text = "3.0" chanceText.Enabled = False prgReport.min = 0 prgReport.Max = 100 prgPlanet.min = 0 prgPlanet.Max = 100 End Sub Private Sub mnuAbout_Click() frmAbout.Visible = True End Sub Private Sub mnuCustPlan_Click() custForm.Visible = True End Sub Private Sub mnuExit_Click() Dim i As Integer starScript = "" planetScript = "" starBuffer = "" planetBuffer = "" starValue = 0 raValue = 0 decValue = 0 distValue = 0 radiusValue = 0 areaValue = 0 magValue = 0 For i = 1 To 5 qValue(i) = 0 gValue(i) = 0 Next i For i = 1 To 10 oTemp(i) = 0 bTemp(i) = 0 aTemp(i) = 0 fTemp(i) = 0 gTemp(i) = 0 kTemp(i) = 0 mTemp(i) = 0 Next i SOLAR_RADIUS = 0 SOLAR_TEMP = 0 SOLAR_ABSMAG = 0 LN_MAG = 0 specType = 0 cfgSeed = "": cfgStar = "": cfgCenter = "": cfgPlanet = "" cfgExplicit = "": cfgSeedText = "": cfgTex = "": cfgRing = "": cfgDir = "" logLabel = "": logStar = "": logHip = "": logRah = "": logRam = "": logRas = "" logDech = "": logDecm = "": logDecs = "": logMag = "": logVar = "": logDist = "": logRad = "" logChance = "": logR = "": logD = "": logA = "": logC = "" Unload starForm Unload edForm Unload errBox Unload frmAbout Unload optForm Unload tipsForm Unload custForm End End Sub Private Sub mnuLogLoad_Click() On Error GoTo skipLoadError cDialog.Filter = "LogFile|*.log" cDialog.DefaultExt = ".log" 'cDialog.FileName = clusterLabel.Text cDialog.InitDir = cfgDir & "\log" cDialog.Flags = cdlOFNPathMustExist Or cdlOFNOverwritePrompt cDialog.CancelError = True cDialog.ShowOpen If cDialog.FileName <> "" Then Open cDialog.FileName For Input As #4 Input #4, logLabel Input #4, logStar Input #4, logHip Input #4, logRah Input #4, logRam Input #4, logRas Input #4, logDech Input #4, logDecm Input #4, logDecs Input #4, logMag Input #4, logVar Input #4, logDist Input #4, logRad Input #4, logChance Input #4, logR Input #4, logD Input #4, logA Input #4, logC Close #4 End If clusterLabel.Text = logLabel starText.Text = logStar hipText.Text = logHip rahText.Text = logRah ramText.Text = logRam rasText.Text = logRas dechText.Text = logDech decmText.Text = logDecm decsText.Text = logDecs magText.Text = logMag varText.Text = logVar distText.Text = logDist radText.Text = logRad chanceText.Text = logChance rText.Text = logR dText.Text = logD aText.Text = logA cText.Text = logC 'cfgDir = Left$(cDialog.FileName, Len(cDialog.FileName) - Len(cDialog.FileTitle)) skipLoadError: End Sub Private Sub mnuLogSave_Click() On Error GoTo skipSaveError logLabel = clusterLabel.Text logStar = starText.Text logHip = hipText.Text logRah = rahText.Text logRam = ramText.Text logRas = rasText.Text logDech = dechText.Text logDecm = decmText.Text logDecs = decsText.Text logMag = magText.Text logVar = varText.Text logDist = distText.Text logRad = radText.Text logChance = chanceText.Text logR = rText.Text logD = dText.Text logA = aText.Text logC = cText.Text cDialog.Filter = "LogFile|*.log" cDialog.DefaultExt = ".log" cDialog.FileName = clusterLabel.Text cDialog.InitDir = cfgDir & "\log" cDialog.Flags = cdlOFNPathMustExist Or cdlOFNOverwritePrompt cDialog.CancelError = True cDialog.ShowSave If cDialog.FileName <> "" Then Open cDialog.FileName For Output As #4 Print #4, logLabel Print #4, logStar Print #4, logHip Print #4, logRah Print #4, logRam Print #4, logRas Print #4, logDech Print #4, logDecm Print #4, logDecs Print #4, logMag Print #4, logVar Print #4, logDist Print #4, logRad Print #4, logChance Print #4, logR Print #4, logD Print #4, logA Print #4, logC Close #4 End If 'cfgDir = Left$(cDialog.FileName, Len(cDialog.FileName) - Len(cDialog.FileTitle)) skipSaveError: End Sub Private Sub mnuOpt_Click() On Error GoTo configError Open cfgDir & "\global.cfg" For Input As #3 Input #3, cfgSeed Input #3, cfgStar Input #3, cfgCenter Input #3, cfgPlanet Input #3, cfgExplicit Input #3, cfgSeedText Input #3, cfgTex Input #3, cfgRing Close #3 Debug.Print Val(LTrim(Str(cfgSeed))) optForm.chkSeed.Value = Val(LTrim(Str(cfgSeed))) optForm.chkStar.Value = Val(LTrim(Str(cfgStar))) optForm.chkCenter.Value = Val(LTrim(Str(cfgCenter))) optForm.chkPlanet.Value = Val(LTrim(Str(cfgPlanet))) optForm.chkExplicit.Value = Val(LTrim(Str(cfgExplicit))) optForm.seedText.Text = cfgSeedText optForm.texText.Text = cfgTex optForm.ringText.Text = cfgRing optForm.Visible = True Exit Sub configError: Close #3 Open cfgDir & "\global.cfg" For Output As #3 Close #3 optForm.Visible = True End Sub Private Sub mnuReset_Click() breakFlag = False clusterLabel.Text = "(none)" starText.Text = "1000" hipText.Text = "110000" rahText.Text = "00" ramText.Text = "00" rasText.Text = "00.0" dechText.Text = "00" decmText.Text = "00" decsText.Text = "00.0" magText.Text = "20" varText.Text = "5" distText.Text = "10000" radText.Text = "100" chanceText.Text = "15" rText.Text = "2.75" dText.Text = "0.5" aText.Text = "1.0" cText.Text = "2.0" End Sub Private Sub mnuSave_Click() On Error GoTo errorSave cDialog.Filter = "StarCode|*.stc" cDialog.DefaultExt = ".stc" cDialog.FileName = clusterLabel.Text cDialog.InitDir = "c:\Program Files\Celestia\extras\" cDialog.Flags = cdlOFNPathMustExist Or cdlOFNOverwritePrompt cDialog.CancelError = True cDialog.ShowSave If cDialog.FileName <> "" Then Open cDialog.FileName For Output As #1 Print #1, starData.Text Close #1 End If If chkPlanet.Value = 1 Or chkBlack.Value = 1 Or chkPulsar.Value = 1 Then cDialog.Filter = "SolarSystemCode|*.ssc" cDialog.DefaultExt = ".ssc" cDialog.FileName = clusterLabel.Text cDialog.InitDir = "c:\Program Files\Celestia\extras\" cDialog.Flags = cdlOFNPathMustExist Or cdlOFNOverwritePrompt cDialog.CancelError = True cDialog.ShowSave If cDialog.FileName <> "" Then Open cDialog.FileName For Output As #2 Print #2, planetData.Text Close #2 End If End If Exit Sub errorSave: End Sub Private Sub mnuTips_Click() tipsForm.Visible = True End Sub Private Sub mnuView_Click() edForm.Visible = True End Sub Function Log10(X As Double) As Double Log10 = Log(X) / Log(10) End Function