NPC Code:
if (created) {
setimg light2.png;
setcoloreffect 0.5,0.5,0.5,0.9;
setzoomeffect 0.1;
timeout=0.05;
this.speed=0.5;
}
if (timeout) {
this.i=(this.i+1)%20;
if (this.i==0) this.dir=int(random(0,4));
if (!((x in |0,63)||(y in |0,63|))) this.dir=(this.dir+2)%4;
x+=vecx(this.dir)*this.speed;
y+=vecy(this.dir)*this.speed;
timeout=0.05;
}
Should work, although I haven't scripted in months so it might not actually work...