 Rem Makecnfg program for Dndbbs Version v5.0a Release r2.0

 Rem $Include: 'dndcnfg.inc'

 ' declare error routine
 On Error Goto Error.Routine

 Function DateS$
  DateS$=Format$(Now,"mm-dd-yyyy")
 End Function

' checks keyboard buffer
FUNCTION KeyIS
 InregsX.AX = &H0100
 CALL InterruptX(&H16, InregsX, OutregsX)
 IF (OutregsX.Flags AND &H40) = &H40 THEN
    KeyIS = False
 ELSE
    KeyIS = True
 END IF
 CALL Release.Time(1)
END FUNCTION

' reads character directly from keyboard including extended keys.
FUNCTION KeyboardChar$
 InregsX.AX = &H0000
 CALL InterruptX(&H16, InregsX, OutregsX)
 Key1 = (OutregsX.AX AND &HFF)
 IF Key1 = False THEN ' extended key
    Key2 = (OutregsX.AX AND &HFF00) / 256
    KeyboardChar$ = CHR$(0) + CHR$(Key2)
 ELSE
    KeyboardChar$ = CHR$(Key1)
 END IF
 CALL Release.Time(1)
END FUNCTION

' uses direct keyboard input to get an input line during redirected input.
FUNCTION KeyboardLine$
 Var$ = Nul
 DO
    LOCATE ,,1
    IF KeyIS THEN ' check keyboard
       Var2$ = KeyboardChar$ ' get character
       SELECT CASE Var2$
       CASE CHR$(13) ' return
          EXIT DO
       CASE CHR$(27) ' escape
          FOR V% = LEN(Var$) TO 1 STEP -1
             IF POS(0) > 1 THEN ' check cursor location
                LOCATE CSRLIN, POS(0) - 1, 0
                PRINT " ";
                LOCATE CSRLIN, POS(0) - 1, 1
             ELSE ' line-wrap
                LOCATE CSRLIN - 1, 80, 0
                PRINT " ";
                LOCATE CSRLIN - 1, 80, 1
             END IF
          NEXT   
          Var$ = Nul
       CASE CHR$(8) ' backspace
          IF LEN(Var$) > 0 THEN
             Var$ = LEFT$(Var$, LEN(Var$) - 1)
             IF POS(0) > 1 THEN ' check cursor location
                LOCATE CSRLIN, POS(0) - 1, 0
                PRINT " ";
                LOCATE CSRLIN, POS(0) - 1, 1
             ELSE ' line-wrap
                LOCATE CSRLIN - 1, 80, 0
                PRINT " ";
                LOCATE CSRLIN - 1, 80, 1
             END IF
          END IF
       CASE ELSE ' store input
          PRINT Var2$;
          LOCATE ,,1
          Var$ = Var$ + Var2$
       END SELECT
    END IF

    ' release time slice for tight loop
    CALL Release.Time(1)
 LOOP

 ' return input line
 KeyboardLine$ = Var$
END FUNCTION

 ' declare arrays
 Redim Alignment.Name1(1 To 3) As String*7, _
 Alignment.Name2(1 to 3) As String*7,_
 Attack.Command(1 To MaxUserCommands) As Integer,_
 Class.Name(1 To 10) As String*15,_
 Command.Abbr(1 To MaxUserCommands) As String*2,_
 Command.Class(1 To MaxUserCommands, 1 To 8) As Integer,_
 Command.Param(1 To MaxUserCommands) As Integer,_
 Command.Set(1 To MaxUserCommands, 1 To 3) As String*12,_
 Command.Limit(1 To MaxUserCommands) As Integer,_
 Command.Time(1 To MaxUserCommands, 1 To 4) As Integer,_
 Config.Array1(1 To MaxConfigArray1) As Single,_
 Config.Array2(1 To MaxConfigArray2) As Integer,_
 Config.Array3(1 To MaxConfigArray3) As String,_
 Direction(1 To 12) As String*9,_
 DMCommands(1 To MaxDMcommands) As String*10,_
 DMCommand.Param(1 To MaxDMcommands) As Integer,_
 DM.Command.Class(1 To MaxDMcommands,1 To 3) As Integer,_
 Edit.Data(1 To 13) As String,_
 High.Class.Name(1 To 10) As String*15,_
 InventoryNames(1 To 10) As String*8,_
 Letter.Command(1 To 26) As Integer,_
 Menu1(1 To 10) As String*25,_
 Menu2(1 To 10, 1 To 2) As Integer,_
 Modem.Allow(1 To MaxModemBauds) As Integer,_
 Modem.Connect(1 To MaxModemBauds) As Single,_
 Modem.String(1 To MaxModemBauds) As String*20,_
 Node.Commands(1 To MaxNodeCommands) As String*10,_
 Node.Command.Class(1 To MaxNodeCommands,1 To 10) As Integer,_
 Node.Work.Array1(1 To MaxNodes) As String*80,_
 Node.Work.Array2(1 To MaxNodes) As Integer,_
 Numeral(1 To 10) As String*5,_
 Race(1 To 8) As String*8,_
 Room.Array(1 To 20) As String*40,_
 Stat(1 To 7) As String*12,_
 Strip.Data(1 To 50) As String*5,_
 Sysop.Commands(1 To MaxSysopCommands) As String*10,_
 Sysop.Command.Class(1 To MaxSysopCommands) As Integer,_
 Temp.ArrayS(1 To 10) As String,_
 Temp.Array1(1 To 10) As Integer,_
 Temp.Array2(1 To 10) As Integer,_
 Training.Stats(1 To 10,1 To 4) As Integer,_
 Weapon.Type.Name(1 To 4) As String*9

 ' declare variables
 Debug.Mode=False
 Edit.Auto=False
 Make.Sysop=False
 Config.Node$=Nul
 Temp.Drive$=Nul

 ' read command line
 Command.Line$=Command$
 Select Case Command.Line$
 Case "?", "/?", "/H", "/HELP"
    Goto Boot.Usage
 End Select
 ' parse command line
 Imbedded=Instr(Command.Line$," ")
 While Imbedded
    Command.Line$=Left$(Command.Line$,Imbedded-1)+Mid$(Command.Line$,Imbedded+1)
    Imbedded=Instr(Command.Line$," ")
 Wend
 Imbedded=Instr(Command.Line$,"/X")
 If Imbedded Then
    Edit.Auto=True
    Command.Line$=Left$(Command.Line$,Imbedded-1)+Mid$(Command.Line$,Imbedded+2)
 Endif
 Imbedded=Instr(Command.Line$,"/Y")
 If Imbedded Then
    Make.Sysop=True
    Command.Line$=Left$(Command.Line$,Imbedded-1)+Mid$(Command.Line$,Imbedded+2)
 Endif
 Imbedded=Instr(Command.Line$,"/Z")
 If Imbedded Then
    Debug.Mode=True
    Command.Line$=Left$(Command.Line$,Imbedded-1)+Mid$(Command.Line$,Imbedded+2)
 Endif
 ' get dndbbs path
 DND.Path=Environ$("DNDBBS")
 If DND.Path<>Nul Then
    If Right$(DND.Path,1)<>"\" Then
       DND.Path=DND.Path+"\"
    Endif
 Endif
 If Debug.Mode=False Then
    Color 15,0
    Print "Makecnfg v"+Version$
 Endif
 If Debug.Mode=False Then
    Call Passwrd7(Var)
    If Var=False Then
       End
    Endif
 Endif
 ' check to over-ride specific drive letter
 Temp.Drive$=Nul
 Imbedded=Instr(Command.Line$,"/D:")
 If Imbedded Then
    Temp.Drive$=Mid$(Command.Line$,Imbedded+3,1)
    If Temp.Drive$>="A" And Temp.Drive$<="Z" Then
       Command.Line$=Left$(Command.Line$,Imbedded-1)+Mid$(Command.Line$,Imbedded+4)
    Else
       Temp.Drive$=Left$(Curdir$,1)
       Command.Line$=Left$(Command.Line$,Imbedded-1)+Mid$(Command.Line$,Imbedded+3)
    Endif
 Endif
 ' check to over-ride specific node number
 TempA$=Nul
 Var1=Instr(Ucase$(Command.Line$),"/N:")
 If Var1 Then
    VarQ$=Mid$(Command.Line$,Var1+3)
    Select Case Len(VarQ$)
    Case 0
       TempA$="<none>"
       Command.Line$=Left$(Command.Line$,Var1-1)+Mid$(Command.Line$,Var1+3)
    Case 1
       Select Case Ucase$(VarQ$)
       Case "0" To "9"
          TempA$=VarQ$
          Command.Line$=Left$(Command.Line$,Var1-1)+Mid$(Command.Line$,Var1+4)
       Case "A" To "Z"
          TempA$=VarQ$
          Command.Line$=Left$(Command.Line$,Var1-1)+Mid$(Command.Line$,Var1+4)
       Case Else
          Color 15,0
          Print "Bad node. Type 'Makecnfg /?' for usage."
          Color 7,0
          End
       End Select
    Case 2
       Select Case Int(Val(VarQ$))
       Case 10 To 99
          TempA$=VarQ$
          Command.Line$=Left$(Command.Line$,Var1-1)+Mid$(Command.Line$,Var1+5)
       Case Else
          Color 15,0
          Print "Bad node. Type 'Makecnfg /?' for usage."
          Color 7,0
          End
       End Select
    End Select
 Endif
 ' check remaining command line
 If Command.Line$<>Nul Then
    Color 15,0
    Print "Bad command line. Type 'Makecnfg /?' for usage."
    Color 7,0
    End
 Endif
 ' check existing node
 If TempA$=Nul Then
    Color 14,0
    Print "Enter node number(<enter>,0-9,A-Z,10-99)?";
    TempA$ = KeyboardLine$
    Print
 Endif
 ' verify node
 If TempA$="<none>" Then
    TempA$=Nul
 Endif
 Config.Node$=Nul
 If Len(TempA$) Then
    TempA$=Ucase$(TempA$)
    Select Case Len(TempA$)
    Case 0
       Eat$ = Nul
    Case 1
       Select Case TempA$
       Case "0" To "9"
          Config.Node$=TempA$
       Case "A" To "Z"
          Config.Node$=TempA$
       Case Else
          Color 15,0
          Print "Bad node. Type 'Makecnfg /?' for usage."
          Color 7,0
          End
       End Select
    Case 2
       VarX=Int(Val(TempA$))
       If VarX>=10 And VarX<=99 Then
          Config.Node$=Mid$(Str$(VarX),2)
       Else
          Color 15,0
          Print "Bad node. Type 'Makecnfg /?' for usage."
          Color 7,0
          End
       Endif
    Case Else
       Color 15,0
       Print "Bad node. Type 'Makecnfg /?' for usage."
       Color 7,0
       End
    End Select
 Endif
 ' check existing drive
 If Temp.Drive$=Nul Then
    Color 14, 0
    Print "Enter drive letter of RAM disk(A-Z,<enter> for default)?";
    Var$ = KeyboardLine$
    Print
    If Var$ = Nul Then
       Temp.Drive$=Left$(Curdir$,1)
    Else
       Temp.Drive$ = Ucase$(Var$)
    Endif
 Endif
 ' verify drive
 IF Len(Temp.Drive$) = 1 THEN
    If Temp.Drive$>="A" And Temp.Drive$<="Z" Then
       Temp.Drive$=Temp.Drive$+":\"
    Else
       Color 15,0
       Print "Bad drive. Type 'Makecnfg /?' for usage."
       Color 7,0
       End
    Endif
 ELSE
    Color 15,0
    Print "Bad drive. Type 'Makecnfg /?' for usage."
    Color 7,0
    End
 Endif

 ' read config data
 Restore Default.Data
 For Temp1=1 To 10
    For Temp2=1 To 4
       Read Training.Stats(Temp1,Temp2)
    Next
 Next
 For Temp=1 To 20
    Read Room.Array(Temp)
 Next
 For Temp=1 To MaxConfigArray1
    Read Config.Array1(Temp)
 Next
 For Temp=1 To MaxConfigArray2
    Read Config.Array2(Temp)
 Next
 For Temp=1 To MaxConfigArray3
    Read Config.Array3(Temp)
 Next
 For Temp=1 To 10
    Read High.Class.Name(Temp)
 Next
 For Temp=1 To 8
    Read Race(Temp)
 Next
 For Temp=1 To 10
    Read Class.Name(Temp)
 Next
 For Temp=1 To 7
    Read Stat(Temp)
 Next
 For Temp=1 To 12
    Read Direction(Temp)
 Next
 For Temp=1 To 10
    Read Numeral(Temp)
 Next
 For Temp=1 To 4
    Read Weapon.Type.Name(Temp)
 Next
 For Temp=1 To 3
    Read Alignment.Name1(Temp)
 Next
 For Temp=1 To 3
    Read Alignment.Name2(Temp)
 Next
 For Temp=1 To 50
    Read Strip.Data(Temp)
 Next
 For Temp1=1 To MaxUserCommands
    Read Command.Abbr(Temp1)
    For Temp2=1 To 3
       Read Command.Set(Temp1,Temp2)
    Next
    Read Command.Param(Temp1)
    For Temp2=1 To 8
       Read Command.Class(Temp1,Temp2)
    Next
    For Temp2=1 To 4
       Read Command.Time(Temp1,Temp2)
    Next
    Read Command.Limit(Temp1)
    Read Attack.Command(Temp1)
 Next
 For Temp=1 To MaxDMCommands
    Read DMCommands(Temp)
    Read DMCommand.Param(Temp)
    For Temp2=1 To 3
       Read DM.Command.Class(Temp,Temp2)
    Next
 Next
 For Temp=1 To MaxSysopCommands
    Read Sysop.Commands(Temp)
    Read Sysop.Command.Class(Temp)
 Next
 For Temp=1 To MaxNodeCommands
    Read Node.Commands(Temp)
    For Temp2=1 To 8
       Node.Command.Class(Temp,Temp2)=False
    Next
 Next
 For Temp=1 To 26
    Read Letter.Command(Temp)
 Next
 For Temp=1 To 10
    Read Temp.ArrayS(Temp)
    Read Temp.Array1(Temp)
    Read Temp.Array2(Temp)
 Next
 For Temp1=1 To 10
    Read InventoryNames(Temp1)
 Next
 For Temp1=1 To 30
    Read Modem.Connect(Temp1)
    Read Modem.String(Temp1)
 Next
 For Temp1=1 To 30
    Modem.Allow(Temp1)=True
 Next

 ' get environment variable strings
 Var3$=Nul
 Color 12,0
 Print "Enter Dnddat variable:"
 Color 14,0
 Strng2=Environ$("DNDDAT")
 If Strng2<>Nul Then
    Var3$=Strng2
 Else
    Var3$=Curdir$
    If Right$(Var3$,1)="\" Then
       Var3$=Left$(Var3$,Len(Var3$)-1)
    Endif
    Var4$=Var3$+"\DNDDAT\*.*"
    If Dir$(Var4$)<>"" Then
       Var3$=Var3$+"\DNDDAT"
    Endif
 Endif
 If Right$(Var3$,1)<>"\" Then
    Var3$=Var3$+"\"
 Endif
 Color 15,0
 Print "Default: DNDDAT="+Var3$
 Color 14,0
 Print "Press <enter> to use, or specify pathname:";
 Var$ = KeyboardLine$
 Print
 If Var$=Nul Then
    Config.Array3(11)=Ucase$(Var3$)
 Else
    If Right$(Var$,1)<>"\" Then
       Var$=Var$+"\"
    Endif
    Config.Array3(11)=Ucase$(Var$)
 Endif

 Var3$=Nul
 Color 12,0
 Print "Enter Dnddoc variable:"
 Color 14,0
 Strng2=Environ$("DNDDOC")
 If Strng2<>Nul Then
    Var3$=Strng2
 Else
    Var3$=Curdir$
    If Right$(Var3$,1)="\" Then
       Var3$=Left$(Var3$,Len(Var3$)-1)
    Endif
    Var4$=Var3$+"\DNDDOC\*.*"
    If Dir$(Var4$)<>"" Then
       Var3$=Var3$+"\DNDDOC"
    Endif
 Endif
 If Right$(Var3$,1)<>"\" Then
    Var3$=Var3$+"\"
 Endif
 Color 15,0
 Print "Default: DNDDOC="+Var3$
 Color 14,0
 Print "Press <enter> to use, or specify pathname:";
 Var$ = KeyboardLine$
 Print
 If Var$=Nul Then
    Config.Array3(52)=Ucase$(Var3$)
 Else
    If Right$(Var$,1)<>"\" Then
       Var$=Var$+"\"
    Endif
    Config.Array3(52)=Ucase$(Var$)
 Endif

 Var3$=Nul
 Color 12,0
 Print "Enter Dndmess variable:"
 Color 14,0
 Strng2=Environ$("DNDMESS")
 If Strng2<>Nul Then
    Var3$=Strng2
 Else
    Var3$=Curdir$
    If Right$(Var3$,1)="\" Then
       Var3$=Left$(Var3$,Len(Var3$)-1)
    Endif
    Var4$=Var3$+"\DNDMESS\*.*"
    If Dir$(Var4$)<>"" Then
       Var3$=Var3$+"\DNDMESS"
    Endif
 Endif
 If Right$(Var3$,1)<>"\" Then
    Var3$=Var3$+"\"
 Endif
 Color 15,0
 Print "Default: DNDMESS="+Var3$
 Color 14,0
 Print "Press <enter> to use, or specify pathname:";
 Var$ = KeyboardLine$
 Print
 If Var$=Nul Then
    Config.Array3(54)=Ucase$(Var3$)
 Else
    If Right$(Var$,1)<>"\" Then
       Var$=Var$+"\"
    Endif
    Config.Array3(54)=Ucase$(Var$)
 Endif

 Var3$=Nul
 Color 12,0
 Print "Enter Dndtemp variable:"
 Color 14,0
 Strng2=Environ$("DNDTEMP")
 If Strng2<>Nul Then
    Var3$=Strng2
 Else
    If Len(Temp.Drive$) Then
       Var3$=Temp.Drive$
    Else
       Var3$=Curdir$
       If Right$(Var3$,1)="\" Then
          Var3$=Left$(Var3$,Len(Var3$)-1)
       Endif
       Var4$=Var3$+"\DNDTEMP\*.*"
       If Dir$(Var4$)<>"" Then
          Var3$=Var3$+"\DNDTEMP"
       Endif
    Endif
 Endif
 If Right$(Var3$,1)<>"\" Then
    Var3$=Var3$+"\"
 Endif
 Color 15,0
 Print "Default: DNDTEMP="+Var3$
 Color 14,0
 Print "Press <enter> to use, or specify pathname:";
 Var$ = KeyboardLine$
 Print
 If Var$=Nul Then
    Config.Array3(53)=Ucase$(Var3$)
 Else
    If Right$(Var$,1)<>"\" Then
       Var$=Var$+"\"
    Endif
    Config.Array3(53)=Ucase$(Var$)
 Endif

 Color 12,0
 Print "Variables loaded:"
 Color 14,0
 Print "Press <enter> to write files, or Q to quit:";
 Var$ = KeyboardLine$
 Print
 If Ucase$(Var$) = "Q" Then
    Color 15,0
    Print "Makecnfg terminated abruptly."
    Print "Returning to system."
    Color 7,0
    End
 Endif
 ' write .cfg file
 Filename=DND.Path+"DND"+Config.Node$+".CFG"
 Close #TempFile1
 Open Filename For Output Shared As #TempFile1
 Print #TempFile1,Config.Array3(53)
 For Temp=1 To MaxConfigArray1
    Print #TempFile1,Ltrim$(Str$(Config.Array1(Temp)))
 Next
 For Temp=1 To MaxConfigArray2
    Print #TempFile1,Ltrim$(Str$(Config.Array2(Temp)))
 Next
 For Temp=1 To MaxConfigArray3
    Print #TempFile1,Config.Array3(Temp)
 Next
 For Temp1=1 To 10
    For Temp2=1 To 4
       Print #TempFile1,Ltrim$(Str$(Training.Stats(Temp1,Temp2)))
    Next
 Next
 For Temp=1 To 20
    Print #TempFile1,Rtrim$(Room.Array(Temp))
 Next
 For Temp=1 To 10
    Print #TempFile1,Rtrim$(High.Class.Name(Temp))
 Next
 For Temp=1 To 8
    Print #TempFile1,Rtrim$(Race(Temp))
 Next
 For Temp=1 To 10
    Print #TempFile1,Rtrim$(Class.Name(Temp))
 Next
 For Temp=1 To 7
    Print #TempFile1,Rtrim$(Stat(Temp))
 Next
 For Temp=1 To 12
    Print #TempFile1,Rtrim$(Direction(Temp))
 Next
 For Temp=1 To 10
    Print #TempFile1,Rtrim$(Numeral(Temp))
 Next
 For Temp=1 To 4
    Print #TempFile1,Rtrim$(Weapon.Type.Name(Temp))
 Next
 For Temp=1 To 3
    Print #TempFile1,Rtrim$(Alignment.Name1(Temp))
 Next
 For Temp=1 To 3
    Print #TempFile1,Rtrim$(Alignment.Name2(Temp))
 Next
 For Temp1=1 To MaxUserCommands
    Print #TempFile1,Command.Abbr(Temp1)
    For Temp2=1 To 3
       Print #TempFile1,Rtrim$(Command.Set(Temp1,Temp2))
    Next
    Print #TempFile1,Ltrim$(Str$(Command.Param(Temp1)))
    For Temp2=1 To 8
       Print #TempFile1,Ltrim$(Str$(Command.Class(Temp1,Temp2)))
    Next
    For Temp2=1 To 4
       Print #TempFile1,Ltrim$(Str$(Command.Time(Temp1,Temp2)))
    Next
    Print #TempFile1,Ltrim$(Str$(Command.Limit(Temp1)))
    Print #TempFile1,Ltrim$(Str$(Attack.Command(Temp1)))
 Next
 For Temp=1 To MaxDMCommands
    Print #TempFile1,Rtrim$(DMCommands(Temp))
    Print #TempFile1,Ltrim$(Str$(DMCommand.Param(Temp)))
    For Temp2=1 To 3
       Print #TempFile1,Ltrim$(Str$(DM.Command.Class(Temp,Temp2)))
    Next
 Next
 For Temp=1 To MaxSysopCommands
    Print #TempFile1,Rtrim$(Sysop.Commands(Temp))
    Print #TempFile1,Ltrim$(Str$(Sysop.Command.Class(Temp)))
 Next
 For Temp=1 To MaxNodeCommands
    Print #TempFile1,Rtrim$(Node.Commands(Temp))
    For Temp2=1 To 8
       Print #TempFile1,Ltrim$(Str$(Node.Command.Class(Temp,Temp2)))
    Next
 Next
 For Temp=1 To 26
    Print #TempFile1,Ltrim$(Str$(Letter.Command(Temp)))
 Next
 For Temp=1 To 50
    Print #TempFile1,Rtrim$(Strip.Data(Temp))
 Next
 For Temp=1 To 10
    Print #TempFile1,Rtrim$(Temp.ArrayS(Temp))
    Print #TempFile1,Ltrim$(Str$(Temp.Array1(Temp)))
    Print #TempFile1,Ltrim$(Str$(Temp.Array2(Temp)))
 Next
 For Temp1=1 To 10
    Print #TempFile1,InventoryNames(Temp1)
 Next
 For Temp1=1 To MaxModemBauds
    Print #TempFile1,Modem.Connect(Temp1)
    Print #TempFile1,Modem.String(Temp1)
    Print #TempFile1,Modem.Allow(Temp1)
 Next
 Filename=Lcase$(Filename)
 Mid$(Filename,1,1)=Ucase$(Mid$(Filename,1,1))
 If Debug.Mode=False Then
    Color 14,0
    Print Filename+" written to disk."
 Endif
 ' store drive letter and pathnames
 If Len(DND.Path) Then
    Current.Drive$=Left$(DND.Path,1)
 Else
    Current.Drive$=Left$(Curdir$,1)
 Endif
 If DND.Path=Nul Then
    New.Path$=Curdir$
 Else
    New.Path$=Left$(DND.Path,Len(DND.Path)-1)
 Endif
 If Len(Temp.Drive$) Then
    Ram.Drive$=Left$(Temp.Drive$,1)
 Else
    Ram.Drive$=Left$(Curdir$,1)
 Endif
 ' write autoexec.bat file
 If Edit.Auto=False Then
    Goto End.Copy2
 Endif
 Close
 Filename="C:\AUTOEXEC.BAT"
 If Dir$(Filename)=Nul Then
    ' create autoexec.bat
    Open Filename For Output Shared As TempFile1
    Print #TempFile1, "PATH=";New.Path$
    Print #TempFile1, "SET DNDBBS="+New.Path$+"\"
    Print #TempFile1, "SET DNDDAT="+New.Path$+"\DNDDAT\"
    Print #TempFile1, "SET DNDDOC="+New.Path$+"\DNDDOC\"
    Print #TempFile1, "SET DNDMESS="+New.Path$+"\DNDMESS\"
    Print #TempFile1, "SET DNDTEMP="+Ram.Drive$+":\"
    Goto End.Copy
 Endif
 ' backup autoexec.bat
 Var$="C:\AUTOEXEC.BKP"
 If Dir$(Var$)="AUTOEXEC.BKP" Then
    Kill Var$
 Endif
 Name Filename As Var$
 ' edit autoexec.bat
 Close
 Open Var$ For Input Shared As #TempFile1
 Open Filename For Output Shared As #TempFile2
 While Not Eof(TempFile1)
    Line Input #TempFile1,Autoexec.Line$
    Temp.Line$=Ucase$(Autoexec.Line$)
    Temp.Line$=Ltrim$(Temp.Line$)
    If Left$(Temp.Line$,5)="PATH " Or _
    Left$(Temp.Line$,5)="PATH=" Or _
    Left$(Temp.Line$,9)="SET PATH=" Then
       If Instr(Temp.Line$,New.Path$)=False Then
          If Right$(Autoexec.Line$,1)<>";" Then
             Autoexec.Line$=Autoexec.Line$+";"
          Endif
          Autoexec.Line$=Autoexec.Line$+New.Path$
          If Len(Autoexec.Line$)>127 Then
             If Debug.Mode=False Then
                Print "Path= statement in Autoexec.bat exceeds 127 characters."
             Endif
          Endif
       Endif
    Endif
    Write.Line=True
    If Left$(Temp.Line$,11)="SET DNDBBS=" Or _
    Left$(Temp.Line$,11)="SET DNDDAT=" Or _
    Left$(Temp.Line$,11)="SET DNDDOC=" Or _
    Left$(Temp.Line$,12)="SET DNDMESS=" Or _
    Left$(Temp.Line$,12)="SET DNDTEMP=" Then
       Write.Line=False
    Endif
    If Write.Line Then
       Print #TempFile2,Autoexec.Line$
    Endif
 Wend
 Print #TempFile2, "SET DNDBBS="+New.Path$+"\"
 Print #TempFile2, "SET DNDDAT="+New.Path$+"\DNDDAT\"
 Print #TempFile2, "SET DNDDOC="+New.Path$+"\DNDDOC\"
 Print #TempFile2, "SET DNDMESS="+New.Path$+"\DNDMESS\"
 Print #TempFile2, "SET DNDTEMP="+Ram.Drive$+":\"
End.Copy:
 Filename=Lcase$(Filename)
 Mid$(Filename,1,1)=Ucase$(Mid$(Filename,1,1))
 If Debug.Mode=False Then
    Color 14,0
    Print Filename+" written to disk."
 Endif
End.Copy2:
 ' write user.dat file
 If Make.Sysop=False Then
    Goto End.Copy3
 Endif
 Call Get.Config(Config.Node$)
 Close
 If Dir$(User.Filename)<>Nul Then
    Kill User.Filename
 Endif
 If Dir$(UserInv.Filename)<>Nul Then
    Kill UserInv.Filename
 Endif
 Close
 Open Container.Filename For Random Shared As #TempFile1 Len=Len(ContainerRecord)
 For Temp!=1 To Lof(Tempfile1)/Len(ContainerRecord)
    Get Tempfile1,Temp!,ContainerRecord
    If ContainerRecord.WithinContainer=SFalse Then
       If ContainerRecord.UserNumber<>SFalse Then
          ContainerRecord.UserNumber=SFalse
          Put Tempfile1,Temp!,ContainerRecord
       Endif
    Endif
 Next
 Close
 Open User.Filename For Random Shared As #TempFile1 Len=Len(UserRecord)
 Strng="SYSOP"+Space$(25)
 UserRecord.CodeName=Strng
 Strng=Space$(20)
 For Temp=1 To 20
    Mid$(Strng,Temp,1)=Chr$(Int(Rnd*31+1))
 Next
 Var$=Strng
 Call Cryptograph(Var$)
 UserRecord.PassWord=Var$
 Call Crypto(Strng)
 UserRecord.PassWord3=Strng
 UserRecord.ClassName="Sysop"
 UserRecord.ClassType=10
 For Temp6=1 To MaxStats
    UserRecord.Stats(Temp6)=250
 Next
 UserRecord.Beauty=250
 UserRecord.Glamour=250
 For Temp6=1 To MaxWeapons
    UserRecord.Weapons(Temp6)=100
 Next
 For Var=1 To MaxItems
    UserRecord.Weapon(Var).Index=SFalse
    UserRecord.Weapon(Var).Charges=False
    UserRecord.Weapon(Var).Plus=False
 Next
 UserRecord.Room=1!
 UserRecord.Level=100
 UserRecord.Experience=DFalse
 UserRecord.Gold=DFalse
 UserRecord.Borrow=False
 UserRecord.NumCalls=False
 UserRecord.Fatigue=32000
 UserRecord.FatigueMax=32000
 UserRecord.Vitality=32000
 UserRecord.VitalityMax=32000
 UserRecord.Magic=32000
 UserRecord.MagicMax=32000
 UserRecord.Psionic=32000
 UserRecord.PsionicMax=32000
 UserRecord.Poison=False
 UserRecord.Invisible=True
 UserRecord.Race=1
 UserRecord.Proficiency=1
 UserRecord.Bank=False
 UserRecord.PlayersKilled=False
 UserRecord.MonstersKilled=False
 UserRecord.Brief=False
 UserRecord.DateOn=DateS$
 UserRecord.Align1=False
 UserRecord.Align2=False
 UserRecord.Flags=False
 UserRecord.Flags2=False
 UserRecord.WishsLeft=3
 UserRecord.MaxCalls=True
 UserRecord.FromHour=False
 UserRecord.FromMin=False
 UserRecord.ToHour=False
 UserRecord.ToMin=False
 UserRecord.SortInv=False
 UserRecord.TimeLimit=SFalse
 UserRecord.TimeUsed=SFalse
 UserRecord.Encumbrance=True
 UserRecord.DateOn=DateS$
 UserRecord.PassWord2=Nul
 UserRecord.Question=Nul
 UserRecord.Answer=Nul
 UserRecord.Prefix1=Nul
 UserRecord.Prefix2=Nul
 UserRecord.TimesLogon=0#
 UserRecord.TimesDied=0#
 UserRecord.First=SFalse
 UserRecord.Last=SFalse
 UserRecord.First2=SFalse
 UserRecord.Last2=SFalse
 UserRecord.NodeList=String$(127,"1")
 UserRecord.NodeList2=0!
 UserRecord.EditList=0!
 UserRecord.StatusVar=0
 UserRecord.Prefix3=Nul
 For VarZ=1 To 8
    UserRecord.ShortcutKey1(VarZ)=Nul
    UserRecord.ShortcutKey2(VarZ)=Nul
 Next
 For VarZ=1 To 10
    UserRecord.FunctionKeys(VarZ)=Nul
 Next
 UserRecord.ActionLineString = Nul
 UserRecord.StatusLineString = Nul
 Put TempFile1,1,UserRecord
 ' display filename written
 If Debug.Mode=False Then
    Color 14,0
    Print TempX$+" written to disk."
 Endif
 ' reset accounts file
 Close
 Open "ACCOUNTS.SIC" For Random Shared As #TempFile1 Len=Len(UserProfile)
 IF Lof(TempFile1) > SFalse Then
    For Var! = 1! To Lof(TempFile1)/Len(UserProfile)
       Get #TempFile1,Var!,UserProfile
       Strng=Space$(8)
       For Temp=1 To 8
          Mid$(Strng,Temp,1)=Chr$(Int(Rnd*31+1))
       Next
       Var$=Strng
       Call Cryptograph(Var$)
       UserProfile.Password=Var$
       Put #TempFile1,Var!,UserProfile
    Next
 Endif
 ' reset usage file
 Close
 Open Usage.FileName For Random Shared As #TempFile1 Len=26
 Field #TempFile1,26 As S$
 Lset S$="DND Usage File v"+Version$+Chr$(13)+Chr$(10)+Chr$(26)
 Put #TempFile1,1
 Field #TempFile1,10 As D$, 8 As T$, 8 As X$
 Lset D$=DateS$
 Lset T$=Format$(Now,"hh:mm:ss")
 Lset X$=Mkd$(0#)
 Put #TempFile1,2
 Lset D$="01-01-1980"
 Lset T$=Format$(Now,"hh:mm:ss")
 Lset X$=Mkd$(0#)
 Put #TempFile1,3
End.Copy3:
 If Debug.Mode=False Then
    Color 15,0
    Print "Makecnfg terminated normally."
    Print "Returning to system."
 Endif
 Color 7,0
 End

Boot.Usage:
 Color 15,0
 Print "Makecnfg v"+Version$
 Color 14,0
 Print "Usage:"
 Print "   Makecnfg [/n:x][/d:x][/x][/y][/z]"
 Print "Where:"
 Print "   /n:x  x is node from 0-9,A-Z,10-99."
 Print "   /d:x  x is ram drive letter, or none for default drive."
 Print "     (if either switch is omitted, makecnfg will prompt for them.)"
 Print "   /x   edit autoexec.bat file."
 Print "   /y   create sysop user file."
 Print "   /z   suppress output messages."
 Color 7,0
 End

Error.Routine:
 Color 15,0
 Error.Number=Err
 Select Case Error.Number
 Case 53
    Print "File not found."
 Case 57
    Print "Device I/O error."
 Case 61
    Print "Disk full."
 Case 62
    Print "Input past eof."
 Case 67
    Print "Not enough file handles."
 Case 68
    Print "Device unavailable."
 Case 70
    Print "Permission denied."
 Case 71
    Print "Disk not ready."
 Case Else
    Print "Error";Error.Number;"writing configure files."
 End Select
 Color 7,0
 End

Sub Get.Config(Var$)
 On Local Error Goto Config.Error
 DND.Path=Environ$("DNDBBS")
 If DND.Path<>Nul Then
    If Right$(DND.Path,1)<>"\" Then
       DND.Path=DND.Path+"\"
    Endif
 Endif
 FileName=DND.Path+"DND"+Var$+".CFG"
 Close #TempFile1
 Open FileName For Input Shared As #TempFile1
 Line Input #TempFile1,Var$
 For Temp1=1 To MaxConfigArray1
    Input #TempFile1,Var!
 Next
 For Temp1=1 To MaxConfigArray2
    Input #TempFile1,Var%
 Next
 For Temp1=1 To MaxConfigArray3
    Line Input #TempFile1,Var$
    Select Case Temp1
    Case 11
       Data.Path1=Var$
    Case 15
       File.Extension1=Var$
    Case 21
       User.FileName=Var$
    Case 51
       Usage.FileName=Var$
    Case 68
       MessWork.FileName=Var$
    Case 80
       Container.FileName=Var$
    Case 86
       UserInv.FileName=Var$
    End Select
 Next
 TempX$=User.Filename+File.Extension1
 TempX$=Lcase$(TempX$)
 Mid$(TempX$,1,1)=Ucase$(Mid$(TempX$,1,1))
 Container.FileName=Data.Path1+Container.FileName+File.Extension1
 Usage.FileName=Data.Path1+Usage.FileName+File.Extension1
 User.FileName=Data.Path1+User.FileName+File.Extension1
 UserInv.FileName=Data.Path1+UserInv.FileName+File.Extension1
 Exit Sub
Config.Error:
 Color 7,0
 Print "Error reading "+Lcase$(FileName)+" (error:"+Str$(Err)+"). Run dndcnfg."
 End
End Sub

Default.Data:

Data 12,4,6,3,9,6,10,5,10,3,5,4,9,6,5,4,11,5,6,3
Data 11,4,6,3,10,3,7,3,9,6,8,3,125,125,125,125,250,250,250,250

Data "1","2","3","4","5","6","7","8","9","10"
Data "11","12","13","14","15","16","17","18","19","20"

Data 15,30,60,12,.5,.5,.5,.5,.1,9
Data .5,.2,.2,.95,1000,.5,.5,.5,1,.25
Data .2,.2,.5,.75,.96,.91,.86,.5,.5,5
Data 10000!,10000!,0,0,0,0,0,1024!,1024!,60!

Data 3,0,-1,-1,-1,-1,-1,8,18,6
Data 10,1,0,-1,1,-1,0,-1,-1,-1
Data 3,2,1,2,25,21,10,10,10,15
Data 25,200,7,7,7,7,15,-1,0,4
Data 3,2,1,-1,0,0,180,-1,3,-1
Data 0,0,0,0,-1,180,3,-1,3,60
Data -1,10000,0,384,0,0,1,0,0,-1
Data -1,-1,-1,-1,-1,-1,-1,-1,0,-1
Data 0,2,0,6,-1,0,0,80,24,0
Data 5,6,-1,10,10,-1,0,-1,0,-1
Data 0,-1,0,0,0,0,-1,-1,-1,-1
Data 0,0,0,0,0,0,0,0,0,64
Data 1024,64,1024,-1,0,-1,0,0,-1,1024
Data 1024,0,1024,5,0,0,0,0,0,0
Data 0,0,75,5,10,0,0,0,0,0

Data "PRELOG","Remember your password!","WELCOME","NOTICE","Press <enter> to roll character, or <space> to reenter:","Press <enter> to begin the Adventure:","Command>","Next:","!","\"
Data "","MONCLASS","MONTALK","Enter (C)ontinue, (H)angup, or (R)estart:",".DAT","ROOMS","OBJECTS","MONSTERS","TREASURE","SPELLS"
Data "USERS","NONPLYRS","DNDCNFG","1","1","MAILHELP","MAILEDIT","LOGOFF","RND*10+(MHP/10-(SH+AR+BO+HE+TW+AM)/2+MW/2)*XX","(RND*STR+LVL/2)*(XX+PROF/100)-MS/2-MA/2+WE"
Data "DEX/10>RND*10+MLVL*2","RND*10+MLVL/10>DEX/2","RND*LVL+2>MLVL","DEX>RND*5+MLVL/2","RND*5+LVL>MLVL","RND*10+5>DEX*2","(FAT+VIT+MAG)*LVL+STR","LOGOFFH","ATM0E0Q0X1V1&C1&D2S0=1S2=255","ATA"
Data "ATM0H1","ATZ","(RND*INT+WIS)*(PSIA+XX)","(RND*(MHP/10)-PSID)*MPSI","(RND*10+10)+CON/2>20","PASSWORD","HELP","DNDBBS","LASTUSER","SUMMARY"
Data "DNDUSAGE","","","","EDITHELP","HELP","TEAMUSER","PUBLIC","MESSBASE","PRIVATE"
Data "LOGON",".DOC","DMHELP","HINT","CATALOG","ATD","DNDBBS.LOG","MESSWRK","ALTWRK","DOS"
Data "ACTIONS","DNDBBS.DAY","USERLOG","1,2,3,4,5,6,7,8,9,10,11,12,13,14,15","DNDTMP","DNDEDIT","Press <enter> to use character, or <space> to reroll:","/","|","CONTAINR"
Data "DSKLOG","LPT1:","0","C:\RBBS\","{","USERINV","CTNINV","TEAMINV","ROOMINV","MONINV"
Data "QBASIC.EXE","EDIT.COM","ROOMDESC","1000","20000","BANK","BADLOGIN","10.5","BANKLOG",".LOG"

Data "Lord","Wizard","Assassin","Bard","Monk","Knight","Priest","Empress","Assistant DM","Dungeon Master"
Data "Human","Elf","Gnome","Dwarf","Halfling","Half-elf","Half-orc","Ogre"
Data "Fighter","Magic User","Thief","Cleric","Paladin","Ranger","Druid","Lady","Assistant DM","Dungeon Master"
Data "Strength","Intelligence","Wisdom","Dexterity","Constitution","Piety","Charisma"
Data "north","east","south","west","northeast","southeast","southwest","northwest","up","down","in","out"
Data "one","two","three","four","five","six","seven","eight","nine","ten"
Data "blunt","pole","sharp","thrusting","good","neutral","evil","lawful","neutral","chaotic"

Data "AN","AS","AT","AWAY","BY","FROM","FOR","HE","HER","HERE"
Data "HERS","HIM","HIS","IN","INTO","IS","IT","ITS","LIKE","ME"
Data "MINE","MY","OF","ON","ONTO","OUR","OURS","OVER","SHE","THAT"
Data "THE","THEIR","THESE","THEM","THERE","THEY","THIS","THOSE","TO","UNDER"
Data "UNTO","UPON","US","WHO","WHOM","WHOSE","WITH","YOU","YOUR","YOURS"

' command data set
'  abbreviation, command, synonym 1, synonym 2, number of parameters,
'  eight class restrictions, four time restrictions, command time limit,
'  attack command type.
Data "AC","ACCEPT","TRADE","DECLINE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "AL","ALIGNMENT","ARRANGE","ADJUST",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "AN","ANSI","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "AP","APPEAL","DELIVER","REDEEM",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "AU","AUTO","LOOP","AUTOMATIC",0,0,0,0,0,0,0,0,0,0,0,0,0,360,0
Data "AV","AVATAR","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BS","BACKSTAB","HOAX","TRICK",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "BK","BANK","TRUST","FUND",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BT","BEAT","DEFEAT","OVERCOME",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "BF","BEFUDDLE","MUDDLE","ADDLE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "BG","BEGUILE","DISCOMFIT","DISCONCERT",0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,-1
Data "BE","BEMUSE","CONFUSE","CONFOUND",1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,-1
Data "BW","BEWILDER","<>","<>",1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,-1
Data "BH","BEWITCH","<>","<>",1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,-1
Data "BL","BLESS","CONSECRATE","SANCTIFY",0,-1,-1,-1,0,-1,-1,-1,-1,0,0,0,0,0,0
Data "BL","BLESS","CONSECRATE","SANCTIFY",1,-1,-1,-1,0,-1,-1,-1,-1,0,0,0,0,0,0
Data "BR","BREAK","SMASH","CRUSH",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BR","BREAK","SMASH","CRUSH",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BB","BRIBE","OFFER","<>",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BB","BRIBE","OFFER","<>",3,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BI","BRIEF","SHORT","VERBOSE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BA","BULLETINS","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BU","BUY","PURCHASE","PAY",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CZ","CASINO","PLAY","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CS","CAST","DIRECT","AIM",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CS","CAST","DIRECT","AIM",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CT","CATALOG","HELPLIST","SHORTLIST",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CH","CHARGE","RUSH","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "CM","CHARM","ALLURE","ATTRACT",0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,-1
Data "CA","CHAT","PAGE","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CI","CIRCLE","SURROUND","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "CL","CLOSE","SHUT","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CO","COMMANDS","DIRECTIONS","INSTRUCTIONS",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CN","CONFIGURE","SETTINGS","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "CR","COUNTER","NEUTRALIZE","OFFSET",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "CU","CURSE","DESECRATE","DAMN",0,-1,-1,-1,0,-1,-1,-1,-1,0,0,0,0,0,0
Data "CU","CURSE","DESECRATE","DAMN",1,-1,-1,-1,0,-1,-1,-1,-1,0,0,0,0,0,0
Data "DY","DAYFILE","PROGRAM","AGENDA",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "DL","DAYLOG","LOGFILE","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "DS","DISCHARGE","EMPTY","<>",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "DM","DISMOUNT","EXIT","LEAVE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "DG","DODGE","AVOID","ELUDE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "DK","DRINK","QUAFF","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "DX","DUPLEX","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "ET","EAT","SWALLOW","INGEST",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "EC","ECHO","RESEND","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "EP","EXPERIENCE","PRESENT","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "EX","EXIT","LEAVE","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "FE","FEINT","FAKE","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "FI","FIRE","EJECT","EXPEL",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "FX","FIX","MEND","RESTORE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "FX","FIX","MEND","RESTORE",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "FY","FLY","<>","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "FO","FOLLOW","TAIL","<>",1,-1,-1,-1,-1,0,0,-1,-1,0,0,0,0,360,0
Data "FU","FUEL","POWER","<>",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "GV","GIVE","HAND","<>",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "GO","GO","ENTER","WALK",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "GR","GRAPHICS","STATUSLINE","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "GU","GUARD","DEFEND","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "HL","HEALTH","REVEAL","DISCLOSE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HP","HELP","AID","ASSIST",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HP","HELP","AID","ASSIST",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HD","HIDE","CONCEAL","BURY",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HD","HIDE","CONCEAL","BURY",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HD","HIDE","CONCEAL","BURY",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HN","HINT","SUGGEST","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HO","HOLD","DRAW","WIELD",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "HU","HUNT","TRAIL","<>",0,-1,-1,-1,-1,0,0,-1,-1,0,0,0,0,360,0
Data "ID","IDENTIFY","RECOGNIZE","INVESTIGATE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "ID","IDENTIFY","RECOGNIZE","INVESTIGATE",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "IF","INFORMATION","NEWS","ADVICE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "IV","INVENTORY","DISPLAY","RECORD",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "KI","KILL","ATTACK","HIT",0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "KI","KILL","ATTACK","HIT",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "LT","LASTUSER","RECENT","PREVIOUS",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LA","LAUNCH","LET","LOOSE",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LR","LEARN","DISCOVER","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LY","LIGHT","<>","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LF","LINEFEEDS","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LL","LINELENGTH","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LS","LIST","TABLE","DOCUMENT",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LD","LOAD","<>","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LK","LOCK","FETTER","SHACKLE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LG","LOGIN","RELOGIN","RESTART",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LO","LOOK","READ","EXAMINE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LO","LOOK","READ","EXAMINE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LO","LOOK","READ","EXAMINE",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LE","LOSE","ESCAPE","EVADE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "LU","LUNGE","SIDESTEP","STRIKE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "ML","MAIL","LETTERS","MAILBOX",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "MI","MIX","STIR","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "MN","MOUNT","VAULT","STRADDLE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "MV","MOVE","PUSH","PULL",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "NT","NOTICE","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "OP","OPEN","ACCESS","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PA","PAGELENGTH","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PC","PANIC","MEANDER","RUN",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PL","PARLEY","ASK","TALK",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PR","PARRY","FENCE","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "PW","PASSWORD","SECURE","SECURITY",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PK","PICKLOCK","PRY","<>",1,-1,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0
Data "PO","POUR","COMBINE","<>",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PE","PRELOG","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PP","PRESS","ACTIVATE","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PS","PSIONIC","ASTRAL","ENERGIZE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PM","PUMMEL","BUFFET","THRASH",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "PU","PUNCH","POUND","OVERTHROW",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "PT","PUT","DROP","SET",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "PT","PUT","DROP","SET",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "QU","QUIT","STOP","BYE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "RC","RECHARGE","CORRECT","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "RL","RELOAD","<>","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "RP","REPAIR","REBUILD","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "RR","REROLL","ROLL","CHARACTER",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "RS","RESIST","OPPOSE","CONFLICT",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "RT","RETURN","REVERSE","RECOUP",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "RD","RIDE","TRAVEL","DRIVE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SV","SAVE","UPDATE","STORE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SH","SEARCH","FIND","SCAN",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SH","SEARCH","FIND","SCAN",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SH","SEARCH","FIND","SCAN",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SL","SELL","PAWN","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SI","SHIELD","PROTECT","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "SR","SORT","REARRANGE","ORDER",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SZ","STEAL","ROB","RIPOFF",2,-1,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0
Data "SZ","STEAL","ROB","RIPOFF",3,-1,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0
Data "SU","SUICIDE","DEATH","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SS","SWIM","<>","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SW","SWITCH","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "TA","TAKE","GET","GRAB",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "TA","TAKE","GET","GRAB",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "TM","TEAM","JOIN","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "TW","THROW","TOSS","<>",2,-1,-1,0,-1,-1,-1,-1,-1,0,0,0,0,0,0
Data "TH","THRUST","PIERCE","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "TI","TIME","DATE","CLOCK",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "TP","TOP","BEST","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "TE","TRACE","MAP","CHART",0,-1,-1,-1,-1,0,0,-1,-1,0,0,0,0,360,0
Data "TC","TRACK","PURSUE","CHASE",0,-1,-1,-1,-1,0,0,-1,-1,0,0,0,0,360,0
Data "TR","TRAIN","TEACH","INSTRUCT",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "TU","TURN","DEFLECT","AVERT",1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1
Data "UN","UNLOCK","FREE","RELEASE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "US","USE","ACTIVATE","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "US","USE","ACTIVATE","<>",2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "UR","USERS","USERLIST","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "WA","WAIT","REMAIN","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,360,0
Data "WR","WEAR","DRESS","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "WC","WELCOME","<>","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "WH","WHATIS","EQUATION","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "WS","WISH","HOPE","DREAM",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "WW","WORDWRAP","LIMIT","<>",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "WI","WRITE","SCRIBBLE","DOODLE",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "IB","IMBUE","PURIFY","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "ZA","ZAP","ZOT","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "SK","SMOKE","DRAG","PUFF",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data "BZ","BURN","IGNITE","<>",1,0,0,0,0,0,0,0,0,0,0,0,0,0,0

' DM command set, number of parameters, restrictions: guild master, governor, town mayor
Data "ABORT",0,-1,-1,0,"ABORT",1,-1,-1,0,"BROADCAST",0,0,0,0,"CALL",0,0,0,0,"CALL",1,0,0,0
Data "DISCARD",1,-1,0,0,"EDIT",0,-1,-1,0,"EDIT",1,-1,-1,0,"GET",-1,-1,0,0,"HELP",0,0,0,0
Data "HELP",1,0,0,0,"INVISIBLE",0,0,0,0,"KILL",1,-1,0,0,"LINK",0,-1,-1,0,"NOID",0,0,0,0
Data "REDUCE",1,0,0,0,"STATUS",0,0,0,0,"TELEPORT",-1,0,0,0,"ZAP",0,-1,-1,0,"ZAP",1,-1,-1,0

' sysop command set, restriction (0=not restricted, -1=restricted)
Data "CLOCK",-1,"CONFIG",0,"DEBUG",0,"DOS",-1,"EDIT",0,"MONITOR",0
Data "PROGRAM",-1,"REBOOT",-1,"SHELL",-1,"SYSED",0,"USAGE",0,"UTILITY",0
Data "TOGGLE",0,"CONTROL",0,"PASSWORD",0

' node command set
Data "AUTO","BLOCK","BRIEF","CHAT","ECHO","GROUP","NOSEND","SAY","SEND"
Data "STATUS","SENDTO","QUIT","WHISPER","WAIT","WHO","YELL"

' 26 single letter commands, 0 for direction abbreviation
' ansi,brief,casino,down,east,save,guard,hide,in,team,kill,look,mail
Data 3,21,24,0,0,118,59,63,0,132,73,85,90
' north,out,panic,quit,suicide,south,train,up,health,west,time,inf,inv
Data 0,0,97,110,127,0,139,0,60,0,135,71,72

' screen options data
Data "Auto Answer",8,10,"Command Shell",10,10
Data "DOS Command",12,10,"Edit Utility",14,10
Data "Login Sysop",16,10,"Modem Recycle",8,56
Data "Originate Call",10,56,"Reconfigure System",12,56
Data "Screen Editor",14,56,"Terminate Program",16,56

' default inventory names
Data "armor","boot","helmet","ring","shield","bracer","weapon","cloak","ring","amulet"

' connect data strings
Data 300!,"CONNECT 50"
Data 300!,"CONNECT 75"
Data 300!,"CONNECT 110"
Data 300!,"CONNECT 150"
Data 300!,"CONNECT 300"
Data 300!,"CONNECT 450"
Data 600!,"CONNECT 600"
Data 1200!,"CONNECT 1200"
Data 2400!,"CONNECT 2400"
Data 4800!,"CONNECT 4800"
Data 4800!,"CONNECT 7200"
Data 9600!,"CONNECT 9600"
Data 9600!,"CONNECT 12000"
Data 9600!,"CONNECT 14400"
Data 9600!,"CONNECT 16800"
Data 19200!,"CONNECT 19200"
Data 19200!,"CONNECT 21600"
Data 19200!,"CONNECT 24000"
Data 19200!,"CONNECT 26400"
Data 19200!,"CONNECT 28800"
Data 19200!,"CONNECT 31200"
Data 19200!,"CONNECT 33600"
Data 38400!,"CONNECT 38400"
Data 57600!,"CONNECT 57600"
Data 57600!,"CONNECT 64000"
Data 57600!,"CONNECT 78600"
Data 115200!,"CONNECT 115200"
Data 115200!,"CONNECT 230400"
Data 300!,"COMMNECT 134.5"
Data 300!,"COMMNECT 268"

Sub Release.Time(Var)
 On Local Error Goto Error.Trap6a
 If Supported.Call=False Then
    For Var1=1 To Var
       InregsX.AX=&H1680
       InregsX.BX=&H0000
       Call InterruptX(&H2F,InregsX,OutregsX)
       If (OutregsX.AX And &HFF)=&H80 Then
          Supported.Call=True
          Exit For
       Endif
    Next
 Endif
Error.Resume6a:
 Exit Sub
Error.Trap6a:
 Resume Error.Resume6a
End Sub
