Multiple Timeouts

So I’m mimicking a ship going through the waves. It uses the ship (that bobs) and that waves the move sideways.

Ship:

// NPC made by Seeker99
if (created) {
  timeout = 0.05;
  timereverywhere;
}
if(timeout){
  y = 33.5;
  sleep 0.13;
  y = 33.6;
  sleep 0.13;
  y = 33.7;
  sleep 0.13;
  y = 33.6;
  sleep 0.13;
  y = 33.5;
  sleep 0.13;
  y = 33.4;
  sleep 0.13;
  y = 33.3;
  sleep 0.13;
  y = 33.4;
  sleep 0.12;
  timeout = 0.05;
}

Waves

if(created||playerenters){
  dontblock;
  timeout = 0.05;
  timereverywhere;
}
if(timeout){
  x = 19;
  sleep 0.09;
  x = 19.1;
  sleep 0.09;
  x = 19.2;
  sleep 0.09;
  x = 19.3;
  sleep 0.09;
  x = 19.4;
  sleep 0.09;
  x = 19.5;
  sleep 0.09;
  x = 19.6;
  sleep 0.09;
  x = 19.7;
  sleep 0.09;
  x = 19.8;
  sleep 0.09;
  x = 19.9;
  sleep 0.09;
  x = 20;
  sleep 0.09;
  x = 20.1;
  sleep 0.09;
  x = 20.2;
  sleep 0.09;
  x = 20.3;
  sleep 0.09;
  x = 20.4;
  sleep 0.09;
  x = 20.5;
  sleep 0.09;
  x = 20.6;
  sleep 0.09;
  x = 20.7;
  sleep 0.09;
  x = 20.8;
  sleep 0.09;
  x = 20.9;
  sleep 0.09;
  x = 21;
  sleep 0.09;
  timeout = 0.05;
}

This is what I have so far. Right now the two scripts are kind of glitchy because the timeouts are clashing with each other d:

That ship is a placeholder

if (created) {
  x = 50; //startx
  y = 33.5; //starty
  this.mx = 10; //end of x movement
  this.my = 33.3; //max hieght
  this.ly = 33.7; //lowest hieght
  this.fy = 0; //not falling
  timeout = 0.05;
}

if (timeout) {
  if (x > 10) {
    if (this.stepx < 2) this.stepx++; //0.1 sec
    else {
      this.stepx = 0;
      x -= 0.2;
    }
  }
  if (this.fy == 0) {
    if (y > this.my) {
      if (this.stepy < 3) this.stepy++; //0.15 sec
      else {
        this.stepy = 0;
        y -= 0.1;
      }
    } else this.fy = 1;
  } else {
    if (y < this.ly) {
      if (this.stepy < 3) this.stepy++;
      else {
        this.stepy = 0;
        y += 0.1;
      }
    } else this.fy = 0;
  }
  timeout = 0.05;
}

For the ship. If you don’t want it to move left remove all the stuff that changes x.

Here.