no problemo actually. the clue is the init eventhandler and the animationphase query.
insert into the cfgvehicles section of the config of your object/car/whatever
class eventhandlers
{
Init="[_this select 0] exec ""\pboname\init_object.sqs"";";
};
your init_object.sqs:
#start
@ (_this select 0) animationphase "lever" == 1
insert script code here, loop maybe@ (_this select 0) animationphase "lever" == 0
goto "start"
NB. this will not work for any stuff that you place on an island in an island editor. the class eventhandlers only work for vehicles/objects/etc which are placed in the mission editor.
hope that helps