Well, then you need two ingredients:
- The trigger: You need to check in clbkPrestep (or clbkPostStep), if you reached a certain altitude. If you exceeded this you trigger the gear up event. A trigger is a finite state machine with two states (reset <-> triggered) in the sense of programming: Once you triggered it, the check does no longer need to be executed until the trigger is reset, so the following event only gets triggered once (and does not prevent you from deploying landing gear for landing).
- The animation: Like if you react on a keypress, you need to set the animation state in the clbkPrestep. Luckily. Orbiter comes with a simple AnimState class that contains a lot of standard code for such simple animations.
The trigger can, in pseudo code (OK, its Inform7) for example look like this:
If gearUpTrigger is reset and getAltitude() > 500.0:
Now gearUpTrigger is triggered;
Now gearCommand is up;
endif.
(I don't want to write C++ code here for a reason: Its your add-on, you should control its implementation. Don't make a Frankenstein module from various code snippets copied around from the forum, for the sake of your own sanity.)