So you want to get the current light level for the player, and use that value to determine a bonus or penalty to your sneak skill?
The thing is . . . the formula is already taking light into account, and if you do the above, you're effectively double counting the light factor (since it's part of the base detection formula and would now modify your sneak skill, also part of the formula) and you're not accurately reflecting your sneak ability (since a poor sneaking individual can hide in the dark even if they might be terrible at sneaking / loud / etc . . . )
Yes, it is "taking light into account" . . . but does a pretty poor job in my opinion. Turn on your PipBoy light in a dark area . . . and it makes hardly any difference in how visible you are. And there is not nearly enough difference between sneaking in daylight and during the middle of the night. At night you should be able to get a LOT closer before you are detected. With the default game, the NPCs basically all have night vision, while you're not only blind, but you stand out like a beacon to them.
I think it might make more sense in the outdoor scenarios you describe, but even then, I don't know. What would actually make more sense to me, would be to rig up a script that dynamically adjusts the fsneakmaxdistance based on weather/environmental condition (or via the exteriordistancemultiplier). That way, during a thunderstorm, the effective perception range of everyone is a lot lower than durnig a sunny afternoon, for example.
I'm doing both. With weather, you have a choice between cloudy, rainy, snowy, and pleasant . . . there is no "sunny" or no "moonlight." Plus a person is generally a LOT less visible at sunrise (when it is technically sunny), than an hour after sunrise, and you should be extremely visible in the middle of a sunny afternoon.
In testing, I've found that the "distance attenuation" factor has a significant effect on the range that the detection formulas work, but really a rather mild influence on the actual detection formula itself. Anyway, that's another way to maybe approach it =) You'd have to use FOSE though to be able to change gamesettings in game (or even a semi-cloudy day).
Are you referring to the "fSneakDistanceAttenuationExponent"? If so, changing that can cause other problems . . . I have found that if you set it lower than default, you won't have any warning time between when the enemy is alerted and when they lock on to you . . . it becomes almost instantaneous . . . which is not a good thing.
I'm using FOSE to script this. I'm dynamically changing both the fSneakBaseValue and the fSneakExteriorDistanceMult. You need to alter the two together, or you end up picking orange compass alerts from enemies that should be way off your radar. Unlike a lot of players, I feel that you need the compass markers just to compete . . . since they are how the NPCs know where you are (which is why they "see" you when you are on the other side of a building.) The tricky part is balancing this so that the alert markers only appear when an enemy should be in range if they were in LOS (I wish there was a better way to make you and them both invisible when you do not have LOS).