Re: save and load sequences ??
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Sep 13, 2000
- 394 views
<giggle!> Of course, Irv's "tested" code should have one of the duplicated > include get.e > atom fn > object topten at the beginning removed so it can actually run :) Dan ----- Original Message ----- From: "irv" <irv at ELLIJAY.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Tuesday, September 12, 2000 8:23 PM Subject: Re: save and load sequences ?? > On Tue, 12 Sep 2000, you wrote: > > Hi Folks > > > > Ive got a game almost done but Im > > trying to add running score that saves to disk file. > > > > I want to use the following sequence for my scores: > > > > sequence TopTen > > TopTen = repeat({"NoName", 0} ,10)--This will be what it starts out with > > > > Ive been able to save it to disk > > but reading it back has been a challenge for me. > > Ive been saving it as a text file and reading it like such. > > for x = 1 to 10 > > TopTen[x][1] --The text comes up fine > > TopTen[x][2] --but the numbers dont come out right > > end for > > > > I read and tried to understand The mydata.ex file > > in the Demo directory but it is hard for me to follow. > > > > Any help here would be appreciated. > > > > Thank you > > Gene > > --Tested code: > include get.e > atom fn > object topten > include get.e > atom fn > object topten > > topten = repeat({"NaName",0},10) > fn = open("scores","w") > print(fn,topten) > close(fn) > > topten = {} > > fn = open("scores","r") > topten = get(fn) > topten = topten[2] > for i = 1 to length(topten) do > printf(1,"Name: %s Score: %d\n",topten[i]) > end for > topten = repeat({"NaName",0},10) > fn = open("scores","w") > print(fn,topten) > close(fn) > > topten = {} > > fn = open("scores","r") > topten = get(fn) > topten = topten[2] > for i = 1 to length(topten) do > printf(1,"Name: %s Score: %d\n",topten[i]) > end for > -- > Regards, > Irv