Script causes savegame bloat

Post » Wed Jun 20, 2012 12:20 pm

Hello, my name is Fenist (hi Fenist), and I am a bloater.

I wrote a simple mod that auto-awards some perks when skills reach a certain level. It worked OK up until today. Today, it began causing horrid savegame bloat (we're talking from 7MB to 140MB in about 20 minutes). And I have no idea how this is even possible. All I know is that once I deleted it from the Scripts folder and removed the mod, the saves went back to 7MB and did not grow out of control.

Here is the code. It's not pretty, but it was doing the job. Please take a look, maybe you can tell me what the hell happened here?

I also would like to be able to run this not "On Update" but whenever player sleeps, so sleeping has better value. But I can't seem to suss it out.

Scriptname zzAutoPerkQuestScript extends Quest  Perk Property Alchemist00 Auto  perk property Alchemist20 Autoperk property Alchemist40 Autoperk property Alchemist60 Autoperk property Alchemist80 Autoperk property Enchanter00 Autoperk property Enchanter20 Autoperk property Enchanter40 Autoperk property Enchanter60 Autoperk property Enchanter80 Autoperk property Armsman00 Autoperk property Armsman20 Autoperk property Armsman40 Autoperk property Armsman60 Autoperk property Armsman80 Autoperk property Barbarian00 Autoperk property Barbarian20 Autoperk property Barbarian40 Autoperk property Barbarian60 Autoperk property Barbarian80 Autoperk property Haggling00 Autoperk property Haggling20 Autoperk property Haggling40 Autoperk property Haggling60 Autoperk property Haggling80 Autoperk property ShieldWall00 Autoperk property ShieldWall20 Autoperk property ShieldWall40 Autoperk property ShieldWall60 Autoperk property ShieldWall80 Autoperk property Overdraw00 Autoperk property Overdraw20 Autoperk property Overdraw40 Autoperk property Overdraw60 Autoperk property Overdraw80 Autoperk property Juggernaut00 Autoperk property Juggernaut20 Autoperk property Juggernaut40 Autoperk property Juggernaut60 Autoperk property Juggernaut80 Autoperk property AgileDefender00 Autoperk property AgileDefender20 Autoperk property AgileDefender40 Autoperk property AgileDefender60 Autoperk property AgileDefender80 Autoperk property LightFingers00 Autoperk property LightFingers20 Autoperk property LightFingers40 Autoperk property LightFingers60 Autoperk property LightFingers80 Autoperk property Stealth00 Autoperk property Stealth20 Autoperk property Stealth40 Autoperk property Stealth60 Autoperk property Stealth80 Autoperk property NoviceLocks00 Autoperk property ApprenticeLocks25 Autoperk property AdeptLocks50 Autoperk property ExpertLocks75 Autoperk property MasterLocks100 Autoperk property DestructionNovice00 Autoperk property DestructionApprentice25 Autoperk property DestructionAdept50 Autoperk property DestructionExpert75 Autoperk property DestructionMaster100 Autoperk property AlterationNovice00 Autoperk property AlterationApprentice25 Autoperk property AlterationAdept50 Autoperk property AlterationExpert75 Autoperk property AlterationMaster100 Autoperk property RestorationNovice00 Autoperk property RestorationApprentice25 Autoperk property RestorationAdept50 Autoperk property RestorationExpert75 Autoperk property RestorationMaster100 Autoperk property ConjurationNovice00 Autoperk property ConjurationApprentice25 Autoperk property ConjurationAdept50 Autoperk property ConjurationExpert75 Autoperk property ConjurationMaster100 Autoperk property IllusionNovice00 Autoperk property IllusionApprentice25 Autoperk property IllusionAdept50 Autoperk property IllusionExpert75 Autoperk property IllusionMaster100 Autoevent onInit()    registerForUpdate(5)endEventevent onUpdate();Alchemy    if (Game.GetPlayer().HasPerk(Alchemist00))        if (Game.GetPlayer().GetActorValue("Alchemy") >= 20 ) && ((Game.GetPlayer().HasPerk(Alchemist20)) == 0)            Debug.Notification ("Your Alchemy skill grows. You have gained the Alchemist(2) Perk")            Game.GetPlayer().AddPerk(Alchemist20)                        endIf        if (Game.GetPlayer().GetActorValue("Alchemy")  >= 40) && ((Game.GetPlayer().HasPerk(Alchemist40)) == 0)            Debug.Notification ("Your Alchemy skill grows. You have gained the Alchemist(3) Perk")            Game.GetPlayer().AddPerk(Alchemist40)                        endIf        if (Game.GetPlayer().GetActorValue("Alchemy")  >= 60) && ((Game.GetPlayer().HasPerk(Alchemist60)) == 0)            Debug.Notification ("Your Alchemy skill grows. You have gained the Alchemist(4) Perk")            Game.GetPlayer().AddPerk(Alchemist60)                        endIf        if (Game.GetPlayer().GetActorValue("Alchemy")  >= 80) && ((Game.GetPlayer().HasPerk(Alchemist80)) == 0)            Debug.Notification ("Your Alchemy skill grows. You have gained the Alchemist(5) Perk")                Game.GetPlayer().AddPerk(Alchemist80)                        endIf    endIf;Enchanting    if (Game.GetPlayer().HasPerk(Enchanter00))        if (Game.GetPlayer().GetActorValue("Enchanting") >= 20 ) && ((Game.GetPlayer().HasPerk(Enchanter20)) == 0)            Debug.Notification ("Your Enchanting skill grows. You have gained the Enchanter(2) Perk")            Game.GetPlayer().AddPerk(Enchanter20)                        endIf        if (Game.GetPlayer().GetActorValue("Enchanting")  >= 40) && ((Game.GetPlayer().HasPerk(Enchanter40)) == 0)            Debug.Notification ("Your Enchanting skill grows. You have gained the Enchanter(3) Perk")            Game.GetPlayer().AddPerk(Enchanter40)                        endIf        if (Game.GetPlayer().GetActorValue("Enchanting")  >= 60) && ((Game.GetPlayer().HasPerk(Enchanter60)) == 0)            Debug.Notification ("Your Enchanting skill grows. You have gained the Enchanter(4) Perk")            Game.GetPlayer().AddPerk(Enchanter60)                        endIf        if (Game.GetPlayer().GetActorValue("Enchanting")  >= 80) && ((Game.GetPlayer().HasPerk(Enchanter80)) == 0)            Debug.Notification ("Your Enchanting skill grows. You have gained the Enchanter(5) Perk")                Game.GetPlayer().AddPerk(Enchanter80)                        endIf    endIf;Speech    if (Game.GetPlayer().HasPerk(Haggling00))        if (Game.GetPlayer().GetActorValue("Speechcraft") >= 20 ) && ((Game.GetPlayer().HasPerk(Haggling20)) == 0)            Debug.Notification ("Your tongue grows more and more glib. You have gained the Haggling(2) Perk")            Game.GetPlayer().AddPerk(Haggling20)                        endIf        if (Game.GetPlayer().GetActorValue("Speechcraft")  >= 40) && ((Game.GetPlayer().HasPerk(Haggling40)) == 0)            Debug.Notification ("Your tongue grows more and more glib. You have gained the Haggling(3) Perk")            Game.GetPlayer().AddPerk(Haggling40)                        endIf        if (Game.GetPlayer().GetActorValue("Speechcraft")  >= 60) && ((Game.GetPlayer().HasPerk(Haggling60)) == 0)            Debug.Notification ("Your tongue grows more and more glib. You have gained the Haggling(4) Perk")            Game.GetPlayer().AddPerk(Haggling60)                        endIf        if (Game.GetPlayer().GetActorValue("Speechcraft")  >= 80) && ((Game.GetPlayer().HasPerk(Haggling80)) == 0)            Debug.Notification ("Your tongue grows more and more glib. You have gained the Haggling(5) Perk")                Game.GetPlayer().AddPerk(Haggling80)                        endIf    endIf;Block    if (Game.GetPlayer().HasPerk(ShieldWall00))        if (Game.GetPlayer().GetActorValue("Block") >= 20 ) && ((Game.GetPlayer().HasPerk(ShieldWall20)) == 0)            Debug.Notification ("With practice, you find it easier to deflect your enemies' stongest attacks. You have gained the Shield Wall(2) Perk")            Game.GetPlayer().AddPerk(ShieldWall20)                        endIf        if (Game.GetPlayer().GetActorValue("Block")  >= 40) && ((Game.GetPlayer().HasPerk(ShieldWall40)) == 0)            Debug.Notification ("With practice, you find it easier to deflect your enemies' stongest attacks. You have gained the Shield Wall(3) Perk")            Game.GetPlayer().AddPerk(ShieldWall40)                        endIf        if (Game.GetPlayer().GetActorValue("Block")  >= 60) && ((Game.GetPlayer().HasPerk(ShieldWall60)) == 0)            Debug.Notification ("With practice, you find it easier to deflect your enemies' stongest attacks. You have gained the Shield Wall(4) Perk")            Game.GetPlayer().AddPerk(ShieldWall60)                        endIf        if (Game.GetPlayer().GetActorValue("Block")  >= 80) && ((Game.GetPlayer().HasPerk(ShieldWall80)) == 0)            Debug.Notification ("With practice, you find it easier to deflect your enemies' stongest attacks. You have gained the Shield Wall(5) Perk")                Game.GetPlayer().AddPerk(ShieldWall80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(Armsman00))        if (Game.GetPlayer().GetActorValue("OneHanded") >= 20 ) && ((Game.GetPlayer().HasPerk(Armsman20)) == 0)            Debug.Notification ("Your skill with one-handed weapons grows. You have gained the Armsman(2) Perk")            Game.GetPlayer().AddPerk(Armsman20)                        endIf        if (Game.GetPlayer().GetActorValue("OneHanded")  >= 40) && ((Game.GetPlayer().HasPerk(Armsman40)) == 0)            Debug.Notification ("Your skill with one-handed weapons grows. You have gained the Armsman(3) Perk")            Game.GetPlayer().AddPerk(Armsman40)                        endIf        if (Game.GetPlayer().GetActorValue("OneHanded")  >= 60) && ((Game.GetPlayer().HasPerk(Armsman60)) == 0)            Debug.Notification ("Your skill with one-handed weapons grows. You have gained the Armsman(4) Perk")            Game.GetPlayer().AddPerk(Armsman60)                        endIf        if (Game.GetPlayer().GetActorValue("OneHanded")  >= 80) && ((Game.GetPlayer().HasPerk(Armsman80)) == 0)            Debug.Notification ("Your skill with one-handed weapons grows. You have gained the Armsman(5) Perk")                Game.GetPlayer().AddPerk(Armsman80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(Barbarian00))        if (Game.GetPlayer().GetActorValue("TwoHanded") >= 20 ) && ((Game.GetPlayer().HasPerk(Barbarian20)) == 0)            Debug.Notification ("Foes tremble before your sheer might. You have gained the Barbarian(2) Perk")            Game.GetPlayer().AddPerk(Barbarian20)                        endIf        if (Game.GetPlayer().GetActorValue("TwoHanded")  >= 40) && ((Game.GetPlayer().HasPerk(Barbarian40)) == 0)            Debug.Notification ("Foes tremble before your sheer might. You have gained the Barbarian(3) Perk")            Game.GetPlayer().AddPerk(Barbarian40)                        endIf        if (Game.GetPlayer().GetActorValue("TwoHanded")  >= 60) && ((Game.GetPlayer().HasPerk(Barbarian60)) == 0)            Debug.Notification ("Foes tremble before your sheer might. You have gained the Barbarian(4) Perk")            Game.GetPlayer().AddPerk(Barbarian60)                        endIf        if (Game.GetPlayer().GetActorValue("TwoHanded")  >= 80) && ((Game.GetPlayer().HasPerk(Barbarian80)) == 0)            Debug.Notification ("Foes tremble before your sheer might. You have gained the Barbarian(5) Perk")                Game.GetPlayer().AddPerk(Barbarian80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(Overdraw00))        if (Game.GetPlayer().GetActorValue("Marksman") >= 20 ) && ((Game.GetPlayer().HasPerk(Overdraw20)) == 0)            Debug.Notification ("Your arrows find their mark more and more frequently. You have gained the Overdraw(2) Perk")            Game.GetPlayer().AddPerk(Overdraw20)                        endIf        if (Game.GetPlayer().GetActorValue("Marksman")  >= 40) && ((Game.GetPlayer().HasPerk(Overdraw40)) == 0)            Debug.Notification ("Your arrows find their mark more and more frequently. You have gained the Overdraw(3) Perk")            Game.GetPlayer().AddPerk(Overdraw40)                        endIf        if (Game.GetPlayer().GetActorValue("Marksman")  >= 60) && ((Game.GetPlayer().HasPerk(Overdraw60)) == 0)            Debug.Notification ("Your arrows find their mark more and more frequently. You have gained the Overdraw(4) Perk")            Game.GetPlayer().AddPerk(Overdraw60)                        endIf        if (Game.GetPlayer().GetActorValue("Marksman")  >= 80) && ((Game.GetPlayer().HasPerk(Overdraw80)) == 0)            Debug.Notification ("YYour arrows find their mark more and more frequently. You have gained the Overdraw(5) Perk")                Game.GetPlayer().AddPerk(Overdraw80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(AgileDefender00))        if (Game.GetPlayer().GetActorValue("LightArmor") >= 20 ) && ((Game.GetPlayer().HasPerk(AgileDefender20)) == 0)            Debug.Notification ("You grow more accustomed to fighting in light armor. You have gained the AgileDefender(2) Perk")            Game.GetPlayer().AddPerk(AgileDefender20)                        endIf        if (Game.GetPlayer().GetActorValue("LightArmor")  >= 40) && ((Game.GetPlayer().HasPerk(AgileDefender40)) == 0)            Debug.Notification ("You grow more accustomed to fighting in light armor. You have gained the AgileDefender(3) Perk")            Game.GetPlayer().AddPerk(AgileDefender40)                        endIf        if (Game.GetPlayer().GetActorValue("LightArmor")  >= 60) && ((Game.GetPlayer().HasPerk(AgileDefender60)) == 0)            Debug.Notification ("You grow more accustomed to fighting in light armor. You have gained the AgileDefender(4) Perk")            Game.GetPlayer().AddPerk(AgileDefender60)                        endIf        if (Game.GetPlayer().GetActorValue("LightArmor")  >= 80) && ((Game.GetPlayer().HasPerk(AgileDefender80)) == 0)            Debug.Notification ("You grow more accustomed to fighting in light armor. You have gained the AgileDefender(5) Perk")                Game.GetPlayer().AddPerk(AgileDefender80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(Juggernaut00))        if (Game.GetPlayer().GetActorValue("HeavyArmor") >= 20 ) && ((Game.GetPlayer().HasPerk(Juggernaut20)) == 0)            Debug.Notification ("You grow more accustomed to fighting in heavy armor. You have gained the Juggernaut(2) Perk")            Game.GetPlayer().AddPerk(Juggernaut20)                        endIf        if (Game.GetPlayer().GetActorValue("HeavyArmor")  >= 40) && ((Game.GetPlayer().HasPerk(Juggernaut40)) == 0)            Debug.Notification ("You grow more accustomed to fighting in heavy armor. You have gained the Juggernaut(3) Perk")            Game.GetPlayer().AddPerk(Juggernaut40)                        endIf        if (Game.GetPlayer().GetActorValue("HeavyArmor")  >= 60) && ((Game.GetPlayer().HasPerk(Juggernaut60)) == 0)            Debug.Notification ("You grow more accustomed to fighting in heavy armor. You have gained the Juggernaut(4) Perk")            Game.GetPlayer().AddPerk(Juggernaut60)                        endIf        if (Game.GetPlayer().GetActorValue("HeavyArmor")  >= 80) && ((Game.GetPlayer().HasPerk(Juggernaut80)) == 0)            Debug.Notification ("You grow more accustomed to fighting in heavy armor. You have gained the Juggernaut(5) Perk")                Game.GetPlayer().AddPerk(Juggernaut80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(LightFingers00))        if (Game.GetPlayer().GetActorValue("Pickpocket") >= 20 ) && ((Game.GetPlayer().HasPerk(LightFingers20)) == 0)            Debug.Notification ("You find it easier and easier to relieve others of their possessions, without them ever knowing. You have gained the LightFingers(2) Perk")            Game.GetPlayer().AddPerk(LightFingers20)                        endIf        if (Game.GetPlayer().GetActorValue("Pickpocket")  >= 40) && ((Game.GetPlayer().HasPerk(LightFingers40)) == 0)            Debug.Notification ("You find it easier and easier to relieve others of their possessions, without them ever knowing. You have gained the LightFingers(3) Perk")            Game.GetPlayer().AddPerk(LightFingers40)                        endIf        if (Game.GetPlayer().GetActorValue("Pickpocket")  >= 60) && ((Game.GetPlayer().HasPerk(LightFingers60)) == 0)            Debug.Notification ("You find it easier and easier to relieve others of their possessions, without them ever knowing. You have gained the LightFingers(4) Perk")            Game.GetPlayer().AddPerk(LightFingers60)                        endIf        if (Game.GetPlayer().GetActorValue("Pickpocket")  >= 80) && ((Game.GetPlayer().HasPerk(LightFingers80)) == 0)            Debug.Notification ("You find it easier and easier to relieve others of their possessions, without them ever knowing. You have gained the LightFingers(5) Perk")                Game.GetPlayer().AddPerk(LightFingers80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(Stealth00))        if (Game.GetPlayer().GetActorValue("Sneak") >= 20 ) && ((Game.GetPlayer().HasPerk(Stealth20)) == 0)            Debug.Notification ("Blending into shadows and moving silently takes less and less effort. You have gained the Stealth(2) Perk")            Game.GetPlayer().AddPerk(Stealth20)                        endIf        if (Game.GetPlayer().GetActorValue("Sneak")  >= 40) && ((Game.GetPlayer().HasPerk(Stealth40)) == 0)            Debug.Notification ("Blending into shadows and moving silently takes less and less effort. You have gained the Stealth(3) Perk")            Game.GetPlayer().AddPerk(Stealth40)                        endIf        if (Game.GetPlayer().GetActorValue("Sneak")  >= 60) && ((Game.GetPlayer().HasPerk(Stealth60)) == 0)            Debug.Notification ("Blending into shadows and moving silently takes less and less effort. You have gained the Stealth(4) Perk")            Game.GetPlayer().AddPerk(Stealth60)                        endIf        if (Game.GetPlayer().GetActorValue("Sneak")  >= 80) && ((Game.GetPlayer().HasPerk(Stealth80)) == 0)            Debug.Notification ("Blending into shadows and moving silently takes less and less effort. You have gained the Stealth(5) Perk")                Game.GetPlayer().AddPerk(Stealth80)                        endIf    endIf    if (Game.GetPlayer().HasPerk(NoviceLocks00))        if (Game.GetPlayer().GetActorValue("Lockpicking") >= 25 ) && ((Game.GetPlayer().HasPerk(ApprenticeLocks25)) == 0)            Debug.Notification ("Locks seem to fall open at your slightest touch. You now find Apprentice-level locks much easier to pick.")            Game.GetPlayer().AddPerk(ApprenticeLocks25)                        endIf        if (Game.GetPlayer().GetActorValue("Lockpicking")  >= 50) && ((Game.GetPlayer().HasPerk(AdeptLocks50)) == 0)            Debug.Notification ("Locks seem to fall open at your slightest touch. You now find Adept-level locks much easier to pick.")            Game.GetPlayer().AddPerk(AdeptLocks50)                        endIf        if (Game.GetPlayer().GetActorValue("Lockpicking")  >= 75) && ((Game.GetPlayer().HasPerk(ExpertLocks75)) == 0)            Debug.Notification ("Locks seem to fall open at your slightest touch. You now find Expert-level locks much easier to pick.")            Game.GetPlayer().AddPerk(ExpertLocks75)                        endIf        if (Game.GetPlayer().GetActorValue("Lockpicking")  >= 100) && ((Game.GetPlayer().HasPerk(MasterLocks100)) == 0)            Debug.Notification ("Locks seem to fall open at your slightest touch. You now find Master-level locks much easier to pick.")                Game.GetPlayer().AddPerk(MasterLocks100)                        endIf    endIf    if (Game.GetPlayer().HasPerk(DestructionNovice00))        if (Game.GetPlayer().GetActorValue("Destruction") >= 25 ) && ((Game.GetPlayer().HasPerk(DestructionApprentice25)) == 0)            Debug.Notification ("Destructive elemental forces are at your command. You now find Apprentice-level Destruction spells easier to cast.")            Game.GetPlayer().AddPerk(DestructionApprentice25)                        endIf        if (Game.GetPlayer().GetActorValue("Destruction")  >= 50) && ((Game.GetPlayer().HasPerk(DestructionAdept50)) == 0)            Debug.Notification ("Destructive elemental forces are at your command. You now find Adept-level Destruction spells easier to cast.")            Game.GetPlayer().AddPerk(DestructionAdept50)                        endIf        if (Game.GetPlayer().GetActorValue("Destruction")  >= 75) && ((Game.GetPlayer().HasPerk(DestructionExpert75)) == 0)            Debug.Notification ("Destructive elemental forces are at your command. You now find Expert-level Destruction spells easier to cast.")            Game.GetPlayer().AddPerk(DestructionExpert75)                        endIf        if (Game.GetPlayer().GetActorValue("Destruction")  >= 100) && ((Game.GetPlayer().HasPerk(DestructionMaster100)) == 0)            Debug.Notification ("Destructive elemental forces are at your command. You now find Master-level Destruction spells easier to cast.")                Game.GetPlayer().AddPerk(DestructionMaster100)                        endIf    endIf    if (Game.GetPlayer().HasPerk(AlterationNovice00))        if (Game.GetPlayer().GetActorValue("Alteration") >= 25 ) && ((Game.GetPlayer().HasPerk(AlterationApprentice25)) == 0)            Debug.Notification ("Reality bends and changes as you will. You now find Apprentice-level Alteration spells easier to cast.")            Game.GetPlayer().AddPerk(AlterationApprentice25)                        endIf        if (Game.GetPlayer().GetActorValue("Alteration")  >= 50) && ((Game.GetPlayer().HasPerk(AlterationAdept50)) == 0)            Debug.Notification ("Reality bends and changes as you will. You now find Adept-level Alteration spells easier to cast.")            Game.GetPlayer().AddPerk(AlterationAdept50)                        endIf        if (Game.GetPlayer().GetActorValue("Alteration")  >= 75) && ((Game.GetPlayer().HasPerk(AlterationExpert75)) == 0)            Debug.Notification ("Reality bends and changes as you will. You now find Expert-level Alteration spells easier to cast.")            Game.GetPlayer().AddPerk(AlterationExpert75)                        endIf        if (Game.GetPlayer().GetActorValue("Alteration")  >= 100) && ((Game.GetPlayer().HasPerk(AlterationMaster100)) == 0)            Debug.Notification ("Reality bends and changes as you will. You now find Master-level Alteration spells easier to cast.")                Game.GetPlayer().AddPerk(AlterationMaster100)                        endIf    endIf    if (Game.GetPlayer().HasPerk(IllusionNovice00))        if (Game.GetPlayer().GetActorValue("Illusion") >= 25 ) && ((Game.GetPlayer().HasPerk(IllusionApprentice25)) == 0)            Debug.Notification ("It becomes ever easier to cloud the minds of others. You now find Apprentice-level Illusion spells easier to cast.")            Game.GetPlayer().AddPerk(IllusionApprentice25)                        endIf        if (Game.GetPlayer().GetActorValue("Illusion")  >= 50) && ((Game.GetPlayer().HasPerk(IllusionAdept50)) == 0)            Debug.Notification ("It becomes ever easier to cloud the minds of others. You now find Adept-level Illusion spells easier to cast.")            Game.GetPlayer().AddPerk(IllusionAdept50)                        endIf        if (Game.GetPlayer().GetActorValue("Illusion")  >= 75) && ((Game.GetPlayer().HasPerk(IllusionExpert75)) == 0)            Debug.Notification ("It becomes ever easier to cloud the minds of others. You now find Expert-level Illusion spells easier to cast.")            Game.GetPlayer().AddPerk(IllusionExpert75)                        endIf        if (Game.GetPlayer().GetActorValue("Illusion")  >= 100) && ((Game.GetPlayer().HasPerk(IllusionMaster100)) == 0)            Debug.Notification ("It becomes ever easier to cloud the minds of others. You now find Master-level Illusion spells easier to cast.")                Game.GetPlayer().AddPerk(IllusionMaster100)                        endIf    endIf    if (Game.GetPlayer().HasPerk(ConjurationNovice00))        if (Game.GetPlayer().GetActorValue("Conjuration") >= 25 ) && ((Game.GetPlayer().HasPerk(ConjurationApprentice25)) == 0)            Debug.Notification ("Creatures from beyond answer your summons more readily. You now find Apprentice-level Conjuration spells easier to cast.")            Game.GetPlayer().AddPerk(ConjurationApprentice25)                        endIf        if (Game.GetPlayer().GetActorValue("Conjuration")  >= 50) && ((Game.GetPlayer().HasPerk(ConjurationAdept50)) == 0)            Debug.Notification ("Creatures from beyond answer your summons more readily. You now find Adept-level Conjuration spells easier to cast.")            Game.GetPlayer().AddPerk(ConjurationAdept50)                        endIf        if (Game.GetPlayer().GetActorValue("Conjuration")  >= 75) && ((Game.GetPlayer().HasPerk(ConjurationExpert75)) == 0)            Debug.Notification ("Creatures from beyond answer your summons more readily. You now find Expert-level Conjuration spells easier to cast.")            Game.GetPlayer().AddPerk(ConjurationExpert75)                        endIf        if (Game.GetPlayer().GetActorValue("Conjuration")  >= 100) && ((Game.GetPlayer().HasPerk(ConjurationMaster100)) == 0)            Debug.Notification ("Creatures from beyond answer your summons more readily. You now find Master-level Conjuration spells easier to cast.")                Game.GetPlayer().AddPerk(ConjurationMaster100)                        endIf    endIf    if (Game.GetPlayer().HasPerk(RestorationNovice00))        if (Game.GetPlayer().GetActorValue("Restoration") >= 25 ) && ((Game.GetPlayer().HasPerk(RestorationApprentice25)) == 0)            Debug.Notification ("The energies of life itself are within your grasp. You now find Apprentice-level Restoration spells easier to cast.")            Game.GetPlayer().AddPerk(RestorationApprentice25)                        endIf        if (Game.GetPlayer().GetActorValue("Restoration")  >= 50) && ((Game.GetPlayer().HasPerk(RestorationAdept50)) == 0)            Debug.Notification ("The energies of life itself are within your grasp. You now find Adept-level Restoration spells easier to cast.")            Game.GetPlayer().AddPerk(RestorationAdept50)                        endIf        if (Game.GetPlayer().GetActorValue("Restoration")  >= 75) && ((Game.GetPlayer().HasPerk(RestorationExpert75)) == 0)            Debug.Notification ("The energies of life itself are within your grasp. You now find Expert-level Restoration spells easier to cast.")            Game.GetPlayer().AddPerk(RestorationExpert75)                        endIf        if (Game.GetPlayer().GetActorValue("Restoration")  >= 100) && ((Game.GetPlayer().HasPerk(RestorationMaster100)) == 0)            Debug.Notification ("The energies of life itself are within your grasp. You now find Master-level Restoration spells easier to cast.")                Game.GetPlayer().AddPerk(RestorationMaster100)                        endIf    endIfendEvent
User avatar
Ian White
 
Posts: 3476
Joined: Thu Jul 19, 2007 8:08 pm

Post » Wed Jun 20, 2012 1:12 am

This is just a shot in the dark. But maybe try unregisterForUpdate after all of that?(or wherever it should properly be).
User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am

Post » Wed Jun 20, 2012 1:10 am

For http://www.creationkit.com/OnUpdate_-_Form events like this, it's best to use a series of calls to http://www.creationkit.com/RegisterForSingleUpdate_-_Form instead.

In order to run when the player sleeps, you'll want to use http://www.creationkit.com/RegisterForSleep_-_Form coupled with the http://www.creationkit.com/OnSleepStart_-_Form or http://www.creationkit.com/OnSleepStop_-_Form event.

Cipscis
User avatar
Susan
 
Posts: 3536
Joined: Sun Jun 25, 2006 2:46 am

Post » Wed Jun 20, 2012 7:41 am

Cipsis,

RegisterForSingleUpdate is for a one-time update only - correct? It will run once, and then will never run again. This doesn't really work for me, I want the script to periodically check for the player's skill levels, not just once.

The Sleep approach, however, has worked. No more bloat (apparently) and perks are awarded correctly.

Still would love to know what caused the bloat...
User avatar
stevie critchley
 
Posts: 3404
Joined: Sat Oct 28, 2006 4:36 pm

Post » Wed Jun 20, 2012 11:39 am

Sorry, the idea behind using a string of calls to http://www.creationkit.com/RegisterForSingleUpdate_-_Form is that you also call it at the end of your http://www.creationkit.com/OnUpdate_-_Form event.

This thread has some good details on potential save bloating caused by registering for continual updates - http://www.gamesas.com/topic/1349327-scripting-savegame-bloating/

Cipscis
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am

Post » Wed Jun 20, 2012 5:00 am

Thank you very much! The onSleep approach is much closer to what I originally intended for this particular mod, but this is helpful for any future projects.
User avatar
Sylvia Luciani
 
Posts: 3380
Joined: Sun Feb 11, 2007 2:31 am


Return to V - Skyrim