I'm tweaking a few scripts, trying to pair down things like global variables if they're not absolutely needed and such, and need someone to take a look at the changes I've made to my inscription scripts.
Here's the old one (just the altered part):
If ( successratio >= 20 )
Set addition To Random, 3
Set increment To ( ( 100 / Inscription_skill ) + ( addition + 1 ) ) / 100
Set Inscription_skill To ( Inscription_skill + increment )
messagebox, "Increment is %.2f, Inscription_skill is %.2f", increment, Inscription_skill
Set btemp To InscriptionStored + 1
If ( btemp <= Inscription_skill ) ;if you are ready to advance one point in skill.
Set InscriptionStored To Inscription_skill
PlaySound, "skillraise"
MessageBox "Your Inscription skill has increased to %.0f", Inscription_skill
EndIf
Else ;If NOT successful
Set increment To ( ( 100 / Inscription_skill ) ) / 200
Set Inscription_skill To ( Inscription_skill + increment )
messagebox, "Increment is %.2f, Inscription_skill is %.2f", increment, Inscription_skill
Set btemp To InscriptionStored + 1
If ( btemp <= Inscription_skill )
Set InscriptionStored To Inscription_skill
PlaySound, "skillraise"
MessageBox "You have learned from your mistakes, and your Inscription skill has increased to %.0f", Inscription_skill
EndIf
EndIf
And these are my changes, using a temporary float (tempf) to replace what the global variable Inscription_Skill was being used for and using Inscription_Skill in place of the global InscriptionStored (which has been made redundant):
If ( successratio >= 20 )
Set addition To Random, 3
Set increment To ( ( 100 / Inscription_skill ) + ( addition + 1 ) ) / 100
Set tempf To ( Inscription_skill + increment )
messagebox, "Increment is %.2f, tempf is %.2f", increment, tempf
Set temps To Inscription_Skill + 1
If ( temps <= tempf ) ;if you are ready to advance one point in skill.
Set Inscription_Skill To tempf
PlaySound, "skillraise"
MessageBox "Your Inscription skill has increased to %.0f", Inscription_skill
EndIf
Else ;If NOT successful
Set increment To ( ( 100 / Inscription_skill ) ) / 200
Set tempf To ( Inscription_skill + increment )
messagebox, "Increment is %.2f, tempf is %.2f", increment, tempf
Set temps To Inscription_Skill + 1
If ( temps <= tempf )
Set Inscription_Skill To tempf
PlaySound, "skillraise"
MessageBox "You have learned from your mistakes, and your Inscription skill has increased to %.0f", Inscription_skill
EndIf
EndIf
I just thought having two global variables (both floats), which amount to the exact same number once the script has finished running, is unnecessary. Particularly when they're supposed to represent a skill like enchanting, which only ever needs one stored value.
Do my changes look all right?