Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Need help with THINK Pascal 4.5
Closed Thread
Old 01-18-2006, 04:51 PM   #1 (permalink)
 
True Techie

Join Date: Dec 2004

Posts: 102

M2k4

Default Need help with THINK Pascal 4.5

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.
M2k4 is offline  
Old 01-19-2006, 03:19 AM   #2 (permalink)
void's Avatar
 
True Techie

Join Date: Oct 2005

Posts: 198

void

Default

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
void is offline  
Old 01-19-2006, 05:59 PM   #3 (permalink)
 
True Techie

Join Date: Dec 2004

Posts: 102

M2k4

Default

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?
M2k4 is offline  
Old 01-20-2006, 03:54 AM   #4 (permalink)
void's Avatar
 
True Techie

Join Date: Oct 2005

Posts: 198

void

Default

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.
void is offline  
 
Closed Thread

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On