![]() |
|
|
#1 | ||
|
College Benchwarmer
Join Date: Jan 2006
|
Ping: Visual Basic Programmers
I am trying to learn VB programming and my first project is a very simple soccer game based on attack and defence ratings. What I want to do is store the teams and their rating in a .dat file that can retrieve the ratings as each team plays. It is very simple. The only data I need to store is the team name (example, Liverpool) the nickname, (The Reds), home ground (Anfield), attack rating (an integer between 1 and 100) and defence rating (between 1 and 100).
What is the best way to do this? Just create a text document with something like Liverpool,The Reds,Anfield,78,76? Or do I have to create some kind of input form and write the data to a file that way? Thanks guys. |
||
|
|
|
|
|
#2 |
|
College Prospect
Join Date: Nov 2000
Location: Gothenburg, Sweden
|
create a type for the team.. like this:
Code:
The use random access to retrieve the data lets see if I remember this.. might be a bit sloppy, but whatever Code:
Oh.. and obviously you need to save as well.. check this article out: http://support.microsoft.com/kb/150700 Since you have so few variables, you might actually use textfiles rather than binary files though.. That's much easier.. Use the same type, but start by creating a textfile like this: Liverpool,Anfield,60,70 Arsenal, Emirate Stadium, 99,99 Then use this little sub to read rather than the stuff I used above (replace everything from Open to Loop Code:
This might need a few changes.. a bit tired here.. and I'm basically writing from memory..
__________________
IFL - Vermont Mountaineers ~ I am an idiot, walking a tight rope of fortunate things ~ Last edited by Coder : 12-16-2006 at 06:28 PM. Reason: Forgot a few things |
|
|
|
|
|
#3 |
|
College Benchwarmer
Join Date: Jan 2006
|
|
|
|
|
|
|
#4 | |
|
College Prospect
Join Date: Nov 2000
Location: Gothenburg, Sweden
|
Quote:
Chelsea,Toilet,1,1 ![]()
__________________
IFL - Vermont Mountaineers ~ I am an idiot, walking a tight rope of fortunate things ~ |
|
|
|
|
|
|
#5 |
|
Pro Rookie
Join Date: Oct 2000
|
|
|
|
|
|
|
#6 |
|
College Benchwarmer
Join Date: Jan 2006
|
|
|
|
|
|
|
#7 |
|
College Benchwarmer
Join Date: Jan 2006
|
Now I assume I can do something similar with the fixture list. I would like to assign each team a number from 1 to 20 and then have the fixtures look like this:
1,20 2,19 3,18 with the home side listed first. Then at the end of the season renumber all the teams so that the fixtures change. Does that sound right? |
|
|
|
|
|
#8 |
|
College Benchwarmer
Join Date: Jan 2006
|
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|