Here is my script, currently. In short what it does is if out of combat, it applies a random set of shaders every 30 seconds to the actor, and if in combat a different set of random shaders + a corresponding damaging spell every 15 seconds. Every time it updates (30 or 15 seconds) it clears all the current shaders and spells. My question is how best do I accomplish this last part.
Here is the script:
Spoiler Scriptname _an_andromeda extends Actor bool theboolestint random1int random2int random3 Spell Property DefaultShader Auto Spell Property blueshader autoSpell Property greenshader autoSpell Property purpleshader autoSpell Property shiningblue autoSpell Property turquoiseshader auto Spell Property starshot autoSpell Property starshotshader autoSpell Property darkstar autoSpell Property darkstarshader autoSpell Property starbeam autoSpell Property starbeamshader auto Spell Property starshotgrand autoSpell Property starshotgrandshader autoSpell Property starvoid autoSpell Property starvoidshader autoSpell Property CombatShader Auto Event OnLoad()theboolest = falseSetAlpha(0.001)AddSpell(DefaultShader)RegisterforSingleUpdate(0)EndEvent Event OnCombatStateChanged(Actor akTarget, int aeCombatState)UnRegisterForUpdate() if (aeCombatState == 0)RemoveSpell(CombatShader)theboolest = falseelseif (aeCombatState == 1 || aeCombatState == 2)RemoveSpell(CombatShader)theboolest = trueendif RegisterForSingleUpdate(0)EndEvent Event OnUpdate() Removespell(blueshader)Removespell(greenshader)Removespell(purpleshader)Removespell(shiningblue)Removespell(turquoiseshader) if(theboolest == false) RegisterforSingleUpdate(30) random2 = Utility.RandomInt(0, 4)random3 = Utility.RandomInt(0, 4) if(random2 == 0)AddSpell(blueshader) elseif(random2 == 1)AddSpell(greenshader) elseif(random2 == 2)AddSpell(purpleshader) elseif(random2 == 3)AddSpell(shiningblue) elseAddSpell(turquoiseshader) endif if(random3 == 0)AddSpell(blueshader) elseif(random3 == 1)AddSpell(greenshader) elseif(random3 == 2)AddSpell(purpleshader) elseif(random3 == 3)AddSpell(shiningblue) elseAddSpell(turquoiseshader) endif else RegisterforSingleUpdate(15) random1 = Utility.RandomInt(0, 14)if(random1 < 4)AddSpell(starshot)AddSpell(starshotshader) elseif(random1 < 8)AddSpell(darkstar)AddSpell(darkstarshader) elseif(random1 < 11)AddSpell(starbeam)AddSpell(starbeamshader) elseif(random1 < 13)AddSpell(starshotgrand)AddSpell(starshotgrandshader) elseAddSpell(starvoid)AddSpell(starvoidshader)endif endif EndEvent
As you can see in this script I have a big block of removespell for every possible spell she could have been given, and I assume the game tries to remove all of them even though most of them aren't there. Would it be more efficient to make it so each time there's an update the game tries to remove less spells, even if it ends up making the script longer.
In other words/tl;dr: Are shorter scripts not necessarily more efficient scripts?