[futurebasic] Re: [FB] auto loading a file

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2000 : Group Archive : Group : All Groups

From: "Peter Dempsey" <theviron@...>
Date: Thu, 27 Jul 2000 20:35:16 CDT
>From: Joe Lewis Wilkins <PepeToo@...>
>Reply-To: PepeToo@...
>To: futurebasic@...
>Subject: Re: [FB] auto loading a file
>Date: Thu, 27 Jul 2000 18:18:32 -0700
>
>Peter Dempsey wrote:
>
> > <snip>
> > The problem is that the only way I know (currently) how to open files is
> > using FILES$, which asks the user for a file to open/save.
> >
> > What I want is a kind of preferences file that the application always 
>opens
> > on startup.  It would be in a certain order, and created by my 
>application.
>
>Is it extensive and complicated?  If not, you may just want to store the 
>"data"
>
>in your Resource file, particularly if it is "constant" and doesn't get 
>changed
>
>by the User.  Even then you may still wish to use a resource, probably a 
>#STR
>resource.  This way you don't have to worry about where it gets put, or if 
>it
>gets deleted, and it is very easy for you to implement.
>
>Joe Wilkins
Its very extensive, but not too complicated ;).  Basically I want to save 4 
sets of key combinations (like 10 each, so about 40 chars), and  up to 40 
records.  This is the way that I have in mind: (except that it asks the user 
for place/name)

LOCAL FN WriteKeys(n, p)
  WRITE #n,gLeftKey(p), gRightKey(p), gSpeedUp(p),gSlowDown(p),�
      gPrimary(p), gSecondary(p), gShields(p), gNextTarget(p),�
       gClosestTarget(p), gShowStuff(p), gSelectSecondary(p)
END FN

LOCAL FN SavePref
   DIM cntr
   DEF OPEN "PREF"
   gFileName$ = files$(_fSave,"",,gVolRef%)
   LONG IF len(gFileName$)
      OPEN "O",1,gFileName$,,gVolRef%
      FN WriteKeys(1)
      FN WriteKeys(2)
      FN WriteKeys(3)
      FN WriteKeys(4)

      cntr = 0
      WRITE #1, gShipTypes
      DO
            INC(cntr)
            WRITE #1,ShipInfo(cntr)
      UNTIL cntr = gShipTypes or cntr > gShipTypes
      cntr = 0
      DO
            INC(cntr)
            WRITE #1,PrimaryWeaponInfo(cntr)
      UNTIL cntr = gShipTypes or cntr > gShipTypes
      cntr = 0
      DO
            INC(cntr)
            WRITE #1,SpecialWeaponInfo(cntr)
      UNTIL cntr = gShipTypes or cntr > gShipTypes
      cntr = 0
      write #1, gWeaponTypes
      DO
            INC(cntr)
            WRITE #1,WeaponInfo(cntr)
      UNTIL cntr = gWeaponTypes or cntr > gWeaponTypes
   END IF
   CLOSE #1
END IF

*More is coming, this is just all I have completed of the scenario editor so 
far... I am working on objects and a few other options like scenario size.

So... what should I do with this?  Somehow I think that storing it in STR 
wouldn't work too well ;).


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com