hello, I want to make hotkey that when I press it, that makes character go to dp and logout. is it possible?

these didn't work for me:
1. make hotkey that sets my own variable, for example
PHP Code:
if connected then 
shit 

end 
2. in the end of the hunting loop i would do an action
PHP Code:
if shit == 1 then
gotolabel
("leave")
else 
gotolabel("exp")
end 
3. and then in depot after depositing i would do another action
PHP Code:
if shit == 1 then
setcavebot
("off")
logout()
end 
after I pressed hotkey it didn't change anything.