What is the most efficient way to do this?

Post » Wed Apr 24, 2013 7:55 am

I'm hoping someone can tell me if there is a more efficient way of doing something for my mod. My mod tracks a GlobalVariable, which does things at various thresholds. At the moment, my scripts which adjust the GlobalVariable always check if that threshold has been reached, as in the example below, but I'm wondering if there is a better way to do this?

GlobalVariable.SetValue(GlobalVariable.GetValue() + 1)
if GlobalVariable.GetValue() == 10
Do things
elseif GlobalVariable.GetValue() == 20
Do things
if PlayerREF.IsInFaction(Faction01) != TRUE
PlayerREF.AddToFaction(Faction01)
endif
elseif GlobalVariable.GetValue() == 30
Do things
if PlayerREF.IsInFaction(Faction02) != TRUE
PlayerREF.AddToFaction(Faction02)
endif

etc.
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Return to V - Skyrim