Scripting Move Player

I am trying to make a script that moves a player from point a to point b in a given amount of seconds. In more detail, I am trying to make a player move from where he is standing, down about 5 squares in about 4 seconds. It is easy to move NPC but character movement is not so easy. I would appreciate some help or some direction on where to look.

is it when a player touchs something?
or when they enter?
or when do you want it to activate?

Just use move blah,blah,etc and then attachplayertoobj and attach the player to the npc? then it’s just a matter of moving a NPC itself rather then the player.

// NPC made by Chicken NaNa
if (created) {
  this.npc_id = npcs[0].id;
  move 5,0,4,;
  attachplayertoobj 0,this.npc_id;

if (playerchats){
  if (strequals(#c,off))detachplayer;

Shit needs tinkering with to be correct, but yeh. I hope you get the idea of what I meant.

Something like this should work:
[php]if (created) {
this.dx = 0;
this.dy = 5;
this.time = 5;

function move() {
for (i=0;i<this.time;i+=0.05) {
playerx += (this.dx/this.time)*0.05;
playery += (this.dy/this.time)*0.05;
sleep 0.05;

Thanks for the help. I can work with this.