So for instance I have these scripts that defines the agricultural productivity of the economy in one year:
Code:
label Agricultural_Equations:
$ Serf_Efficiency = Demography_Serf_AV*500/Total_Land_Aristocracy_AV + Serfdom*2
if Serf_Efficiency >= 100:
$ Serf_Efficiency = 100
else:
pass
$ Grain_Produced_Serfs = Serf_Efficiency * Agricultural_Land_Aristocracy_AV * (100 + Serf_Grain_Modifier) * 0.0001
$ Cash_Crop_Produced_Serfs = Serf_Efficiency * Cash_Crop_Land_Aristocracy_AV * (100 + Serf_Cash_Crop_Modifier) * 0.0001
$ Cattle_Produced_Serfs = Serf_Efficiency * Pasture_Land_Aristocracy_AV * (100 + Serf_Cattle_Modifier) * 0.0001
$ Yeomanry_Efficiency = Demography_Yeomanry_AV*500/Total_Aristocracy_Land_AV - Serfdom*2
if Yeomanry_Efficiency >= 100:
$ Yeomanry_Efficiency = 100
else:
pass
$ Grain_Produced_Yeomanry = Yeomanry_Efficiency * Agricultural_Land_Aristocracy_AV * (100 + Yeomanry_Grain_Modifier) * 0.0001
$ Cash_Crop_Produced_Yeomanry = Yeomanry_Efficiency * Cash_Crop_Land_Aristocracy_AV * (100 + Yeomanry_Cash_Crop_Modifier) * 0.0001
$ Cattle_Produced_Yeomanry = Yeomanry_Efficiency * Pasture_Land_Aristocracy_AV * (100 + Yeomanry_Cattle_Modifier) * 0.01
$ SOE_Grain_Efficiency = Demography_SOE_Labor_Agriculture_AV*500/Agricultural_Land_State_Owned + State_Property*2
if SOE_Grain_Efficiency >= 100:
$ SOE_Grain_Efficiency = 100
else:
pass
$ SOE_Cash_Crop_Efficiency = Demography_SOE_Labor_Cash_Crop_AV*500/Cash_Crop_Land_State_Owned + State_Property*2
if SOE_Cash_Crop_Efficiency >= 100:
$ SOE_Cash_Crop_Efficiency = 100
else:
pass
$ SOE_Cattle_Efficiency = Demography_SOE_Labor_Pasture_AV*500/Pasture_Land_State_Owned + State_Property*2
if SOE_Cattle_Efficiency >= 100:
$ SOE_Cattle_Efficiency = 100
else:
pass
$ Grain_Produced_SOE = SOE_Grain_Efficiency * Agricultural_Land_State_Owned_AV * (100 + SOE_Grain_Modifier) * 0.0001
$ Cash_Crop_Produced_SOE = SOE_Cash_Crop_Efficiency * Cash_Crop_Land_State_Owned_AV * (100 + SOE_Cash_Crop_Modifier) * 0.0001
$ Cattle_Produced_SOE = SOE_Cattle_Efficiency * Pasture_Land_Aristocracy_State_Owned * (100 + SOE_Cattle_Modifier) * 0.0001
$ Grain_Produced_Total = Grain_Produced_Serfs + Grain_Produced_Yeomanry + Grain_Produced_SOE
$ Cash_Crop_Produced_Total = Cash_Crop_Produced_Serfs + Cash_Crop_Produced_Yeomanry + Cash_Crop_Produced_SOE
$ Cattle_Produced_Total = Cattle_Produced_Serfs + Cattle_Produced_Yeomanry + Cattle_Produced_SOE
$ Food_Produced_Total = Cattle_Produced_Total + Grain_Produced_Total
$ Food_Demanded_Total = Pop
$ Food_Surplus = Food_Produced_Total - Food_Demanded_Total
(Note: While most variable names are self explanatory, there are a few less intuitive bits:
- SOE = State-Owned Enterprises.
- AV = Absolute Value
- Efficiencies are in percentage, so I have to divide them by 100 in formulae involving them to get the real value of the underlying variable)
Is there anything I can do to optimize it, i.e. make the whole thing less cumbersome?
Thanks in advance!
_________________
One Province Minor - 120 class variables and still counting!Because there is no such thing as too many variables.