Since the lower half of the script only runs a single frame when the player hits the sneak button, "return" at each branch doesn't really affect performance; also there's no point in duplicating "set doOnce to 1".
Begin Scriptshort DoOnceif ( GetPCSneaking == 0 ) if ( DoOnce == 1 ) Player->RemoveSpell aahide6 Player->RemoveSpell aahide5 Player->RemoveSpell aahide4 Player->RemoveSpell aahide3 Player->RemoveSpell aahide2 Player->RemoveSpell aahide1 Set DoOnce to 0 endif Returnendifif ( DoOnce == 1 ) ReturnendifSet DoOnce to 1if ( Player->GetSneak => 100 ) Player->AddSpell aahide6elseif ( Player->GetSneak => 90 ) Player->AddSpell aahide5elseif ( Player->GetSneak => 80 ) Player->AddSpell aahide4elseif ( Player->GetSneak => 70 ) Player->AddSpell aahide3elseif ( Player->GetSneak => 60 ) Player->AddSpell aahide2elseif ( Player->GetSneak => 50 ) Player->AddSpell aahide1endifEnd
The simpler it is, the easier it is to handle later.