
-----------------------------------
death bringer
Tue Jun 24, 2008 1:14 pm

Guitar hero Help
-----------------------------------
Ok so what im really wanting help with is positioning the keys. I know a longer way of doing this (see lines 431-434) but im just wondering is there a faster way of doing this because I don't feel like placing the keys 914 times (only have 105 done) anyways Can someone help me so this can be done faster? But still keeping the game the way it is. Also is there some things i can do in the code to make it more neat? open to all comments and ideas

-----------------------------------
MichaelM
Tue Jun 24, 2008 2:56 pm

Re: Guitar hero Help
-----------------------------------
Well, I'd like to offer some help, but when I try to run it, I get "illegal picture ID number '0'. (On line 32). Did you forget to include one of the pictures?

Also, its very difficult to see how to help (starting line 431) when your code is not properly indented. When its all in one huge horizontal line its very hard to read
and understand. If indentation is not a habit, I suggest using ctrl+i , which does it for you. In this case, since there is so much to indent Turing does not have
enough memory to indent it. I began to do it manually, and I think I see the pattern in your code which can probably be simplified using loops. Otherwise, to quicken a long sequence of ifs you can use elsifs.

Heres my suggestion based on a small section of that big line of ifs. I based it on my assumption that your comparisons are always going up by twos, and your assingment to the variable notesdiff is going from 1 to 5 then back down to 1 (1,2,3,4,5,4,3,2,1,2,3,4,5 and so on). If this pattern does not continue, the following code may not work for all the way to 914 notes or whatever.

First of all, elsifs will shorten the length of your code (see tutorial: 
if totalnotes > 1 then
    DIFF := 150
elsif totalnotes > 3 then
    notesdiff := 3
elsif totalnotes > 5 then
    notesdiff := 4
elsif totalnotes > 7 then
    notesdiff := 5
elsif totalnotes > 9 then
    notesdiff := 4
elsif totalnotes > 11 then
    notesdiff := 3
elsif totalnotes > 13 then
    notesdiff := 2
elsif totalnotes > 15 then
    notesdiff := 1
end if


However, the above will not help in your case, since Turing looks over these ifs chronologically, and once one of them is met, the check is complete. 
Ex. if totalnotes is 4, the first if just wants greater than 1, and 4 is greater than 1, so notesdiff would be 1. I am guessing that you want notesdiff to 
be 3 when totalnotes is 4. You'll have to fix that for checking if totalnotes is between certain numbers. 
Your ifs check greater than 3, and then greater than 5. Im guessing your greater than 3 wants the numbers that are greater than 3, but not greater
than 5, meaning the numbers 4 and 5 are acceptable. You'll need two checks in each line to do that:


if totalnotes > 1 and totalnotes 3 and totalnotes 5 and totalnotes 7 and totalnotes 9 and totalnotes 11 and totalnotes 13 and totalnotes 15 and totalnotes 
for i:1..numNotes 
    get : fileId, notes ( i ) 
end for  


For the file load is that supposed to be a turing file or musicfile or what because i'm not geting what file you want me to load.
if this is a turing file i have to load while runing my program what's the deal with this? 
What would the code be in the loaded file?
How would i do this?

As you can tell i've nv loaded a file in a game b4

-----------------------------------
DemonWasp
Thu Jun 26, 2008 12:56 pm

RE:Guitar hero Help
-----------------------------------
There are a few different ways to distinguish files:

Text - these files are the kind that you write using Turing (your .t files), in Notepad (usually .txt and so on) and so on. These files are then human-readable when opened with Notepad or similar tools.
Binary - these files contain data in a more compressed format, and are unreadable to (most) humans. You need special tools to make sense of these files. Your .mp3 files fall into this category, as they contain song information represented as something other than letters - just straight numbers.

"Data" files - these contain information that your program will use, but do not actually contain code that gets executed. Your .mp3 file is an example of this: it just describes what the song sounds like; the program you use to play mp3 files describes HOW to play .mp3 files.
"Code" files - these are usually text files which contain code that tells the computer what you want it to do (such as your .t files)
"Executable" files - these tell your computer exactly what to do, without it having to try to understand the code files (which are designed to be human-readable, not machine-readable). These usually have a .exe ending, and will run without any special programs.

This solution requires the following:

1. Your CODE file (guitar_hero.t or whatever). This contains all of your Turing code, BUT it does NOT contain any information on where the notes are, and it has NO information on what the song sounds like.

2. The SOUND file (death_bringer.mp3 or whatever). This contains ONLY information describing the sound to be played - not information on where the notes are, nor does it contain any executable code.

3. The NOTES file (death_bringer_easy.song or whatever). This contains ONLY information describing where notes are. It does NOT contain more Turing code, and it does NOT contain song information.

When your program starts running, Turing reads your CODE file (#1) and figures out what to start doing. At some point, it comes across some code that tries to open the NOTES file (#3), and reads from that into your array variable. Then, it gets a Music.PlayFileReturn call that tells it to play the SONG file (#2), and the music starts playing.

As a footnote, you can use [ syntax = "turing" ] [ / syntax ] tags to highlight your code properly. This makes it a lot easier to read, and makes it easier for us to help you.

-----------------------------------
death bringer
Thu Jun 26, 2008 1:48 pm

Re: Guitar hero Help
-----------------------------------
ok i made a notepad txt document but every time i load the document and run my pro gram i get this warning

Get attempted on incompatible stream number 1

whats this mean ?
(i will post my files)

also is it because i didn't set the document right or because i posted in a wrong area of my .t program or what?
btw thank you for still helping

-----------------------------------
DemonWasp
Thu Jun 26, 2008 2:00 pm

RE:Guitar hero Help
-----------------------------------
First, I'm not seeing any usage of "open" in that code. Are you sure you sent the right version? (Remember, I told you to make a backup...you appear to have sent the backup instead of the file you're working on).

"Get attempted on incompatible stream number" just means that Turing couldn't find the file. The simple way to fix this (stupid) problem is to open Turing by double-clicking on your .t code file instead of double-clicking on Turing.

(Explanation)
When you start by running Turing.exe, Turing's default search path for your files is the path to the Turing.exe executable file...so it looks there, and doesn't see notes.txt, so it fails.

When you start by opening guitar_hero.t, Windows figures out that you want to start Turing, and sets its default lookup path to the path to your guitar_hero.t (and notes.txt) files, so it should find the file.

-----------------------------------
death bringer
Thu Jun 26, 2008 2:59 pm

RE:Guitar hero Help
-----------------------------------
could you give me an example be cause to be honest i don't under stand maybe i'm just not ready to i dunno but i've been trying to get this I really have but I just dunno how you are loading and stuff. here's my cleaned up file

also may be if you have and exaple of one of your programs that loadis a file I could see it and maybe that would help me understand what you did to load. 
if you infact do have a program that using a load can you point out what allows turing to use it?

-----------------------------------
DemonWasp
Thu Jun 26, 2008 3:16 pm

RE:Guitar hero Help
-----------------------------------
Well, if you want to make a simple example, do the following:

1. Open Turing.
2. Make a new file, and give it this as its contents:
% Open a file for input. The "fileId" variable is used by Turing to track which
% file we want to access; "filename" should be replaced by the name of the file
% you want to load, and "read" means that we're reading from the file (using
% "get" only, never "put").
var fileId : int
open : fileId, "notes.txt", read

% Variable initialisation for storage of the notes. 
var numNotes : int      % Contains the number of notes in the song
get : fileId, numNotes  % Get the number of notes from the song (first line)
var notes : array 1..numNotes of string % Make an array that's just big enough

% Load the notes from the file. Each element in the array will represent the
% n-th set of notes in the song. Once this has completed, you can access the
% n-th line in the song with < notes ( n ) >
for i:1..numNotes
    get : fileId, notes ( i )
end for

% Output slowly, as an example
for i:1..numNotes
    put "Line ", i , " -> '", notes ( i ) , "'"
    delay (500)
end for


3. Save that file (as example1.t) to your desktop and exit Turing.

4. Right-click on your Desktop -> New -> New text file. This should make a new file with the Notepad icon named something like "New Text Document.txt". Rename it to "notes.txt" (without the quotes).

5. Open notes.txt and put the following in it:
7
--x--
-x---
x----
-x---
--x--
---x-
----x

6. Save notes.txt and close Notepad.

7. At this point, you should have example1.t right next to notes.txt on your Desktop.

8. Double-click on example1.t to open it.

9. When you run example1.t, it will open notes.txt for reading, read the 7 (so it knows how many lines there are), then it will read the next 7 lines into the array notes(). It will then output them slowly, with line numbers and quotes around them.


*Edit: It's worth noting that I'm writing that code without the Turing program available, all from memory of years past. It may not work. Just let me know and I'll try it when I have access to Turing.

-----------------------------------
death bringer
Thu Jun 26, 2008 6:25 pm

RE:Guitar hero Help
-----------------------------------
I got the same warning


Get attempted on incompatible stream number 1... was i supposed to open example1 in my guitar hero cause i keep getting the warning just running example 1
also is it that you can't download turing?

-----------------------------------
DemonWasp
Fri Jun 27, 2008 9:48 am

RE:Guitar hero Help
-----------------------------------
* I'm not running Windows right now. I *can't* run Turing, even if I had the executable with me.

For the tutorial given above, COMPLETELY IGNORE your existing guitar hero code. It DOESN'T have anything to do with the tutorial.

Follow the instructions again, paying careful attention to do EXACTLY as the instruction says. Doing something "similar, but not exactly the same" won't help you in many cases.

-----------------------------------
death bringer
Fri Jun 27, 2008 10:57 am

RE:Guitar hero Help
-----------------------------------
I did exactly what u had said but every time i run it i get a message on line 10 (get : fileId, numNotes) (message is Get attempted on incompatible stream number 1)

-----------------------------------
DemonWasp
Fri Jun 27, 2008 12:32 pm

RE:Guitar hero Help
-----------------------------------
Turing is having trouble opening the file, for any one of several reasons.

Make sure the name of the file EXACTLY matches what you have on the "open" line. Case DOES matter.

Make sure that both files are in the same folder (preferably your desktop).

Make sure that you open the file by double-clicking on the example1.t file, and NOT by double-clicking on Turing.

-----------------------------------
death bringer
Fri Jun 27, 2008 3:04 pm

Re: Guitar hero Help
-----------------------------------
... look at the pics i have below then (in the dling file)
anyone know whats wrong?
the pics show that the example doesn't work

-----------------------------------
death bringer
Sat Jun 28, 2008 10:35 am

RE:Guitar hero Help
-----------------------------------
Czn anyone help me if there is no answer i will be done with this topic if none can help (2 days Time)(june 30 10:36 am

-----------------------------------
DemonWasp
Mon Jun 30, 2008 12:56 pm

RE:Guitar hero Help
-----------------------------------
Whoops. Apparently I fail at writing code without testing it. The code is like 99% correct, but there's a subtle problem:

1. I open the file for "read".
2. I use "get" to read from the file.
3. "get" is not the same as "read" in Turing.

So just change
open : fileId, "notes.txt", read
to
open : fileId, "notes.txt", get

That should fix your problem. Sorry, my mistake.

-----------------------------------
death bringer
Mon Jun 30, 2008 1:05 pm

RE:Guitar hero Help
-----------------------------------
Ohh ty thats awsome\
now i just have to find a way to put it into my game lol
