Need help with THINK Pascal 4.5

Status
Not open for further replies.

M2k4

In Runtime
Messages
102
I am currently learning Pascal in school and I have a project, I need to make a game. The game is a "simon says" style game and I want to do things like add a highscore chart and add sound.
There's one problem though, the compiler we're using is called THINK Pascal 4.5 and we are running it on Mac emulators. From what I understand this compiler was used basicly before Jesus so I can't find any documentation on it.

If anyone has used THINK Pascal before and knows how to read and write data files and play sounds (system speaker sounds will do fine) please post, I would really like more information on how to do these kinds of things since my teacher dosn't seem to know jack **** about the language. (Already asked him, he either dosn't know or won't tell me)
I have already looked a www.pascal-central.com and it has some useful information but I need tutorials not just source code. (I need to know how the functions work)

Thanks in advance.
 
Only good like I found.

http://www.lysator.liu.se/~ingemar/tp45d4/think.html

I used to do Pascal, but its a long time ago. I think theres methods (called procedures in Pascal ) called:
System.Read();
System.ReadLn()'
System.Write();
System.WriteLn(); (If your using System, then you don't need the "System." in front)

I not sure of parameters, but ReadLn/WriteLn are for text files. You also have to use the assignfile method to open, then the closefile to close a file. Heres some code I found/put together.

var file: textfile;
Assignfile(file, 'fileName.txt'); // assigns the filename to the file variable
Rewrite(file); //Opens the file(I think that creates the file, or creates a new one if that file exists. There is also reset to open a file, but its different to rewrite)
writeln(file, 'string written into text file');//Writes the string to the file
closefile(file);//Closes the file

Hope that helps
 
Thanks for the information. I'll try fiddiling around with that for a while and see if I can get it working. I would like to knwo how to play sound files too though. I've tried the "sysbeep" command but it dosn't work. Is there a way I can get it to just play a simple WAV or MIDI?
 
You would have to look for a object that handles playing sound and create a new instance of it. The problem is I haven't a clue what that object could be. The code would be like this, but this isn't exact, not even close maybe.

var soundplayer: player // player could be the object, but it is probaby called something, else your'll have to look.
soundPlayer = player.create("mySound.wav"); //This would create the instance of player, allowing you to call methods that do actions like play and stop the sound, etc.
soundplayer.Play; //This would be an example of a method that plays the sound. Again it isn't exact so there may be parameters, or the method isn't called that.
soundplayer.close;

I can't help you too much, you'll have to look through the class libraries and find the relivant class.
 
Status
Not open for further replies.
Back
Top Bottom