FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DISK I/O

Read preferences at startup


LOCAL FN getGoing
  oldDepth = SYSTEM(_crntDepth)
  IF oldDepth <> 8 THEN FN fixColors
'snip, snip--read arrays & defaults, including default prefs
  FN startingValues 'function also called by "New" command
  prefsVol% = SYSTEM(_sysVol)
  LONG IF SYSTEM(_sysVers) > 699
    prefsVol% = FOLDER("Preferences",prefsVol%)
  END IF
  FN readPrefs
  FN initializeWindow
  quickflag = 0
  howmany = 1
  whatToDo = FINDERINFO (howmany, currentGame$, type&, gameVol%)
  SELECT
    CASE currentGame$ = "Palace Prefs"
      quickflag = 1
'snip, snip--if user by some freak of chance double-clicked prefs file
'go into application & open new document
    CASE howmany > 0
'snip, snip--read values for saved document clicked in Finder
    CASE ELSE
'else = user went straight into application--open new file
  END SELECT
  IF regName$ <> "" THEN regName$ = FN stripSpaces$(regName$)
'in my code, player name is written into prefs
  FN newRoom(newPlace) 'finally, put text & picts into window
  IF quickflag THEN FN showPrefs
'optional extra--if player went into application by clicking on prefs file
'now open prefs window
END FN

The readPrefs function goes like this (I just use a data file, change as need for resources):

LOCAL FN readPrefs
  ON ERROR FN writePrefs
  OPEN "I",2,"Palace Prefs",,prefsVol%
  READ #2,mouseNavPref,dblClickPref,autoSavePref,regPref
  READ #2,regName$;32
  CLOSE #2
  ON ERROR FN handleError
END FN

Lucy