well id set a variable upon going away ..... then run for that in ur If statement like if $away == $true && %varname == away { setself back }
something along those lines would be what i would do along with unsetting that variable when u come back ...... but thats probably just one solution im sure there are several others