Re: [nbos] Atmospheres."Mike Oliver" Tue Jan 30th, 2007I am familiar with VB6 but haven't used it for a while but I've not tried script writing yet. Dennis would need to own VB to run this unless he knows how to write scripts. I agree, from what I know, it should be convertible without too much trouble. Cheers, Mike -----Original Message----- From: nbossoftware-bounces-at-nbos.com [mailto:nbossoftware-bounces-at-nbos.com] On Behalf Of W. Mark Woodhouse Sent: 30 January 2007 14:35 To: nbossoftware-at-nbos.com Subject: Re: [nbos] Atmospheres. I'm not a pro at this sort of thing, but I did this using the following code (this is VB, but it's really simple and would easily translate into most scripting languages): Function ParseAtmo(AS_AtmoNote As String, AS_Pressure As Single, AS_Temp As Integer) As String Dim AC(1 To 20) As String Dim AC_Txt(1 To 20) As String Dim AC_Qty(1 To 20) As Single If AS_AtmoNote Like "*None*" Then ParseAtmo = "0: Vacuum" Exit Function End If unparsed = AS_AtmoNote K = 1 'strip pressure unparsed = Mid(unparsed, InStr(1, unparsed, "(") + 1) 'strip trailing parens unparsed = Left(unparsed, Len(unparsed) - 1) While Len(unparsed) > 0 C = InStr(1, unparsed, "%") If C > 0 Then AC(K) = Mid(unparsed, 1, C - 1) K = K + 1 Else AC(K) = Mid(unparsed, 1) End If unparsed = Mid(unparsed, C + 2) Wend For K = 1 To 20 If Len(AC(K)) > 0 Then AC(K) = Trim(AC(K)) Brk = InStr(1, AC(K), " ") AC_Txt(K) = Trim(Left(AC(K), Brk)) AC_Qty(K) = Trim(Mid(AC(K), Brk + 1)) End If Next K 'Components separated. Now test for conditions. If AS_Pressure < 0.1 Then 'trace/vacuum ParseAtmo = "1: Trace" Exit Function End If 'Test for various gases Nitrogen = False Pct_Nitrogen = 0 Oxygen = False PCt_Oxygen = 0 CO2 = False Pct_CO2 = 0 Inert = False PCt_Inert = 0 Co = False Pct_CO = 0 Nitrates = False Pct_Nitrates = 0 Sulfoxides = False Pct_Sulfoxides = 0 Sulfides = False Pct_Sulfides = 0 Hydrocarbons = False Pct_HC = 0 Ammonia = False Pct_Ammonia = 0 Helium = False Pct_He = 0 Hydrogen = False Pct_H2 = 0 For K = 1 To 20 If AC_Txt(K) Like "N2*" Then Nitrogen = True Pct_Nitrogen = AC_Qty(K) ElseIf AC_Txt(K) Like "O2*" Then Oxygen = True PCt_Oxygen = AC_Qty(K) ElseIf AC_Txt(K) Like "CO2*" Then CO2 = True Pct_CO2 = AC_Qty(K) ElseIf Left(AC_Txt(K), 2) = "Ar" Or Left(AC_Txt(K), 2) = "Xe" Or Left(AC_Txt(K), 2) = "Kr" Or Left(AC_Txt(K), 2) = "Ne" Then Inert = True PCt_Inert = PCt_Inert + AC_Qty(K) ElseIf Left(AC_Txt(K), 2) = "CO" Then Co = True Pct_CO = AC_Qty(K) ElseIf AC_Txt(K) Like "NO*" Then Nitrates = True Pct_Nitrates = Pct_Nitrates + AC_Qty(K) ElseIf AC_Txt(K) Like "SO*" Then Sulfoxides = True Pct_Sulfoxides = Pct_Sulfoxides + AC_Qty(K) ElseIf AC_Txt(K) Like "H2S*" Then Sulfides = True Pct_Sulfides = AC_Qty(K) ElseIf AC_Txt(K) Like "CH*" Then Hydrocarbons = True Pct_Hydrocarbons = Pct_Hydrocarbons + AC_Qty(K) ElseIf AC_Txt(K) Like "NH*" Then Ammonia = True Pct_Ammonia = Pct_Ammonia + AC_Qty(K) ElseIf AC_Txt(K) Like "He*" Then Helium = True Pct_Helium = AC_Qty(K) PCt_Inert = PCt_Inert + AC_Qty(K) ElseIf AC_Txt(K) Like "H2 *" Then Hydrogen = True Pct_H2 = Pct_H2 + AC_Qty(K) End If Next K 'Identify Tainted, Corrosive, and Insidious Atmospheres Tainted = False If Pct_CO + Pct_Hydrocarbons + Pct_Ammonia + Pct_Sulfides + Pct_Nitrates + Pct_Sulfoxides > 5 Then Tainted = True Corrosive = False If Pct_CO + Pct_Sulfoxides + Pct_Nitrates > 30 Then Corrosive = True If Pct_Ammonia > 30 Or Pct_Hydrocarbons > 30 Or (PCt_Oxygen > 70 And AS_Temp > 400) Then Corrosive = True If AS_Temp > 500 Then Corrosive = True If Pct_H2 > 50 And Temp > 300 And AS_Pressure > 6 Then Corrosive = True Insidious = False If Pct_Hydrocarbons > 20 Or (Corrosive And AS_Temp > 600) Or (Corrosive And AS_Pressure > 2.5) Then Insidious = True Breathable = False If PCt_Oxygen > 12 Then Breathable = True 'Now Start Assigning the other UWP Atmo Codes If AS_Pressure <= 0.42 And Breathable Then If Tainted Then ParseAtmo = "2: Very Thin, Tainted" Else ParseAtmo = "3: Very Thin" End If ElseIf AS_Pressure <= 0.7 And Breathable Then If Tainted Then If Corrosive Then If Insidious Then ParseAtmo = "C: Insidious" Else ParseAtmo = "B: Corrosive" End If Else ParseAtmo = "4: Thin, Tainted" End If Else ParseAtmo = "5: Thin" End If ElseIf AS_Pressure <= 1.49 And Breathable Then If Tainted Then If Corrosive Then If Insidious Then ParseAtmo = "C: Insidious" Else ParseAtmo = "B: Corrosive" End If Else ParseAtmo = "7: Standard, Tainted" End If Else ParseAtmo = "6: Standard" End If ElseIf AS_Pressure <= 2.49 And Breathable Then If Tainted Then If Corrosive Then If Insidious Then ParseAtmo = "C: Insidious" Else ParseAtmo = "B: Corrosive" End If Else ParseAtmo = "9: Dense, Tainted" End If Else ParseAtmo = "8: Dense" End If ElseIf Insidious Then ParseAtmo = "C: Insidious" ElseIf Corrosive Then ParseAtmo = "B: Corrosive" ElseIf Breathable Then ParseAtmo = "D: Dense, High" Else ParseAtmo = "A: Exotic" End If End Function Mike Oliver wrote: > Well, really, you can change them to anything you want. You don't even > seem to need chemical symbols. Your main problem, I guess, is lack of > knowledge of the science. That's not a disaster if you're the GM, as > long as you know what you want the atmosphere to do to/for your players > :-) > > It's something I can't really guide you on - try a web page that deals > with planetary atmospheres and see where that takes you. > > Cheers, > > Mike > > [Dennis] That's why I'm asking these questions...I need to know > what I can change them to. > _______________________________________________ > Nbossoftware mailing list > > > > > > _______________________________________________ > Nbossoftware mailing list > > > > > _______________________________________________ Nbossoftware mailing list _______________________________________________ Nbossoftware mailing list
Copyright © 2003-2007, NBOS Software. All rights reserved. 'Fractal Mapper', 'ScreenMonkey', 'Character Sketcher', 'Inspiration Pad', 'Fractal World Explorer', 'Goblin API', 'AstroSynthesis' are trademarks of NBOS Software. 'Dwarven Beserker' art by V. Shane.