View Single Post
  #3  
Old 03-20-2013, 01:41 AM
Meneer_Aart Meneer_Aart is offline
Member
 
Join Date: Oct 2011
Posts: 4
Red face

Thanks for your reply Jeff. I've tried the "clearactions()" statement.
However, since i'm using schedule to arrange the actions, i have to kill that as well to prevent the other walking actions from running.

I've tried this:

Code:
def walk1():
	yield viztask.waitKeyDown( ' ' )
	yield viztask.addAction(avatar, vizact.walkTo([pointA]))
	yield viztask.addAction(avatar, vizact.walkTo([pointB]))
	yield viztask.addAction(avatar, vizact.walkTo([pointC]))
               avatar.state(14)
	yield viztask.waitTime(10)
	viztask.schedule(walk2())

def walk2():
	yield viztask.waitKeyDown( ' ' )
	yield viztask.addAction(avatar, vizact.walkTo([pointD]))
	yield viztask.addAction(avatar, vizact.walkTo([pointE]))
               avatar.state(14)
	yield viztask.waitTime(10)

def stop():
	avatar.clearactions(0)

#main
t = viztask.schedule(walk1())

vizact.onkeydown('l',t.kill)
vizact.onkeydown('k',stop)
And this works, it stops the avatar completely and he returns to his idle state. However, it is inconvenient to have to push 2 keys to stop the avatar, so i tried to add the killing of the schedule to my stop command:

Code:
def stop():
               t.kill
	avatar.clearactions(0)

vizact.onkeydown('k',stop)
But this doesn't work for me, Is there a way to combine the 2 commands? I feel i'm overlooking something very simple here, but i can't quite put my finger on it.
Reply With Quote