ok im no scripting guru and have to be honest and say I didnt read through your script much
but i would say maybe add scon in there.
eg
timer 1 1 /scon -a amsg
also your timers dont need to be numbered timer1 timer2 etc mirc will do that for you. Im sure there are others out there with better ideas than me but I hope this helps at least.
Actually now ive looked at it a little more you can lose a lot of the timers by simply setting a variable say %away_time
so
set %away_time $ctime
and on return
set %back $duration($calc($ctime - %away_ctime))
I was away %back
im sure others can add more and explain this better as i said im no guru hope it helps though and good luck