I've written a game based on the Tour of France and it's the nearest to a simulation I can do. BUT I can't save values fron one sessions to the next. So if I run say 6 stages one evening, the only way I can keep the changes is by leaving everything 'on' all night - if I turn thr computer off, the changes to the strings are lost - and I have to start at stage 1 again.
I've made deperate pleas for help before and people have kindly replied but I've got a complate mental block on this as well as basic ignorance. Please could someone explain to me as they might explain to a child of 5, how I can save the content of a string whose values have been changes 'within the game' so these values replace the original ones and will still be there when I next turn everything on
thanks
Eric Walter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The program is really long and tortuous.An explanation is simpler.
Say it's football game with 10 teams. All the teams would start off with no points so I'd have a line -
dim pts(10):for f=1 to 10:read pts(f):next
and a data line -
data 0,0,0,0,0,0,0,0,0,0
In the course of the evening, Swansea (say) might get (say) 11points.
But then it's time for bed and I have to turn everything off and I'm onlypart way through the season!
When I next load and run the program,Swansea (and everyone else) all are back with 0 points each. What I need is something so that when I next load and run, Swansea continue with from points
Inspite of kind efforts to explain,I still haven't a clue!
thanks
Eric Walter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What you want to do is before you go to bed is call a save subroutine. When you are ready to resume play then you call a load subroutine. In your example you are trying to save the pts() array. Here is how you go about saving and loading it:
10 FOR i=1 TO 10:READ pts(i):NEXT
20 DATA 1,2,3,4,5,4,3,2,1,0
30 'save points
40 OPEN "o",#1,"pts.txt"
50 FOR i=1 TO 10:PRINT #1,pts(i);:NEXT
60 PRINT #1,
70 CLOSE #1
80 'erase points to prove they are saved
90 ERASE pts
100 'load points
110 OPEN "i",#1,"pts.txt"
120 FOR i=1 TO 10:INPUT #1,pts(i):NEXT
130 CLOSE #1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Very many thanks Anonymous. I've been playing around with basic starting with Mallard Basic in abt.1985. Once, in abt. 1989, I managed to do it without any help - but the disc got damaged and it was lost forever. Since then I have tried and tried but I really have a mental block & I'm not clever enough to understand first principles. At the moment, I'm too nervous to try it out!!
Eric Walter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I've written a game based on the Tour of France and it's the nearest to a simulation I can do. BUT I can't save values fron one sessions to the next. So if I run say 6 stages one evening, the only way I can keep the changes is by leaving everything 'on' all night - if I turn thr computer off, the changes to the strings are lost - and I have to start at stage 1 again.
I've made deperate pleas for help before and people have kindly replied but I've got a complate mental block on this as well as basic ignorance. Please could someone explain to me as they might explain to a child of 5, how I can save the content of a string whose values have been changes 'within the game' so these values replace the original ones and will still be there when I next turn everything on
thanks
Eric Walter
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Please upload your program if possible and exactly what you want to save.
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
The program is really long and tortuous.An explanation is simpler.
Say it's football game with 10 teams. All the teams would start off with no points so I'd have a line -
dim pts(10):for f=1 to 10:read pts(f):next
and a data line -
data 0,0,0,0,0,0,0,0,0,0
In the course of the evening, Swansea (say) might get (say) 11points.
But then it's time for bed and I have to turn everything off and I'm onlypart way through the season!
When I next load and run the program,Swansea (and everyone else) all are back with 0 points each. What I need is something so that when I next load and run, Swansea continue with from points
Inspite of kind efforts to explain,I still haven't a clue!
thanks
Eric Walter
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
What you want to do is before you go to bed is call a save subroutine. When you are ready to resume play then you call a load subroutine. In your example you are trying to save the pts() array. Here is how you go about saving and loading it:
10 FOR i=1 TO 10:READ pts(i):NEXT
20 DATA 1,2,3,4,5,4,3,2,1,0
30 'save points
40 OPEN "o",#1,"pts.txt"
50 FOR i=1 TO 10:PRINT #1,pts(i);:NEXT
60 PRINT #1,
70 CLOSE #1
80 'erase points to prove they are saved
90 ERASE pts
100 'load points
110 OPEN "i",#1,"pts.txt"
120 FOR i=1 TO 10:INPUT #1,pts(i):NEXT
130 CLOSE #1
View and moderate all "[CLOSED] General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Very many thanks Anonymous. I've been playing around with basic starting with Mallard Basic in abt.1985. Once, in abt. 1989, I managed to do it without any help - but the disc got damaged and it was lost forever. Since then I have tried and tried but I really have a mental block & I'm not clever enough to understand first principles. At the moment, I'm too nervous to try it out!!
Eric Walter