DECLARE SUB getField (member AS STRING) TYPE config continues AS INTEGER ' offset: 0, length: 2 login AS STRING * 8 ' offset: 2, length: 8 sndfx AS INTEGER ' offset: 10, length: 2 music AS INTEGER ' offset: 12, length: 2 END TYPE CONST handleSTRING = 1 ' this is a string CONST handleINTEGER = 2 ' this is an integer CONST handleTOGGLE = 3 ' this is a toggle DIM SHARED cfg AS config ' settings for the whole program cfg.continues = 3 ' default number of continues cfg.login = "username" ' player name cfg.sndfx = 1 ' allow sound effects cfg.music = 9 ' sound card index to use ' display the content of "cfg.continues" getField "continues" getField "login" getField "sound" getField "music" SUB getField (member AS STRING) DIM fldOffset AS INTEGER, fldLength AS INTEGER, fldHandle AS INTEGER, fldCopy AS STRING ' find matching variable SELECT CASE member CASE "continues" fldOffset = 0: fldLength = len(cfg.continues): fldHandle = handleINTEGER CASE "login" fldOffset = 2: fldLength = len(cfg.login): fldHandle = handleSTRING CASE "sound" fldOffset = 10: fldLength = len(cfg.sndfx): fldHandle = handleTOGGLE CASE "music" fldOffset = 12: fldLength = len(cfg.music): fldHandle = handleINTEGER END SELECT ' copy bytes to temporary buffer DEF SEG = VARSEG(cfg) FOR i% = 0 TO fldLength - 1 fldCopy = fldCopy + CHR$(PEEK(VARPTR(cfg) + i% + fldOffset)) NEXT i% DEF SEG ' convert buffer to readable stuff PRINT member + ": "; SELECT CASE fldHandle CASE handleINTEGER PRINT CVI(fldCopy) CASE handleSTRING PRINT fldCopy CASE handleTOGGLE PRINT MID$("On Off", 1 + ((VAL(fldCopy) MOD 2) * 3), 3) END SELECT END SUB