First initialize all your pointers with NULL, i.e.

Code:
ENTITY* enemy;
ENTITY* ship = NULL;
ENTITY* pos1 = NULL;
ENTITY* pos2 = NULL;
ENTITY* pos3 = NULL;
//etc.


Second change your function move to:
Code:
function move()
{
  c_setminmax(me);
  set(my,FLAG2);
  while (posa == NULL)
    wait(1);
  while(my.x > posa.x)///this crashes!!
  {
    c_move (my, vector(20 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | IGNORE_FLAG2);
// and the rest of your code.


Most probably the move action is executed before your pointers were initialized. Common mistake.


Always learn from history, to be sure you make the same mistakes again...