WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-29-2007, 07:00 AM
Plymouth Plymouth is offline
Member
 
Join Date: May 2006
Location: Plymouth, UK
Posts: 24
Basic soundtrack

I'm trying to learn the basics of scripting in Vizard/Python and I'm having some confusion. The code below is intended to just start, stop, or change the background music, but it's getting errors that I suppose must stem from me not understanding variable declarations. If someone could give me a push in the right direction I'd really appreciate it.


music = viz.add('song1.mp3')
music.loop(viz.ON)

def ChangeToFirst():
music.rewind()
music = viz.add('song1.mp3')
music.play()

def ChangeToSecond():
music.rewind()
music = viz.add('song2.mp3')
music.play()

def StopTheMusic():
music.rewind()

def mykey(key):
if key == '1':
ChangeToFirst()
elif key == '2':
ChangeToSecond()
elif key == ' ':
StopTheMusic()
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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