#
#
# simple pybuzz script that demonstrates:
# global values, simple file input/output, 
# basic OnParameter behaviour, 
# 
# opens a txt file in your pybuzz directory
# and appends #'s into it as you move the 
# 0-byte slider around
#
# www.plosive.net

import sys

from buzz import *

line = "writing to a file."
print line

gvalue=1

def OnParameter(track,index,value):

	global gvalue 
	
	print "[%02i] %i: %i" % (track,index,value)
	if (index == 1): # index 1 = first byte slider, index 2 would be first word slider, etc

		pytxt=open("mute.txt", 'a,wr') 
		pytxt.write("%03i\n" %gvalue) #%03i could just be %i, 03 makes it a 3 digit int
		pytxt.close()	
		gvalue += 1

SetEventTarget("OnParameter",OnParameter)

SetPeerCtrlName(0,"useless")

