WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Help with code please! (

victorhe 02-04-2021 02:15 AM

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?

def WanderPhase ():
seq = random.choice([RWanderTask, LWanderTask])
viztask.schedule( seq() )


def AttackPhase():
seq = random.choice([Male_task_front, Male_task_right, Male_task_left])
viztask.schedule( seq() )


def Wait ():
seq = random.choice([Waiting])
viztask.schedule( seq() )


sado_rabaudi 08-25-2021 09:48 AM


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


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() )


All times are GMT -7. The time now is 08:12 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC