I'm not sure what you mean by "declare" a variable, but if you want to create a variable and set it to a particular value all you have to do is this (in either trigger or waypoint or script or init field)
variable1=297
variable2=true
variable3=false
If you want a script to exit when the players leaves an area, you put this line in your script
? gone:exit
There are various ways of doing the trigger, it may be this
On deactivation: gone=true
Not that if OFP finds an uninitialised variable (ie one with no value) it regards the whole expression as false. There are several good tutes on scripting which cover varibles, go and have a look at them (Johan Gustafsson's, Devilchaser's, I think maybe even snYpir's)
If you have further trouble on this question, post it in this thread. Only start a new topic if its a completely new question.