Author Topic: Excel Macros  (Read 797 times)

0 Members and 1 Guest are viewing this topic.

Offline X-Osoerde (Alan)

  • The Dragon
  • Former players
  • Sovereign
  • ******
  • Posts: 1.394
  • Regency: 21
  • Gender: Male
Excel Macros
« on: November 20, 2008, 02:58:01 am »
Hey Bjorn, How would you like some excel VBA macros to do some of the excel work in the P&H?  For the most part, it will could help make the sheet somewhat more straightforward...

For instances...
Quote
Public Function HoldingIncome(ProvinceLevel As Single, IncomeModifier As Single, HoldingLevel As Single, TotalLawLevels As Single, Tax As String, Prosperity As String) As Single
        Dim TaxInt As Single
        Dim ProsperityInt As Single
        Dim Income As Single
                   
            Select Case Tax
                Case Is = "No"
                    TaxInt = 0
                Case Is = "Light"
                    TaxInt = 0.2
                Case Is = Fair
                    TaxInt = 0.3
                Case Is = "Moderate"
                    TaxInt = 0.4
                Case Is = "Heavy"
                    TaxInt = 0.5
                Case Is = "Severe"
                    TaxInt = 0.6
                Case Is = "Crippling"
                    TaxInt = 0.8
                Case Is = "Total"
                    TaxInt = 1
            End Select
           
            Select Case Prosperity
                Case Is = "Rebellious"
                    ProsperityInt = 0
                Case Is = "Defiant"
                    ProsperityInt = 0.25
                Case Is = "Turbulent"
                    ProsperityInt = 0.5
                Case Is = "Poor"
                    ProsperityInt = 0.75
                Case Is = "Unsteady"
                    ProsperityInt = 0.9
                Case Is = "Guarded"
                    ProsperityInt = 0.95
                Case Is = "Average"
                    ProsperityInt = 1
                Case Is = "Steady"
                    ProsperityInt = 1.05
                Case Is = "Content"
                    ProsperityInt = 1.1
                Case Is = "Healthy"
                    ProsperityInt = 1.15
                Case Is = "Prosperous"
                    ProsperityInt = 1.2
                Case Is = "Thriving"
                    ProsperityInt = 1.25
                Case Is = "Ideal"
                    ProsperityInt = 1.35
                Case Is = "Utopian"
                    ProsperityInt = 1.5
            End Select
    Income = HoldingLevel * (ProvinceLevel / IncomeModifier) * (1 - (TaxInt * (TotalLawLevels / ProvinceLevel))) * ProsperityInt
    HoldingIncome = Application.Round(Income, 1)
End Function

The above function takes the following parameters (in this order):
Province Level = The Province level the holding is in.
Income Modifier = Usually holdings produce the province level/5 in GB per level, this parameter controls the '5' thereby increasing or decresing the base income each holding level generates.
Holding Level = the holding level
TotalLawLevels = the total number of law levels controlled in the province
Tax = the tax level (as text/string)
Prosperity  = the prosperity level (as text/string)

This function only works for NON-LAW holdings, I will create a function for law holdings.

Most of the functions in RoE are not complicated perse and all can be turned into either custom functions and/or sub procedures which could potentially reduce the work in maintaining the sheets...
Yes, wyrmling, the meat is made all the more tender by armor...

Offline X-MOC/Leman States (Even)

  • Ser Engineer
  • Former players
  • Regent
  • *****
  • Posts: 501
  • Regency: 16
  • Patriarch Leman States
Re: Excel Macros
« Reply #1 on: December 02, 2008, 02:50:23 pm »
What we really need is a macro that can read the domain orders and adjust the holding and prosperity levels according to successcul rule, contest and agitate actions...
 :P
"We are RuinsofEmpire now, and when we act, we create our own reality."

Offline X-LPA/Gaerred Khaiarén (Gray)

  • Former players
  • Noble
  • ****
  • Posts: 427
  • Regency: 10
  • High Hierophant Gaerred Khaiarén
Re: Excel Macros
« Reply #2 on: December 02, 2008, 07:30:56 pm »
Grrrr....I said the same thing. It would be totally doable if all the data were organized like a database. It is probably doable now, but it would be very difficult I think...