Time (script)

From Elanthipedia
Revision as of 00:20, 15 July 2009 by Maintenance script (talk | contribs) (Created page with 'Converts IC to Real time and vice versa. <blockquote> ##################################################### # # # ...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Converts IC to Real time and vice versa.

  1. #
  2. Time - 7/17/2009 #
  3. Maje #
  4. #
  5. Converts IC to Real time and vice versa
  6. Note - Does not convert times prior to 1/1/1996
  7. Things to Fix:
  8. Fudge factor causes formula errors near the end of REAL years
  9. Loss of 1 day per year
  10. Changes:
  11. 05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)~#

action setvar ICYear $1; setvar ICDay $2 when ^It has been (\d+) years, (\d+) days since the Victory of Lanival the Redeemer action setvar ICMonth $1 when ^It is the (\d+)th month of (.*) in the year of

action setvar RealMonth $1;setvar RealDay $2; setvar RealYear $3; setvar RealHour $4 when (\d+)/(\d+)/(\d+) (\d+)

setvar consICDay 192 setvar consICYear 345 setvar consICTotal 138206

setvar consRealMonth 1 setvar consRealDay 1 setvar consRealYear 1996 setvar consRealHour 0 setvar FudgeFactor 1537

setvar consJanLen 31 setvar consFebLen 28 setvar consMarchLen 31 setvar consAprilLen 30 setvar consMayLen 31 setvar consJuneLen 30 setvar consJulyLen 31 setvar consAugLen 31 setvar consSeptLen 30 setvar consOctLen 31 setvar consNovLen 30 setvar consDecLen 31

  1. 05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)~~#

Main: gosub Input gosub Convert gosub Report exit

  1. 05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)~~#

Input:

Input.Menu: echo Enter the number for what you'd like to convert: echo echo 1. Convert IC time to Real time echo 2. Convert Real time to IC time matchre Input.IC 1 matchre Input.Real 2 matchwait

Input.IC: setvar Input IC echo Enter the in game time text: echo echo Example - It has been 394 years, 384 days since the Victory of Lanival the Redeemer. matchre Input.Done Lanival the Redeemer matchwait

Input.Real: setvar Input Real echo Enter the real time: echo echo Use military time without minutes - July 14th, 2009 6:00 pm... echo Example - 7/14/2009 18 match Input.Done / matchwait

Input.Done: return

  1. 05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)~~#

Convert: if "%Input" == "IC" then gosub Convert.ICtoReal else gosub Convert.RealtoIC return

Convert.ICtoReal: gosub Convert.ICtoReal.CalcICDays gosub Convert.ICtoReal.CalcRealDays gosub Convert.ICtoReal.FindYear gosub Convert.ICtoReal.FindMonth

Convert.ICtoReal.CalcICDays: evalmath Days.Current %ICDay + %ICYear * 400 evalmath numDays %Days.Current - %consICTotal return

Convert.ICtoReal.CalcRealDays: setvar Days.Real.Part %numDays math Days.Real.Part modulus 4 evalmath Days.Real %numDays / 4 return

Convert.ICtoReal.FindYear: setvar tempYear 1996 setvar tempDays %Days.Real gosub Convert.ICtoReal.FindYear.CalcYear setvar RealYear %tempYear setvar RealDay %tempDays return

Convert.ICtoReal.FindYear.CalcYear: if %tempDays < 365 then return setvar tempLeap %tempYear math tempLeap modulus 4 if %tempLeap == 0 then { evalmath tempDays %tempDays - 366 } else { evalmath tempDays %tempDays - 365 } math tempYear add 1 gosub Convert.ICtoReal.FindYear.CalcYear return

Convert.ICtoReal.FindMonth: setvar tempMonth 1 if %tempDays >= %consJanLen then { evalmath tempDays %tempDays - %consJanLen math tempMonth add 1 } if %tempDays >= %consFebLen then { setvar tempLeap %RealYear math tempLeap modulus 4 if %tempLeap == 0 then { evalmath tempDays %tempDays - %consFebLen - 1 } else { evalmath tempDays %tempDays - %consFebLen } math tempMonth add 1 } if %tempDays >= %consMarchLen then { evalmath tempDays %tempDays - %consMarchLen math tempMonth add 1 } if %tempDays >= %consAprilLen then { evalmath tempDays %tempDays - %consAprilLen math tempMonth add 1 } if %tempDays >= %consMayLen then { evalmath tempDays %tempDays - %consMayLen math tempMonth add 1 } if %tempDays >= %consJuneLen then { evalmath tempDays %tempDays - %consJuneLen math tempMonth add 1 } if %tempDays >= %consJulyLen then { evalmath tempDays %tempDays - %consJulyLen math tempMonth add 1 } if %tempDays >= %consAugLen then { evalmath tempDays %tempDays - %consAugLen math tempMonth add 1 } if %tempDays >= %consSeptLen then { evalmath tempDays %tempDays - %consSeptLen math tempMonth add 1 } if %tempDays >= %consOctLen then { evalmath tempDays %tempDays - %consOctLen math tempMonth add 1 } if %tempDays >= %consNovLen then { evalmath tempDays %tempDays - %consNovLen math tempMonth add 1 } if %tempDays >= %consDecLen then { evalmath tempDays %tempDays - %consDecLen math tempMonth add 1 } setvar RealMonth %tempMonth setvar RealDay %tempDays return

Convert.RealtoIC: setvar numDays 0 setvar tempYear %consRealYear setvar tempMonth %consRealMonth setvar tempDay %consRealDay gosub Convert.RealtoIC.CalcRealYears gosub Convert.RealtoIC.CalcRealMonths gosub Convert.RealtoIC.CalcRealHours gosub Convert.RealtoIC.CalcICTime return

Convert.RealtoIC.CalcRealYears: if %tempYear < %RealYear then { setvar tempLeap %tempYear math tempLeap modulus 4 if %tempLeap == 0 then { evalmath numDays %numDays + 366 * 4 } else { evalmath numDays %numDays + 365 * 4 } math tempYear add 1 gosub Convert.RealtoIC.CalcRealYears } return

Convert.RealtoIC.CalcRealMonths: if %tempMonth < %RealMonth then { if %tempMonth == 1 then { evalmath numDays %numDays + %consJanLen * 4 } if %tempMonth == 2 then { setvar tempLeap %RealYear math tempLeap modulus 4 if %tempLeap == 0 then { evalmath numDays %numDays + (%consFebLen + 1) * 4 } else { evalmath numDays %numDays + %consFebLen * 4 } } if %tempMonth == 3 then { evalmath numDays %numDays + %consMarchLen * 4 } if %tempMonth == 4 then { evalmath numDays %numDays + %consAprilLen * 4 } if %tempMonth == 5 then { evalmath numDays %numDays + %consMayLen * 4 } if %tempMonth == 6 then { evalmath numDays %numDays + %consJuneLen * 4 } if %tempMonth == 7 then { evalmath numDays %numDays + %consJulyLen * 4 } if %tempMonth == 8 then { evalmath numDays %numDays + %consAugLen * 4 } if %tempMonth == 9 then { evalmath numDays %numDays + %consSeptLen * 4 } if %tempMonth == 10 then { evalmath numDays %numDays + %consOctLen * 4 } if %tempMonth == 11 then { evalmath numDays %numDays + %consNovLen * 4 } math tempMonth add 1 gosub Convert.RealtoIC.CalcRealMonths } else { evalmath numDays %numDays + %RealDay * 4 } return

Convert.RealtoIC.CalcRealHours: evalmath numDays %numDays + (%RealHour / 24) return

Convert.RealtoIC.CalcICTime: evalmath tempYear %numDays / 400 math numDays modulus 400 evalmath tempYear %tempYear - (%numDays / 400) evalmath ICYear %tempYear + %consICYear evalmath ICDay %numDays + (400 - %consICDay) return

  1. 05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)05:20, 15 July 2009 (UTC)~~#

Report: gosub Report.GetMonth gosub Report.Print return

Report.GetMonth: evalmath tempMonth %ICDay / 40 setvar numDays %tempMonth math numDays modulus 1 evalmath tempMonth %tempMonth - %numDays if %tempMonth == 0 then setvar ICMonth Akroeg the Ram if %tempMonth == 1 then setvar ICMonth Ka'len the Sea Drake if %tempMonth == 2 then setvar ICMonth Lirisa the Archer if %tempMonth == 3 then setvar ICMonth Shorka the Cobra if %tempMonth == 4 then setvar ICMonth Uthmor the Giant if %tempMonth == 5 then setvar ICMonth Arhat the Fire Lion if %tempMonth == 6 then setvar ICMonth Moliko the Balance if %tempMonth == 7 then setvar ICMonth Skullcleaver the Dwarven Axe if %tempMonth == 8 then setvar ICMonth Dolefaren the Brigantine if %tempMonth >= 9 then setvar ICMonth Nissa the Maiden return

Report.Print: echo IC Time: %ICMonth , %ICDay of %ICYear echo Real Time: %RealMonth %RealDay %RealYear return