Thanx all. I have now managed to change
rem archers----------------------------------------------------------
if file exist("savegamesslot1archers.txt")
open to read 1,"savegamesslot1archers.txt"
read string 1,str$
archercount# = val(str$)
if archercount#>0
read string 1,str$
archerhealth1#=val(str$)
endif
if archercount#>1
read string 1,str$
archerhealth2#=val(str$)
endif
if archercount#>2
read string 1,str$
archerhealth3#=val(str$)
endif
if archercount#>3
read string 1,str$
archerhealth4#=val(str$)
endif
if archercount#>4
read string 1,str$
archerhealth5#=val(str$)
endif
if archercount#>5
read string 1,str$
archerhealth6#=val(str$)
endif
if archercount#>6
read string 1,str$
archerhealth7#=val(str$)
endif
if archercount#>7
read string 1,str$
archerhealth8#=val(str$)
endif
if archercount#>8
read string 1,str$
archerhealth9#=val(str$)
endif
if archercount#>9
read string 1,str$
archerhealth10#=val(str$)
endif
if archercount#>10
read string 1,str$
archerhealth11#=val(str$)
endif
if archercount#>11
read string 1,str$
archerhealth12#=val(str$)
endif
if archercount#>12
read string 1,str$
archerhealth13#=val(str$)
endif
if archercount#>13
read string 1,str$
archerhealth14#=val(str$)
endif
if archercount#>14
read string 1,str$
archerhealth15#=val(str$)
endif
if archercount#>15
read string 1,str$
archerhealth16#=val(str$)
endif
if archercount#>16
read string 1,str$
archerhealth17#=val(str$)
endif
if archercount#>17
read string 1,str$
archerhealth18#=val(str$)
endif
if archercount#>18
read string 1,str$
archerhealth19#=val(str$)
endif
if archercount#>19
read string 1,str$
archerhealth20#=val(str$)
endif
close file 1
endif
print archerhealth1#
print archerhealth2#
print archerhealth3#
print archerhealth4#
print archerhealth5#
print archerhealth6#
print archerhealth7#
print archerhealth8#
print archerhealth9#
print archerhealth10#
print archerhealth11#
print archerhealth12#
print archerhealth13#
print archerhealth14#
print archerhealth15#
print archerhealth16#
print archerhealth17#
print archerhealth18#
print archerhealth19#
print archerhealth20#
rem archers----------------------------------------------------------
into
if file exist("savegamesslot1archers.txt")
open to read 1,"savegamesslot1archers.txt"
read string 1,str$
archercount# = val(str$)
dim archerhealth#(archercount#)
for t=1 to archercount#
read string 1,str$
archerhealth#(t) = val(str$)
next t
close file 1
endif
for t=1 to archercount#
print archerhealth#(archercount#)
next t
.
One question, however. How would I increase the number of archers later on in the game (this is the only part of the game I have done yet and was supposed to be just for practising saving but now I've started it I might as well have a shot at finishing it)? Would I have to do
if (condition)
archercount#=archercount#+1
dim archerhealth2#(archercount#)
for t=1 to archercount#-1
archerhealth2#(t)=archerhealth#(t)
next t
archerhealth#(archercount#)=100
undim archerhealth#
dim archerhealth#(archercount#)
for t=1 to archercount#
archerhealth#(t) = archerhealth2#(2)
next t
undim archerhealth#2
endif
or is there a way of just increasing the numbers of variables stored in an array. Please note: this code may be rubbish-I don't know, I've just figured it out and basically what it is supposed to do is make a second array with the new amount of archers, transfer all the variables to the second array and add a new one with full health (100). Then it deletes the original array, rebuilds it with the new number of archers, transfers the data back and deletes the seccond array. This is probably a very long-winded way of doing things, but please help! I NEED FEEDBACK - will this work?
Am I the only one here who's really confused?