#1
|
|||
|
|||
Help with code please!
Hey! Sorry for the very basic question, I am very new with coding and Python.
I've created three tasks, each with their own events that execute a certain sequence of actions/movements for an avatar in my environment. I am trying to design an experimental trial in which one trial will include 1)AttackPhase 2)WanderPhase 3)Wait - in that order. How can I write a code for this? #TASKS def WanderPhase (): seq = random.choice([RWanderTask, LWanderTask]) viztask.schedule( seq() ) vizact.onkeydown('6',WanderPhase) def AttackPhase(): seq = random.choice([Male_task_front, Male_task_right, Male_task_left]) viztask.schedule( seq() ) vizact.onkeydown('7',AttackPhase) def Wait (): seq = random.choice([Waiting]) viztask.schedule( seq() ) vizact.onkeydown('8',Wait) |
#2
|
|||
|
|||
Hi,
I believe you would need to put all of your tasks under one function and then call that function with one viztask.schedule(seq()). In that function the viztask function is waiting for "yield" statements i.e. def fadeAndAppear(): yield viztask.addAction( ball, vizact.fadeTo(0,time=2) ) print('done fading' ) yield viztask.addAction( ball, vizact.fadeTo(1,time=2) ) print('done appearing') viztask.schedule( fadeAndAppear() ) Best, Sado |
Tags |
code, python, sequence, tasks, vizard |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to make my code more efficent. | Queenss_RA | Vizard | 2 | 05-13-2013 10:22 AM |
Using Sphinx to generate code documents | nabrahamson | Vizard | 0 | 10-31-2011 08:38 AM |
Suggestion: Code Browser | kopper | Vizard | 5 | 05-23-2011 04:39 AM |
Any ideas on linking chess 3ds file with source code? | djones1010 | Vizard | 1 | 04-24-2009 10:56 PM |
Trying to integrate Source Code with Vizard | djones1010 | Vizard | 1 | 03-10-2009 03:58 PM |