A script like that won't work. The n900 compensates for different aspects of the audio system (speakers, headphones, earphones). The reason it drops to 48% is because alsa mixer is set to place 48% of it's maximum volume 'value' to the earphones which in turn affects the headsets...You can't create a script to counteract this problem because just about anything on the n900 resets the value back to it's default (48%). These include screen dimming, blanking, and button pressing...