When you make code to write to files you only need to copy the code and replace all writes with "read" to be able to read the files.
There were a few problems with your code.
At the end of your code you had copied the function ReadInfo() without the word "function" and without renameing ReadInfo() (so I got rid of it and moved the prints up).
I remed off the call to WriteInfo because it wasn't needed for this test.
Bfirst does equal zero because you have a do loop constantly calling the function PlayGame(). Inside functions all non-dimensionalized strings/integers equal zero. Any changes to strings/integers (that aren't dimed) inside functions only work in the function. Outside the function they remain the same unless changed outside of functions (PassiveSkill(), ActiveSkill(), and BagSlot() can be changed inside functions). So in the PlayGame() function there's no need to have "if bfirst=0" and "bfirst=1" and "endif"... I left them there in case there are things you didn't post in your code.
I added "suspend for key" to wait for a keypress to continue so its easy to see that it's working. Since it's constantly calling PlayGame() it keeps reading the same data over and over again with no end (even though I added an "end" after the do loop... it's never seen but it's a habit of mine).
Hope this helps you.
DIM PassiveSkill(9)
DIM ActiveSkill(9)
DIM BagSlot(19)
AvatarName$ = ""
AvatarLevel = 0
CombatXP = 0
HealXP = 0
bfirst = 0
#INCLUDE "skill.txt"
DO
Playgame()
LOOP
end
Function PlayGame()
if bfirst = 0
DataWriteTest()
`WriteInfo()
DataReadTest()
bfirst = 1
endif
EndFunction
Function ReadInfo()
OPEN TO READ 1, "info.txt"
READ STRING 1, AvatarName$
READ LONG 1, AvatarLevel
READ LONG 1, CombatXP
READ LONG 1, HealXP
remstart
FOR n = 0 to 9
READ LONG 1, PassiveSkill(n)
READ LONG 1, ActiveSkill(n)
NEXT n
FOR n = 0 to 19
READ LONG 1, BagSlot(19)
NEXT n
remend
CLOSE FILE 1
EndFunction
Function WriteInfo()
OPEN TO WRITE 1, "info.txt"
WRITE STRING 1, AvatarName$
WRITE LONG 1, AvatarLevel
WRITE LONG 1, CombatXP
WRITE LONG 1, HealXP
REMSTART
FOR n = 0 to 9
WRITE LONG 1, PassiveSkill(n)
WRITE LONG 1, ActiveSkill(n)
NEXT n
FOR n = 0 to 19
WRITE LONG 1, BagSlot(19)
NEXT n
REMEND
CLOSE FILE 1
EndFunction
Function DataWriteTest()
AvatarName$ = "TestName"
AvatarLevel = 999
CombatXP = 5000
HealXP = 250
OPEN TO WRITE 1, "info.txt"
WRITE STRING 1, AvatarName$
WRITE LONG 1, AvatarLevel
WRITE LONG 1, CombatXP
WRITE LONG 1, HealXP
CLOSE FILE 1
REMSTART
FOR n = 0 to 9
PassiveSkill(n) = rnd(999)
ActiveSkill(n) = rnd(999)
NEXT n
FOR n = 0 to 19
BagSlot(n) = rnd(999)
NEXT n
REMEND
EndFunction
Function DataReadTest()
AvatarName$ = ""
AvatarLevel = 0
CombatXP = 0
HealXP = 0
OPEN TO READ 1, "info.txt"
READ STRING 1, AvatarName$
READ LONG 1, AvatarLevel
READ LONG 1, CombatXP
READ LONG 1, HealXP
PRINT AvatarName$
PRINT AvatarLevel
PRINT CombatXP
PRINT HealXP
suspend for key
REMSTART
FOR n = 0 to 9
PassiveSkill(n) = 0
ActiveSkill(n) = 0
NEXT n
FOR n = 0 to 19
BagSlot(n) = 0
NEXT n
REMEND
CLOSE FILE 1
ENDFUNCTION