sub Description_Load ( \ Description as string, \ byval Door_Num as integer ) ////////////////////////////////////////////////////////////////////// dim Door_Index as integer dim File_Num as integer dim Temp_Description as string ////////////////////////////////////////////////////////////////////// Description = "" if Exists ( DoorHook_Des ) then File_Num = FreeFile open DoorHook_Des for input as File_Num for Door_Index = 1 to Door_Num if EOF ( File_Num ) then exit for end if input #File_Num, Temp_Description if Door_Index = Door_Num then Description = Temp_Description end if next Door_Index close ( File_Num ) end if end sub sub Description_Save ( \ byval Description as string, \ byval Door_Num as integer ) ////////////////////////////////////////////////////////////////////// File_Text_Replace_Line ( DoorHook_Des, Description, Door_Num ) end sub sub Description_Pre ( \ Door_Data as Door_Data_Type, \ Door_Num as integer ) ////////////////////////////////////////////////////////////////////// ? "@0B@[@09@"; ? FormatNumber ( Door_Num, "##" ); ? "@0B@] "; if Door_Data.Cost > 0 then ? "@0A@"; else ? "@02@"; end if ? Dollars_Str ( Door_Data.Cost ); ? "@0F@ "; end sub sub Description_Pre_File ( \ Door_Data as Door_Data_Type, \ Door_Num as integer, \ File_Num as integer ) ////////////////////////////////////////////////////////////////////// ? #File_Num, "@0B@[@09@"; ? #File_Num, FormatNumber ( Door_Num, "##" ); ? #File_Num, "@0B@] "; if Door_Data.Cost > 0 then ? #File_Num, "@0A@"; else ? #File_Num, "@02@"; end if ? #File_Num, Dollars_Str ( Door_Data.Cost ); ? #File_Num, "@0F@ "; end sub sub DoorHook_Config_Init ( \ Config as DoorHook_Config_Type ) ////////////////////////////////////////////////////////////////////// Config.Cost = DoorHook_Config_Default_Cost Config.Cost_Delta = DoorHook_Config_Default_Cost_Delta Config.Cost_Min = DoorHook_Config_Default_Cost_Min Config.Cost_Max = DoorHook_Config_Default_Cost_Max Config.Last_Door = DoorHook_Config_Default_Last_Door end sub sub DoorHook_Config_Load ( \ Config as DoorHook_Config_Type ) ////////////////////////////////////////////////////////////////////// dim File_Num as integer dim Line as string ////////////////////////////////////////////////////////////////////// if Exists ( DoorHook_CFG ) then File_Num = FreeFile open DoorHook_Cfg for input as File_Num if not EOF ( File_Num ) then input #File_Num, Line // Configuration version number would go here. // // if Line <> DoorHook_Config_Version then ... end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Cost = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Cost_Delta = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Cost_Min = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Cost_Max = Val ( Line ) end if end if if not EOF ( File_Num ) then input #File_Num, Line if String_Is_Integer ( Line ) then Config.Last_Door = Val ( Line ) end if end if close ( File_Num ) else ? DoorHook_Cfg; " configuration file not found." end if end sub sub DoorHook_Config_Menu ( \ Config as DoorHook_Config_Type ) ////////////////////////////////////////////////////////////////////// dim Config_Changed as boolean dim Option as string*1 dim Default as string*1 dim New_Setting as integer ////////////////////////////////////////////////////////////////////// Config_Changed = false Default = "1" do cls ? Copyright; ". Registered to "; Registration; "." ? ? "1 -- Default cost = "; Config.Cost ? "2 -- Default cost delta = "; Config.Cost_Delta ? "3 -- Default cost min = "; Config.Cost_Min ? "4 -- Default cost max = "; Config.Cost_Max ? "5 -- Last available door = "; Config.Last_Door ? "D -- set all settings to initial installation Defaults" ? "L -- Load configuration from file" ? "Q -- Quit" ? "S -- Save current configuration settings to file" ? ? "Option ["; Default; "]: "; input Option ? if Option = "" then Option = Default end if Option = UCase ( Option ) select case Option case "1" ? "This setting determines the cost of each door before" ? "the SysOp has individually set it for that specific door." ? New_Setting = Integer_Ask ( \ "Default door cost ", 0, , Config.Cost ) if New_Setting <> Config.Cost then Config_Changed = true Config.Cost = New_Setting Default = "S" end if case "2" ? "This setting determines the cost delta of each door before" ? "the SysOp has individually set it for that specific door." ? New_Setting = Integer_Ask ( \ "Default door cost delta", 0, , Config.Cost_Delta ) if New_Setting <> Config.Cost_Delta then Config_Changed = true Config.Cost_Delta = New_Setting Default = "S" end if case "3" ? "This setting determines the minimum cost of each door before" ? "the SysOp has individually set it for that specific door." ? New_Setting = Integer_Ask ( \ "Default door cost minimum", 0, , Config.Cost_Min ) if New_Setting <> Config.Cost_Min then Config_Changed = true Config.Cost_Min = New_Setting Default = "S" end if case "4" ? "This setting determines the maximum cost of each door before" ? "the SysOp has individually set it for that specific door." ? New_Setting = Integer_Ask ( \ "Default door cost maximum", 0, , Config.Cost_Max ) if New_Setting <> Config.Cost_Max then Config_Changed = true Config.Cost_Max = New_Setting Default = "S" end if case "5" ? "This is the highest door number available." ? "It doesn't hurt to have this too high but the" ? "closer you have this number to your actual number" ? "of doors the faster the event maintenance will be." ? New_Setting = Integer_Ask ( \ "Last available door ", 0, , Config.Last_Door ) if New_Setting <> Config.Last_Door then Config_Changed = true Config.Last_Door = New_Setting Default = "S" end if case "D" ? "Setting to installation defaults..."; DoorHook_Config_Init ( Config ) ? "done." Default = "S" Config_Changed = true WaitEnter case "L" ? "Loading..."; DoorHook_Config_Load ( Config ) ? "done." Default = "Q" Config_Changed = false WaitEnter case "Q" exit do case "S" ? "Saving..."; DoorHook_Config_Save ( Config ) ? "done." Default = "Q" Config_Changed = false WaitEnter case else Beep end select loop if Config_Changed then ? ? "You have changed your configuration settings." ? "You may save these new settings to a file if you want them to" ? "load as currently set each time DoorHook is run." ? ? "Do you want to save your current configuration settings?"; if InputYesNo ( " (y/N): ", false ) then ? "Saving..."; DoorHook_Config_Save ( Config ) ? "done." WaitEnter end if end if end sub sub DoorHook_Config_Save ( \ Config as DoorHook_Config_Type ) ////////////////////////////////////////////////////////////////////// dim File_Num as integer ////////////////////////////////////////////////////////////////////// File_Num = FreeFile open DoorHook_Cfg for output as File_Num ? #File_Num, DoorHook_Config_Version ? #File_Num, Config.Cost ? #File_Num, Config.Cost_Delta ? #File_Num, Config.Cost_Min ? #File_Num, Config.Cost_Max ? #File_Num, Config.Last_Door close ( File_Num ) end sub sub Door_Data_Default ( \ Door_Data as Door_Data_Type, \ Config as DoorHook_Config_Type ) ////////////////////////////////////////////////////////////////////// Door_Data.Enabled = true Door_Data.WCX_Hook = false Door_Data.WCX_Path = "" Door_Data.Cost = Config.Cost Door_Data.Total = 0 Door_Data.Display_Total = true CurrentDate ( Door_Data.Last_Update ) Door_Data.Usages_Recent = 0 Door_Data.Usages_Total = 0 Door_Data.Income_Per_Week = 0.0 Door_Data.Cost_Delta = Config.Cost_Delta Door_Data.Cost_Min = Config.Cost_Min Door_Data.Cost_Max = Config.Cost_Max Door_Data.Decreased = false Door_Data.Record_Number = Config.Last_Door + 1 end sub sub Door_Data_Load ( \ Description as string , \ Door_Data as Door_Data_Type, \ byval Door_Num as integer ) ////////////////////////////////////////////////////////////////////// dim Config as DoorHook_Config_Type dim File_Num_Data as integer ////////////////////////////////////////////////////////////////////// DoorHook_Config_Load ( Config ) Door_Data_Default ( Door_Data, Config ) Door_Data.Record_Number = Door_Num if Exists ( DoorHook_Dat ) then File_Num_Data = FreeFile open DoorHook_Dat for random as File_Num_Data \ len = Len ( Door_Data_Type ) seek File_Num_Data, Door_Num if not EOF ( File_Num_Data ) then Get File_Num_Data, , Door_Data if Door_Data.Record_Number <> Door_Num then Door_Data_Default ( Door_Data, Config ) Door_Data.Record_Number = Door_Num end if end if close ( File_Num_Data ) end if Description_Load ( Description, Door_Num ) end sub sub Door_Data_Save ( \ byval Description as string, \ Door_Data as Door_Data_Type, \ byval Door_Num as integer ) ////////////////////////////////////////////////////////////////////// dim File_Num_Data as integer ////////////////////////////////////////////////////////////////////// File_Num_Data = FreeFile open DoorHook_Dat for random as File_Num_Data \ len = Len ( Door_Data_Type ) seek File_Num_Data, Door_Num put File_Num_Data, , Door_Data close ( File_Num_Data ) Description_Save ( Description, Door_Num ) end sub sub DoorHook_Event ( \ byval Registration as string, \ byval Copyright as string, \ Config as DoorHook_Config_Type ) ////////////////////////////////////////////////////////////////////// dim Days as long dim Description as string dim Door_Data as Door_Data_Type dim Door_Num as integer dim Prior_Cost as integer dim Prior_Income_Per_Week as long ////////////////////////////////////////////////////////////////////// MorePrompt Off for Door_Num = 1 to Config.Last_Door ? "Loading data for door "; Door_Num; "..."; Door_Data_Load ( Description, Door_Data, Door_Num ) ? "updating cost..."; Days = Days_Since_Today ( Door_Data.Last_Update ) if Days < 1 then Days = 1 end if CurrentDate ( Door_Data.Last_Update ) Prior_Income_Per_Week = Door_Data.Income_Per_Week Door_Data.Income_Per_Week \ = Door_Data.Cost * Door_Data.Usages_Recent * ( 7.0 / Days ) Prior_Cost = Door_Data.Cost Door_Data.Cost = Cost_Update ( \ Door_Data.Cost, Door_Data.Cost_Delta, \ Door_Data.Cost_Min, Door_Data.Cost_Max, \ Prior_Income_Per_Week / 7.0, \ Door_Data.Usages_Recent, Door_Data.Decreased, Days ) Door_Data.Decreased = Door_Data.Cost < Prior_Cost ? "saving..."; Door_Data_Save ( Description, Door_Data, Door_Num ) ? "done." next Door_Num Menu_User_Make ( Config ) for Door_Num = 1 to Config.Last_Door Door_Data_Load ( Description, Door_Data, Door_Num ) Door_Data.Usages_Recent = 0 Door_Data_Save ( Description, Door_Data, Door_Num ) next Door_Num end sub sub DoorHook_Start ( \ byval Registration as string, \ byval Copyright as string ) ////////////////////////////////////////////////////////////////////// dim Config as DoorHook_Config_Type dim Description as string dim Door_Num as integer : Door_Num = -1 dim Option as string*1 dim Log_Str as string dim DoorDisp_BBS as string dim Default_Option as string : Default_Option = "E" dim Door_Data as Door_Data_Type ////////////////////////////////////////////////////////////////////// DoorHook_Config_Init ( Config ) DoorHook_Config_Load ( Config ) if EventRunning then DoorHook_Event ( Registration, Copyright, Config ) exit sub end if do Door_Num = Menu_User ( Config ) if Door_Num <= 0 then exit do end if Door_Data_Load ( Description, Door_Data, Door_Num ) if ( Registration = UNREGISTERED ) and \ ( abs ( Door_Data.Cost ) > 2 ) then ? "In unregistered mode, the cost cannot exceed 2 cents." ? "Cost has been changed from "; Door_Data.Cost; " to 2 cents." Door_Data.Cost = 2 WaitEnter end if if ( Door_Data.Cost <> 0 ) or ( User_Is_SysOp ) then DoorDisp_BBS = "Door" + Trim ( Str ( Door_Num ) ) + ".BBS" do cls Color ( 10 ) ? Copyright ? "Registration: "; Registration ? ? "You have chosen Door "; Trim ( Str ( Door_Num ) ); "." ? ? "The cost to enter this door is "; Color ( 12 ) ? "$"; Trim ( FormatNumber ( Door_Data.Cost / 100, "###.##" ) ); Color ( 10 ) ? "." if ( Registration = UNREGISTERED ) \ or Door_Data.Display_Total then ? ? "The total accumulated for this door is "; ? "$"; Trim ( FormatNumber ( Door_Data.Total / 100, "###.##" ) ); "." end if ? ? "You have $"; ? Trim ( FormatNumber ( User.SubscriptionBalance / 100, "###.##" ) ); ? " in your account balance." ? ? "[E] Enter and Pay the Toll" ? "[Q] Quit this Door" if Exists ( Conference.DisplayPath + DoorDisp_BBS ) then ? "[R] Read the Description First" end if if User_Is_SysOp then ? "[S] SysOp Menu" end if ? ? "Option ["; Default_Option; "]: "; input Option if Option = "" then Option = Default_Option end if Option = UCase ( Option ) if Option = "E" then if ( User.SubscriptionBalance >= Door_Data.Cost ) or User_Is_SysOp then if not User_Is_SysOp then User.SubscriptionBalance = User.SubscriptionBalance - Door_Data.Cost Log_Str = "DoorHook: $" \ + Trim ( FormatNumber ( Door_Data.Cost / 100, "-@##.##" ) ) \ + " for Door " + FormatNumber ( Door_Num, "@####" ) ActivityLog ( Log_Str ) Door_Data.Total = Door_Data.Total + Door_Data.Cost Door_Data.Usages_Recent = Door_Data.Usages_Recent + 1 Door_Data.Usages_Total = Door_Data.Usages_Total + 1 Door_Data_Save ( Description, Door_Data, Door_Num ) end if if Door_Data.WCX_Hook then DisplayFile ( "DOOR" + Str ( Door_Num ) ) Run ( Door_Data.WCX_Path ) else Door ( Door_Num ) end if exit do else ? ? "The cost to enter this door exceeds your account balance." ? "To increase your account balance, please contact your SysOp." WaitEnter end if elseif Option = "Q" then exit do elseif Option = "R" then if Exists ( Conference.DisplayPath + DoorDisp_BBS ) then DisplayFile ( DoorDisp_BBS ) else ? DoorDisp_BBS; " is not available." WaitEnter end if elseif Option = "S" then Menu_SysOp ( Config, Description, Door_Data, \ Door_Num, Copyright, Registration ) else Beep end if loop else Door_Data.Usages_Recent = Door_Data.Usages_Recent + 1 Door_Data.Usages_Total = Door_Data.Usages_Total + 1 Door_Data_Save ( Description, Door_Data, Door_Num ) if Door_Data.WCX_Hook then DisplayFile ( "DOOR" + Str ( Door_Num ) ) Run ( Door_Data.WCX_Path ) else Door ( Door_Num ) end if end if loop end sub sub Menu_SysOp_Global ( \ Config as DoorHook_Config_Type, \ byval Copyright as string , \ byval Registration as string ) ////////////////////////////////////////////////////////////////////// dim Opt as string*1 ////////////////////////////////////////////////////////////////////// if not User_Is_SysOp then ? "You must have SysOp Status to enter the SysOp Menu." WaitEnter exit sub end if do ClS Color ( 12 ) ? Copyright ? "Registration: "; Registration ? ? "DOORHOOK SYSOP GLOBAL OPTIONS MENU" ? ? "[1] Main Configuration" ? "[2] Event Maintenance" ? "[3] Regenerate the doors list menu" ? "[4] edit the top of the door list ("; DoorHead_BBS; ")" ? "[5] edit the bottom of the door list ("; DoorTail_BBS; ")" ? "[6] edit the short descriptions for all doors" ? "[Q] Quit this Menu" ? ? "Option [Q]: "; input Opt if Opt = "" then Opt = "Q" end if select case UCase ( Opt ) case "Q" exit do case "1" DoorHook_Config_Menu ( Config ) case "2" DoorHook_Event ( Registration, Copyright, Config ) case "3" Menu_User_Make ( Config ) case "4" if EditFile ( DoorHead_BBS, 32767, DoorHead_BBS ) then DisplayFile ( "..\" + DoorHead_BBS ) WaitEnter end if case "5" if EditFile ( DoorTail_BBS, 32767, DoorTail_BBS ) then DisplayFile ( "..\" + DoorTail_BBS ) WaitEnter end if case "6" EditFile ( DoorHook_Des, Config.Last_Door, DoorHook_Des ) case else Beep end select loop end sub sub Menu_SysOp ( \ Config as DoorHook_Config_Type, \ Description as string , \ Door_Data as Door_Data_Type , \ byval Door_Num as integer , \ byval Copyright as string , \ byval Registration as string ) ////////////////////////////////////////////////////////////////////// dim Cost_New as integer dim Days as long dim Opt as string*1 dim Cost_Str as string dim Total_Str as string dim DoorLong_BBS as string ////////////////////////////////////////////////////////////////////// if not User_Is_SysOp then ? "You must have SysOp Status to enter the SysOp Menu." WaitEnter exit sub end if DoorLong_BBS = "DISP\DOOR" + Str ( Door_Num ) + ".BBS" do cls Color ( 12 ) ? Copyright ? "Registration: "; Registration ? ? "DOORHOOK SYSOP DOOR MENU" ? ? Pad ( "[G] Global SysOp Menu", 40 ); ? "[Q] Quit this Menu" ? Pad ( "[ ] Enabled.............: " \ + Boolean_Image ( Door_Data.Enabled ), 40 ); ? "[H] WCX Hook............: " \ + Boolean_Image ( Door_Data.WCX_Hook ) ? Pad ( "[C] Cost (cents)........: " \ + Str ( Door_Data.Cost ), 40 ); ? "[6] Cost Delta (cents)..: " + Str ( Door_Data.Cost_Delta ) ? Pad ( "[4] Cost Min (cents)....: " \ + Str ( Door_Data.Cost_Min ), 40 ); ? "[5] Cost Max (cents)....: " + Str ( Door_Data.Cost_Max ) ? Pad ( "[D] Display Total.......: " \ + Boolean_Image ( Door_Data.Display_Total ), 40 ); ? "[T] Total Received......: " \ + Str ( Door_Data.Total ) ? Pad ( "[9] Usages, Recent......: " \ + Str ( Door_Data.Usages_Recent ), 40 ); ? "[*] Usages, Total.......: "; Door_Data.Usages_Total ? "[ ] Last Update.........: "; FormatDate ( Door_Data.Last_Update, "yyyy-mm-dd" ) ? Pad ( "[ ] Prior Income/Week...: " \ + Str ( Door_Data.Income_Per_Week ), 40 ); ? "[ ] Decreased...........: "; \ Boolean_Image ( Door_Data.Decreased ) Days = Days_Since_Today ( Door_Data.Last_Update ) if Days < 1 then Days = 1 end if ? Pad ( "Estimated Income/Week...: " \ + Str ( Door_Data.Cost \ * Door_Data.Usages_Recent * ( 7 / Days ) ), 40 ); ? "Estimated Future Cost...: "; Cost_Update ( \ Door_Data.Cost, Door_Data.Cost_Delta, \ Door_Data.Cost_Min, Door_Data.Cost_Max, \ Door_Data.Income_Per_Week / 7.0, \ Door_Data.Usages_Recent, Door_Data.Decreased, Days ) ? "[P] WCX Hook Path (below)" ? Door_Data.WCX_Path ? "[2] Edit the long description ("; DoorLong_BBS; ")" ? "[1] Edit the short description (below)" Description_Pre ( Door_Data, Door_Num ) ? Description ? ? "Option [Q]: "; input Opt if Opt = "" then Opt = "Q" end if select case UCase ( Opt ) case "Q" exit do case "G" Menu_Sysop_Global ( Config, Copyright, Registration ) case "0" Door_Data.Income_Per_Week = Real_Ask ( \ "Income per Week ", 0.0, 99999.99, \ Door_Data.Income_Per_Week ) Door_Data_Save ( Description, Door_Data, Door_Num ) case "4" Door_Data.Cost_Min = Integer_Ask ( \ "Minimum cost (cents) ", 0, , \ Door_Data.Cost_Min ) Door_Data_Save ( Description, Door_Data, Door_Num ) case "5" Door_Data.Cost_Max = Integer_Ask ( \ "Maximum cost (cents) ", 0, , \ Door_Data.Cost_Max ) Door_Data_Save ( Description, Door_Data, Door_Num ) case "6" Door_Data.Cost_Delta = Integer_Ask ( \ "Cost adjustment step size (cents) ", 0, , \ Door_Data.Cost_Delta ) Door_Data_Save ( Description, Door_Data, Door_Num ) case "9" Door_Data.Usages_Recent = Long_Ask ( \ "Usages since last update ", 0, , Door_Data.Usages_Recent ) Door_Data_Save ( Description, Door_Data, Door_Num ) case "*" Door_Data.Usages_Total = Long_Ask ( \ "Total usages since installation ", 0, , \ Door_Data.Usages_Total ) Door_Data_Save ( Description, Door_Data, Door_Num ) case "1" do ? ? "The old description:" Description_Pre ( Door_Data, Door_Num ) ? Description ? ? "Enter the new description:" Description_Pre ( Door_Data, Door_Num ) input Description ? Description_Pre ( Door_Data, Door_Num ) ? Description ? loop while not \ InputYesNo ( "Save this description? (Y/n): ", true ) ? Door_Data_Save ( Description, Door_Data, Door_Num ) ? "Saved." case "2" if EditFile ( DoorLong_BBS, 32767, DoorLong_BBS ) then DisplayFile ( "DOOR" + Str ( Door_Num ) + ".BBS" ) end if case "C" ? ? "Please enter the new cost in cents ["; Door_Data.Cost; ? "]: "; input Cost_Str if Cost_Str <> "" then Cost_New = Val ( Cost_Str ) if ( Registration = UNREGISTERED ) and \ ( abs ( Cost_New ) > 2 ) then ? "Maximum cost in unregistered mode is 2 cents." WaitEnter else if Cost_New < 0 then ? "WARNING: your cost is negative!" ? "WARNING: you will be paying users to use this door!" end if Door_Data.Cost = Cost_New Door_Data_Save ( Description, Door_Data, Door_Num ) ? "Done." WaitEnter end if end if case "D" if Registration = UNREGISTERED then ? ? "In unregistered mode, the total will always be displayed." WaitEnter else if not Door_Data.Display_Total then Door_Data.Display_Total = true else Door_Data.Display_Total = false end if Door_Data_Save ( Description, Door_Data, Door_Num ) ? "Done." WaitEnter end if case "H" Door_Data.WCX_Hook = InputYesNo ( \ "Is the program a WCX hook? (y/N): ", false ) Door_Data_Save ( Description, Door_Data, Door_Num ) case "P" ? "Path: "; input Door_Data.WCX_Path Door_Data_Save ( Description, Door_Data, Door_Num ) case "T" ? "Please enter the new total in cents ["; Door_Data.Total; ? "]: "; input Total_Str if Total_Str <> "" then Door_Data.Total = Val ( Total_Str ) Door_Data_Save ( Description, Door_Data, Door_Num ) ? "Done." WaitEnter end if case else Beep end select loop end sub function Menu_User ( \ Config as DoorHook_Config_Type ) as integer ////////////////////////////////////////////////////////////////////// dim Door_Num_Str as string dim Default as string*1 dim Door_Num as integer dim Door_Data as Door_Data_Type dim File_Num as integer dim Line as string dim Line_Count as integer ////////////////////////////////////////////////////////////////////// Default = "C" Line_Count = 1 Cls if Exists ( DoorHead_BBS ) then File_Num = FreeFile open DoorHead_BBS for input as File_Num do while not EOF ( File_Num ) input #File_Num, Line Line_Count = Line_Count + 1 if Line_Count >= User.LinesPerPage then Line_Count = 1 Color ( 13 ) ? "Door number, (C)ontinue, or (Q)uit ["; Default; "]: "; input Door_Num_Str if Door_Num_Str = "" then Door_Num_Str = Default end if Door_Num_Str = UCase ( Door_Num_Str ) if Door_Num_Str = "Q" then Menu_User = 0 exit function elseif String_Is_Integer ( Door_Num_Str ) then Menu_User = Val ( Door_Num_Str ) exit function end if end if ? Line loop close ( File_Num ) end if if Exists ( DoorBody_BBS) then File_Num = FreeFile open DoorBody_BBS for input as File_Num do while not EOF ( File_Num ) input #File_Num, Line Line_Count = Line_Count + 1 if Line_Count >= User.LinesPerPage then Line_Count = 1 Color ( 13 ) ? "Door number, (C)ontinue, or (Q)uit ["; Default; "]: "; input Door_Num_Str if Door_Num_Str = "" then Door_Num_Str = Default end if Door_Num_Str = UCase ( Door_Num_Str ) if Door_Num_Str = "Q" then Menu_User = 0 exit function elseif String_Is_Integer ( Door_Num_Str ) then Menu_User = Val ( Door_Num_Str ) exit function end if end if ? Line loop close ( File_Num ) end if if Exists ( DoorTail_BBS ) then File_Num = FreeFile open DoorTail_BBS for input as File_Num do while not EOF ( File_Num ) input #File_Num, Line Line_Count = Line_Count + 1 if Line_Count >= User.LinesPerPage then Line_Count = 1 Color ( 13 ) ? "Door number, (C)ontinue, or (Q)uit ["; Default; "]: "; input Door_Num_Str if Door_Num_Str = "" then Door_Num_Str = Default end if Door_Num_Str = UCase ( Door_Num_Str ) if Door_Num_Str = "Q" then Menu_User = 0 exit function elseif String_Is_Integer ( Door_Num_Str ) then Menu_User = Val ( Door_Num_Str ) exit function end if end if ? Line loop close ( File_Num ) end if Default = "Q" Color ( 13 ) ? "Door number or (Q)uit ["; Default; "]: "; input Door_Num_Str if Door_Num_Str = "" then Door_Num_Str = Default end if Door_Num_Str = UCase ( Door_Num_Str ) if Door_Num_Str = "Q" then Menu_User = 0 elseif String_Is_Integer ( Door_Num_Str ) then Menu_User = Val ( Door_Num_Str ) end if end function sub Menu_User_Make ( \ Config as DoorHook_Config_Type ) ////////////////////////////////////////////////////////////////////// dim Description as string dim Door_Num as integer dim Door_Data as Door_Data_Type dim File_Num as integer ////////////////////////////////////////////////////////////////////// SortStart for Door_Num = 1 to Config.Last_Door Door_Data_Load ( Description, Door_Data, Door_Num ) SortAdd ( FormatNumber ( Door_Data.Usages_Recent, "@####" ) \ + FormatNumber ( Door_Data.Usages_Total, "@#########" ), \ Door_Num ) next Door_Num File_Num = FreeFile open DoorBody_BBS for output as File_Num Door_Num = SortPrev do while Door_Num > -1 Door_Data_Load ( Description, Door_Data, Door_Num ) if Door_Data.Enabled then // if Exists ( WCWork_Dir + "\DOOR" + Str ( Door_Num ) + ".RUN" ) \ // or Exists ( "BATCH\DOOR" + Str ( Door_Num ) + ".BAT" ) then Description_Pre_File ( Door_Data, Door_Num, File_Num ) ? #File_Num, Description end if Door_Num = SortPrev loop close ( File_Num ) end sub