# Idle delay help?

**URL:** <https://forum.kirupa.com/t/idle-delay-help/241802>\
**Category:** Uncategorized\
**Created:** [October 18, 2007, 9:03am UTC](https://forum.kirupa.com/t/idle-delay-help/241802 "2007-10-18T09:03:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vin23leo](https://avatars.discourse-cdn.com/v4/letter/v/b77776/32.png) [@vin23leo](https://forum.kirupa.com/u/vin23leo)\
**Post date:** [October 18, 2007, 9:03am UTC](https://forum.kirupa.com/t/idle-delay-help/241802/1 "2007-10-18T09:03:19Z")

</div>

hey guys, i need some help atm i have a character that you can move around, i want to put a code in , so if the character hasnt been touched for a while it will go to and play him doing somthing to get the users attention.

here is the code on the character

onClipEvent (load) {  
var moveSpeed = 5  
var idle\_delay = 100  
}  
onClipEvent (enterFrame) {

idle\_delay–

if (Key.isDown(Key.RIGHT)) {  
idle\_delay = 100  
if (\_root.walls.hitTest(\_x+moveSpeed+(this.\_width/2), \_y, true)) {  
} else {  
this.\_x += moveSpeed;  
}  
tellTarget ("\_root.Guy") {  
gotoAndStop(“Right”);  
}  
}  
if (Key.isDown(Key.UP)) {  
idle\_delay = 100  
if (\_root.walls.hitTest(\_x, \_y-moveSpeed-(this.\_height/2), true)) {  
} else {  
this.\_y -= moveSpeed;  
}  
tellTarget ("\_root.Guy") {  
gotoAndStop(“Up”);  
}  
}  
if (Key.isDown(Key.DOWN)) {  
idle\_delay = 100  
if (\_root.walls.hitTest(\_x, \_y+moveSpeed+(this.\_height/2), true)) {  
} else {  
this.\_y += moveSpeed;  
}  
tellTarget ("\_root.Guy") {  
gotoAndStop(“Down”);  
}  
}  
if (Key.isDown(Key.LEFT)) {  
idle\_delay = 100  
if (\_root.walls.hitTest(\_x-moveSpeed-(this.\_width/2), \_y, true)) {  
} else {  
this.\_x -= moveSpeed;  
}  
tellTarget ("\_root.Guy") {  
gotoAndStop(“Left”);  
}

if (idle\_delay \<= 90) {  
this.gotoAndPlay(“stand”)  
this.\_x =50  
this.\_y = 50

}  
}  
}

onClipEvent (keyUp) {  
tellTarget ("\_root.Guy.character") {  
gotoAndStop (1);  
}  
}

can anyone see why this is not working, im using a counter so if it counts down to a certain number and if it hasnt been touch it will play “stand”

any ideas???
