473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to read from a data from a file - for a game

7
Hi, I am new to VB (and to programming in general). Anyway, I would like to create a simple game where the user is presented with a question (taken from a datafile, .dat) and given to choices, TRUE or FALSE, or/and YES or NO. I read somewhere that it would be "easier" to invoke such datafile with a function...but how do I do that?

Would greatly appreciate any help with this little project!!!

Thank you very much!

Roldan
Mar 10 '07 #1
5 1079
Roldan
7
I am sorry to have posted the message again...but I needed to edit and I went beyound the 5 minute limitation period to do so!!!

Here's the edited message:

Hi, I am new to VB (and to programming in general). Anyway, I would like to create a simple game where the user is presented with a question (taken from a datafile, .dat or .txt) and given two choices, TRUE or FALSE, or/and YES or NO or if applicable he/she can enter the answer in a textbox, I read somewhere that it would be "easier" to invoke and read such datafile with a function...but how do I do that?

In the .dat or .txt file, how is the data typed?

as:

What is the Capital of France?
Paris

or

"What is the Capital of France?"
"Paris"

etcetera...

The questions (and the answers) -there would be many questions with their respective answers in the datafile-, need to be read from the file either in sequence or in a random fashion (I would love to know how to do it both ways though!). If feasible (as I think it is!), it would also be nice to add a sound clip for the right or wrong answer is given.

Would greatly appreciate any help with this little project!!!

Thank you very much!

Roldan
Mar 10 '07 #2
Roldan
7
Ooops! I did it again! (A la Britney Spears!)

...sorry...

I forgot to mention that I have both vb6 or vs2005...also, I know that I could work out a solution using a zillion IF loops or CASE SELECTs but I don't think that, programmatically, this is an elegant solution!!!

Thank You !

Roldan
Mar 10 '07 #3
willakawill
1,646 1GB
Is this data file of your own creation?
Mar 10 '07 #4
Roldan
7
Hi!

Yes, I am planning on compiling a list of answers&questions, then use this file in that little game....of course, I am open to suggestions to ideas and solutions!

Thanks for replying!

Roldan
Mar 10 '07 #5
willakawill
1,646 1GB
Hi!

Yes, I am planning on compiling a list of answers&questions, then use this file in that little game....of course, I am open to suggestions to ideas and solutions!

Thanks for replying!

Roldan
Well you can create a data structure to store questions and answers. then you create an array of that structure. Then you save and open your array in binary format. That should be enough info for you to be googling for a couple of weeks. Good luck
Mar 10 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jacob H | last post by:
Hello all, Today I began writing a utility script that takes given binary files and puts them all into one datafile. My idea is to be able to access any binary data I want by indexing the...
6
by: Jocknerd | last post by:
I'm a Python newbie and I'm having trouble with Regular Expressions when reading in a text file. Here is a sample layout of the input file: 09/04/2004 Virginia 44 Temple ...
5
by: DarkPhoenix739 | last post by:
I have 3 classes: a Windows Form, a Game, and a Piece. The Game has a Piece, and the Windows Form has a Game. The Windows Form needs to be able to "get" the game's Piece, and view its data, but not...
5
by: CSharp-Jay | last post by:
So I have been programming in C# on a personal level as of lately, and am curious about something. Lately I have been experimenting around with file create/write, etc. I can open and read the...
2
by: shinerankin | last post by:
Hi Guys & Gals: I have a project with using flash that is updated with an xml file. The developer went belly up and is no longer assisting with anything. I need to write a simple html or php form...
2
iam_clint
by: iam_clint | last post by:
Hello everyone I'm still learning vb.net and I'm stuck on something. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim...
0
by: dschu012 | last post by:
I was wondering how someone would read the data from a flash game. For instance in a game like Text Twist on Yahoo! Games (Text Twist) It would be cool if you could get a program that could read in...
1
by: Van Dugall | last post by:
Hello I have been writing a game in javascript which works fine but I wanted to step it up and request the data of the game from the server. I haven't really used php...all I know is from the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.