else { this.runcounter = int(random(10, 40)); setcharani("idle", NULL); this.dir = (dir + 1 + int(random(0, 2)) * 2) % 4; scheduleevent(0.5, "movementFinished", ""); }