| Cart Machine (Sound Clips) 
 
	 
	
		| Author | Message |   
		| pkjr92 
 
 
 
 
 | 
			
				|  Posted: Thu Jul 10, 2008 3:36 pm    Post subject: Cart Machine (Sound Clips) |  |   
				| 
 |  
				| This is my cart machine (basically it's a sound clip machine).  It uses a custom GUI (not my own, but I can't remember whose) as well as the fork and Music.PlayFile commands to play and stop clips.  It is all done, except I can't get the View.Update to work correctly.   
 I've included the source "cart.t", the code shown below, and the zip file that includes the sound clips and gui module as well.
 If anyone could help with the View.Update problem, it would be greatly appreciated!
 
 
 	  | code: |  	  | import G in "module.tu"
%include "songlist.t"
 %Cart Machine v1.02
 %Created By: pkjr92
 %Current Version Completed: 09-July-2008
 
 %This is a cart machine (a sound clip player).  The reason there are processes inside procedures is because
 %that is the only way I could get the Music.PlayFileStop command to work.
 
 %<-------------------- Begin Process List ---------------------------------------------->
 process song1                               %begin the process by defining the name
 Music.PlayFile ("goodnightnewman.wav")  %tell the process what to do
 end song1                                   %end the process
 
 process song2
 Music.PlayFile ("runforrestrun.wav")
 end song2
 
 process song3
 Music.PlayFile ("sc_bond.wav")
 end song3
 
 process song4
 Music.PlayFile ("thebestschoolieverteachedat.wav")
 end song4
 
 process song5
 Music.PlayFile ("spiderpig.wav")
 end song5
 
 process song6
 Music.PlayFile ("121gigawatts.wav")
 end song6
 
 process song7
 Music.PlayFile ("failure.wav")
 end song7
 
 process song8
 Music.PlayFile ("rickroll.mp3")
 end song8
 
 process song9
 Music.PlayFile ("deanyell.wav")
 end song9
 
 process song10
 Music.PlayFile ("technobond.wma")
 end song10
 
 process song11
 Music.PlayFile ("technostarwars.wav")
 end song11
 %<-------------------------------- End Process List ------------------------------------------>
 
 
 %<-------------------------------- Begin Procedure List -------------------------------------->
 proc goto1 %name the procedure
 fork song1 %tell the procedure what to do (in this case it will fork process "song1")
 end goto1  %end the procedure
 
 proc goto2
 fork song2
 end goto2
 
 proc goto3
 fork song3
 end goto3
 
 proc goto4
 fork song4
 end goto4
 
 proc goto5
 fork song5
 end goto5
 
 proc goto6
 fork song6
 end goto6
 
 proc goto7
 fork song7
 end goto7
 
 proc goto8
 fork song8
 end goto8
 
 proc goto9
 fork song9
 end goto9
 
 proc goto10
 fork song10
 end goto10
 
 procedure goto11
 fork song11
 end goto11
 
 proc goto12
 Music.PlayFileStop
 end goto12
 %<------------------------------------ End Procedure List ------------------------------------->
 
 View.Set ("graphics")
 colorback (black)
 loop
 
 exit when G.button (50, 1, "QUIT")
 
 G.procButton (50, 375, "Good Night Newman", goto1)
 G.procButton (50, 350, "Run Forest Run", goto2)
 G.procButton (50, 325, "Bond, James Bond", goto3)
 G.procButton (50, 300, "This is the best school I've Ever Teached At", goto4)
 G.procButton (50, 275, "Spider Pig", goto5)
 G.procButton (50, 250, "121 Gigawatts!", goto6)
 G.procButton (50, 225, "Failure is not an option", goto7)
 G.procButton (50, 200, "Rick-Roll (ERROR- .mp3)", goto8)
 G.procButton (50, 175, "Howard Dean Yell", goto9)
 G.procButton (50, 150, "Techno Bond (ERROR- .wma)", goto10)
 G.procButton (50, 125, "Techno Star Wars", goto11)
 G.procButton (125, 1, "<------------STOP ALL MUSIC---------->", goto12)
 
 delay (100)
 
 Text.Cls
 
 end loop
 
 | 
 
 
 
 
	
		
	 
		| Description: | 
			
				| The zip file of all the necessary components |  |  Download
 |  
		| Filename: | cart.zip |  
		| Filesize: | 24.07 MB |  
		| Downloaded: | 159 Time(s) |  
 
 
	
		
	 
		| Description: |  |  Download
 |  
		| Filename: | cart.t |  
		| Filesize: | 2.99 KB |  
		| Downloaded: | 136 Time(s) |  
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| Diablo117 
 
  
 
 
 | 
			
				|  Posted: Fri Jul 11, 2008 1:37 am    Post subject: Re: Cart Machine (Sound Clips) |  |   
				| 
 |  
				| After playing around with ur code for about 10 mins I found a solution for the seizure-tastic screen u had  , btw are u new to programming/turing cuse that program seems pretty advanced seeing as how I just started and it seems like you did too. 
 Thats the bottom part of the code you will want to edit, if it doesnt work, u can slap me cuse im well known for forgetting to put important details
   
 %<------------------------------------ End Procedure List ------------------------------------->
 
 View.Set ("graphics,offscreenonly,nobuttonbar")
 colorback(255)
 cls
 loop
 
 
 exit when G.button (50, 1, "QUIT")
 
 G.procButton (50, 375, "Good Night Newman", goto1)
 View.Update
 G.procButton (50, 350, "Run Forest Run", goto2)
 View.Update
 G.procButton (50, 325, "Bond, James Bond", goto3)
 View.Update
 G.procButton (50, 300, "This is the best school I've Ever Teached At", goto4)
 View.Update
 G.procButton (50, 275, "Spider Pig", goto5)
 View.Update
 G.procButton (50, 250, "121 Gigawatts!", goto6)
 View.Update
 G.procButton (50, 225, "Failure is not an option", goto7)
 View.Update
 G.procButton (50, 200, "Rick-Roll (ERROR- .mp3)", goto8)
 View.Update
 G.procButton (50, 175, "Howard Dean Yell", goto9)
 View.Update
 G.procButton (50, 150, "Techno Bond (ERROR- .wma)", goto10)
 View.Update
 G.procButton (50, 125, "Techno Star Wars", goto11)
 View.Update
 G.procButton (125, 1, "<------------STOP ALL MUSIC---------->", goto12)
 View.Update
 
 
 delay (100)
 end loop
 
 Edit: Having no life @ 2:51 AM I once again scanned your code and noticed that the quit button doesnt exit game but only ends it, insert this into your module with function button
 
 function button (x, y : int, text : string) : boolean
 Mouse.Where (mx, my, mz)
 var w := Font.Width (text, bFont) + 10
 if mx > x and mx < x + w and my > y and my < y + 20 and mz = 1 then
 Draw.FillBox (x, y, x + w, y + 20, c1)
 Draw.FillBox (x + 2, y + 1, x + w - 1, y + 20 - 2, c2)
 Font.Draw (text, x + (w div 2) - (Font.Width (text, bFont) div 2), y + 5, bFont, fc)
 
 Window.Hide (Window.GetActive)
 
 View.Update
 
 delay (200)
 result true
 else
 Draw.FillBox (x, y, x + w, y + 20, c2) %25
 Draw.FillBox (x + 1, y + 2, x + w - 2, y + 20 - 1, c1) %29
 Font.Draw (text, x + (w div 2) - (Font.Width (text, bFont) div 2), y + 5, bFont, fc)
 View.Update
 
 result false
 end if
 end button
 
 if you dont understand how that works then visit Delos's Tutorial about windows here : http://compsci.ca/v3/viewtopic.php?t=8901
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| pkjr92 
 
 
 
 
 | 
			
				|  Posted: Fri Jul 11, 2008 4:14 am    Post subject: Re: Cart Machine (Sound Clips) |  |   
				| 
 |  
				| Thanks, it runs smoothly now.  I've been programming in Turing for about a year, and everything except the GUI module is mine.  Oh, and the reason I didn't put the Window.Hide command in is because I was planning to compile a stand-alone anyway, which terminates when the run window is finished. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| SNIPERDUDE 
 
  
 
 
 | 
			
				|  Posted: Fri Jul 11, 2008 9:38 am    Post subject: RE:Cart Machine (Sound Clips) |  |   
				| 
 |  
				| Well then... Welcome to Turing and CompSci guys!
   |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Diablo117 
 
  
 
 
 | 
			
				|  Posted: Fri Jul 11, 2008 11:44 am    Post subject: Re: Cart Machine (Sound Clips) |  |   
				| 
 |  
				| ah cool, that explains it, im on my first week. 
 @Sniperdude, thanks
   |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| SNIPERDUDE 
 
  
 
 
 | 
			
				|  Posted: Fri Jul 11, 2008 3:00 pm    Post subject: RE:Cart Machine (Sound Clips) |  |   
				| 
 |  
				| No problem! 
 btw, check out the Turing Walkthrough - it's packed with usefull tutorials
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Zren 
 
  
 
 
 | 
			
				|  Posted: Fri Jul 11, 2008 3:35 pm    Post subject: Re: Cart Machine (Sound Clips) |  |   
				| 
 |  
				| You don't really need call12 since Music.PlayFileStop is in itself, a procedure. So this would work too: 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |