home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / homonlib.zip / HOMONREF.TXT < prev    next >
Text File  |  1995-04-13  |  54KB  |  1,218 lines

  1.  
  2. SUB BorderLines (parm())
  3. '****************************************************************************
  4. 'Primarily called from other library functions, the BorderLines() SUB draws
  5. ' lines on the top and bottom of a pick screen, advising the user of the
  6. ' availability of (or lack of) more items that are not currently shown on the
  7. ' screen.
  8. '
  9. '    parm(1) = row of top line
  10. '    parm(2) = row of bottom line
  11. '    parm(3) = top element
  12. '    parm(4) = bottom element
  13. '    parm(5) = min element
  14. '    parm(6) = max element
  15. '
  16. 'See functions PickOne$() and PickSome$() for examples of use.
  17. '
  18. '****************************************************************************
  19.  
  20.  
  21. SUB Box (row1, col1, row2, col2, boxtype$)
  22. '****************************************************************************
  23. 'Draws a box on the screen at the specified coordinates.  row1 & col1 are the
  24. ' top left corner, row2 & col2 are the bottom right corner.  The appearance
  25. ' of the box is determined by boxtype$, which can either be one character to
  26. ' pick a predefined box type or a string of 11 or more characters to be used
  27. ' as the actual box characters.  See the function body of Panes() for the
  28. ' exact placement of the characters within the string and other options.
  29. '
  30. 'Examples of boxtype$: "1" or "S"    Draws a single-line box (default)
  31. '                      "2" or "D"    Draws a double-line box
  32. '                      "3" or "H"    Double Horizontal lines, single vertical
  33. '                      "4" or "V"    Double Vertical lines, single horizontal
  34. '                      "***********" Draws a box made of asterisks
  35. '
  36. '****************************************************************************
  37.  
  38.  
  39. SUB BoxCalc (t, l, b, r, tall, wide)
  40. '****************************************************************************
  41. 'This function is used by other functions that draw pop-up boxes to calculate
  42. ' the box coordinates.
  43. '
  44. 'The box coordinates passed as t, l, b and r will be directly modified by the
  45. ' sub to contain the desired values.
  46. '
  47. 'See EditBox(), PickBox(), ListBox() and Progress() for examples of use.
  48. '
  49. '****************************************************************************
  50.  
  51.  
  52. FUNCTION Capitalize$ (orig$)
  53. '****************************************************************************
  54. 'Capitalizes the first letter of each word in a string after first converting
  55. ' the whole thing to lower case.
  56. '****************************************************************************
  57.  
  58.  
  59. SUB Center (row, text$)
  60. '****************************************************************************
  61. 'Centers text on the specified row.
  62. '****************************************************************************
  63.  
  64.  
  65. FUNCTION ColorSet (hdr1$, hdr2$, parm(), defaults())
  66. '****************************************************************************
  67. 'A handy function to let the user set their color preferences.
  68. '
  69. 'The hdr1$ and hdr2$ arugments are text strings that will be centered on the
  70. ' first two lines of the screen.
  71. '
  72. 'The parm() array will be directly modified by ColorSet().  The function will
  73. ' return TRUE if any of the colors were changed, FALSE if they are the same
  74. ' as when the function was entered.  This is useful if the calling program
  75. ' needs to know whether to save the new values in some sort of a setup file
  76. ' or not.
  77. '
  78. 'The defaults() array should mimic the parm() array.  It must have subscripts
  79. ' ranging from MINCOLOR to MAXCOLOR at least.
  80. '
  81. 'Because this function changes colors and has to mess with the screen a bit,
  82. ' it does not restore the previous screen or viewport upon exiting.  The
  83. ' procedure that calls this function must know to repaint the screen and
  84. ' restore any active viewport upon returning.
  85. '
  86. '****************************************************************************
  87.  
  88.  
  89. FUNCTION CountIn (search$, lookfor$)
  90. '****************************************************************************
  91. 'Returns the number of times that a substring is found within a string.
  92. '****************************************************************************
  93.  
  94.  
  95. FUNCTION Dice (rolls, sides, add)
  96. '****************************************************************************
  97. 'Returns the results of the specified dice roll(s).
  98. '
  99. 'If you are a role-playing gamer, you will notice that the syntax of this
  100. ' function is similar to "standard gaming notation" of dice.  For example,
  101. ' "3d6" can be easily translated to Dice(3,6,0), or "2d4+1" as Dice(2,4,1).
  102. '
  103. '****************************************************************************
  104.  
  105.  
  106. FUNCTION Dir$ (file$, DirInfo AS DirType)
  107. '****************************************************************************
  108. 'Credit for this function must go to Fairchild Computer Services.  The code
  109. ' has been altered from the original to suit my purposes.  The original is
  110. ' available on CompuServe as "DIR.ZIP", and comes with some other good stuff.
  111. ' It is one of the most useful things I have ever downloaded.  Thank you, FCS
  112. ' for sharing your knowledge with the rest of us!
  113. '
  114. 'I changed the original function by making the DirType variable a passed
  115. ' parameter rather than a COMMON SHARED variable, and altering the format of
  116. ' the EntryTime & EntryDate values.
  117. '
  118. 'The file$ parameter may be passed as an individual filename, or a filespec
  119. ' that includes wildcards and/or extended pathnames - just as if you were
  120. ' typing "DIR" at the DOS prompt.
  121. '
  122. 'The DirType variable will be filled with other information about the file
  123. ' found (if any).  See DIR.INC for the type declaration.
  124. '
  125. 'If any files match the wildcard, the function will return the filename of
  126. ' the first matching file.  If a single filename was passed, you'll just get
  127. ' the same name back and will then know that the file exists.  The DirType
  128. ' argument will contain the file's other information.
  129. '
  130. 'If no files match the wildcard or the single filename does not exist, Dir$()
  131. ' will return a null string ("") and the DirType variable will not be updated
  132. ' except with an ErrorCode.
  133. '
  134. 'To get further matches to a wildcard, continue to call Dir$() with a null
  135. ' file$ argument.  Keep doing this until a null string is returned.  This
  136. ' will indicate that no further files match the wildcard.
  137. '
  138. 'Example: ' $INCLUDE: 'DIR.INC'
  139. '         DIM DirInfo AS DirType
  140. '         f$ = Dir$("*.*", DirInfo)
  141. '         IF f$ = "" THEN
  142. '              PRINT "No files found"
  143. '         ELSE
  144. '              PRINT "These files were found:"
  145. '              DO
  146. '                   PRINT f$
  147. '                   f$ = Dir$("", DirInfo)
  148. '              LOOP UNTIL f$ = ""
  149. '         END IF
  150. '
  151. 'If there is a problem (such as an invalid pathname) Dir$() will return the
  152. ' string "***ERROR***" and the DirType.ErrorCode will contain a value.
  153. '
  154. 'Caution: Don't try to run Dir$() against an empty diskette drive.  You'll
  155. ' hang the computer.  Make sure there's a diskette in there first!
  156. '
  157. 'See the functions FileExist(), FileSize&() and DirExist() for more examples.
  158. '
  159. 'See the functions in DIRSTUFF.BAS for examples of how to interpret the
  160. ' values in the DirType variable.
  161. '
  162. '****************************************************************************
  163.  
  164.  
  165. FUNCTION DirAttr$ (a)
  166. '****************************************************************************
  167. 'This function takes as its argument the integer received from the Attribute
  168. ' field of a DirType variable (See DIR.INC).  It then returns a 5-character
  169. ' string with letters representing the file or directory's attributes.
  170. '
  171. 'If all the attributes were set, the function would return "DRHSA", where:
  172. '
  173. '    D = Directory
  174. '    R = Read Only
  175. '    H = Hidden
  176. '    S = System
  177. '    A = Archive
  178. '
  179. 'If one or more attributes are missing, their location in the string will be
  180. ' blank.
  181. '
  182. 'Example: "    A" = A file with only an archive attribute.
  183. '         " RHS " = A read only, hidden, system file (such as IO.SYS).
  184. '
  185. 'This code is also useful to see how you can interpret the values on your
  186. ' own.  And you thought you would never find a use for the bitwise AND!
  187. '
  188. '****************************************************************************
  189.  
  190.  
  191. FUNCTION DirDate$ (d&)
  192. '****************************************************************************
  193. 'This function converts the long integer value of a DirType.EntryDate into a
  194. ' string in the form of MM/DD/YY.
  195. '****************************************************************************
  196.  
  197.  
  198. FUNCTION DirExist (dirname$)
  199. '****************************************************************************
  200. 'The function will return TRUE if the directory in question exists, FALSE
  201. ' otherwise.
  202. '
  203. 'The dirname$ argument may be passed with or without a trailing backslash.
  204. '
  205. 'Note: A null string passed to the function will be interpreted as the
  206. ' current directory and the function will return TRUE.
  207. '
  208. 'Caution:  Attempting to use this function on an empty diskette drive will
  209. ' hang your computer.  Make sure there is a disk inserted first.
  210. '
  211. 'See function MakeDir() for an example of use.
  212. '
  213. '****************************************************************************
  214.  
  215.  
  216. FUNCTION DirTime$ (t)
  217. '****************************************************************************
  218. 'This function takes the integer value of a DirType.EntryTime field and
  219. ' converts it to a string in the form of HH:MMa.
  220. '****************************************************************************
  221.  
  222.  
  223. SUB Drop (text$, row, col)
  224. '****************************************************************************
  225. 'Prints text vertically on the screen, dropping from the specified row and
  226. ' column position.  If the length of the text would continue past row 24,
  227. ' printing will stop at that point.  See also: SUB Rise()
  228. '****************************************************************************
  229.  
  230.  
  231. FUNCTION EditBox$ (msg$(), orig$, parm())
  232. '****************************************************************************
  233. 'Basically, it's EdStr$() in a pop-up box.  Send an array of text to show
  234. ' along with the string to be edited, and the return values are the same as
  235. ' EdStr$().
  236. '
  237. '    parm(1) = top left row  0=Center
  238. '    parm(2) = top left column  0=Center
  239. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  240. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  241. '    parm(5) = maximum length of the string to be edited  1-77
  242. '    parm(6) = initial insert/overwrite mode (Use the SETCURS.INC constants)
  243. '    parm(7) = initial character position within the edit string.
  244. '    parm(8) = restrict input? (See EDSTR.INC)
  245. '
  246. 'Due to the width of the box & shadow, EditBox$() effectively limits the
  247. ' maximum length of the EdStr$() to 77 characters.
  248. '
  249. 'If a combination of any of the above parameters causes a portion of the box
  250. ' to exceed the screen boundaries, a run-time error will occur.
  251. '
  252. 'See function EdStr$() for more detailed information.
  253. '
  254. '****************************************************************************
  255.  
  256.  
  257. FUNCTION EditBox2$ (msg$, orig$, parm())
  258. '****************************************************************************
  259. 'Exactly the same as EditBox$(), but you pass a single text string as a
  260. ' message instead of an array.  Just saving you a little coding.
  261. '
  262. 'See EditBox$() for all the details.
  263. '
  264. '****************************************************************************
  265.  
  266.  
  267. FUNCTION EdStr$ (orig$, parm())
  268. '****************************************************************************
  269. 'Used to edit an existing string or for input of a new string.
  270. '
  271. 'If the user presses ESC during the editing, CHR$(27) will be returned to let
  272. ' the calling procedure know it was aborted.
  273. '
  274. 'If Enter is pressed to terminate the editing, the edited string will be
  275. ' returned.
  276. '
  277. 'The settings of the miscellaneous parameters are as follows:
  278. '
  279. '    parm(1) = row
  280. '    parm(2) = column
  281. '    parm(3) = maximum length of the edited string  1-80
  282. '    parm(4) = insert/overwrite mode (Use SETCURS.INC constants)
  283. '    parm(5) = initial cursor position within string  0=Beginning
  284. '    parm(6) = use delimiters? (0=No  Non-zero=Yes)
  285. '    parm(7) = left delimiter ASCII code.  Default = 62  ( > )
  286. '    parm(8) = right delimiter ASCII code.  Default = 60  ( < )
  287. '    parm(9) = use selected colors?  0=Current colors  Non-zero=Selected
  288. '    parm(10)= used to restrict user input.  See EDSTR.INC for values.
  289. '
  290. 'EdStr$() works just like you're used to, with all the familiar editing keys:
  291. ' Left/right arrows, Backspace, Delete, Insert/overwrite, Home, and End.  It
  292. ' also has a special service, Alt-X, that deletes from the cursor position to
  293. ' the end of the line.
  294. '
  295. 'The maximum length of the edited string depends on whether delimiters are
  296. ' used or not.  Without delimiters, the string may be up to 80 characters
  297. ' long.  With delimiters, it is reduced to 78.
  298. '
  299. 'If you choose to have EdStr$() appear in the highlighted colors, it will
  300. ' reset the colors to normal upon exit.  If not, the current color setting
  301. ' will not be changed at all.
  302. '
  303. 'If parm(10) is greater than zero, user input will be limited to certain
  304. ' characters.  See EDSTR.INC for the constant names.  You may add these
  305. ' constants together to get different combinations of allowed characters.
  306. '
  307. '    Example: parm(10) = EDUPPER + EDALPHA + EDSPACE
  308. '
  309. '              This would allow spaces and uppercase letters only.
  310. '
  311. 'The combinations allowed for parm(10) are not extensive by any means, but
  312. ' for simple input they can be handy.
  313. '
  314. '****************************************************************************
  315.  
  316.  
  317. FUNCTION Evaluate$ (formula$)
  318. '****************************************************************************
  319. 'This is a special function.  It evaluates a "formula" and returns a string
  320. ' of the value.  If an error is found within the formula (or Evaluate$ is
  321. ' just unable to handle it), Evaluate$ will return a string with a leading
  322. ' asterisk followed by a description of the error.  The best way to see what
  323. ' it does is just to experiment.  By no means am I sure that this function is
  324. ' completely bulletproof, but it will stand up to most expressions whose
  325. ' value doesn't exceed a few trillion.  This function is a good example of
  326. ' recursion if you are interested.
  327. '
  328. 'Example:  formula$ = "10*4-(36/3)"
  329. '          newval$ = Evaluate$(formula$)
  330. '          IF left$(newval$,1)="*" then
  331. '              PRINT "An error occurred!"
  332. '              PRINT newval$                 '(Error description)
  333. '          ELSE
  334. '              PRINT "The value of ";formula$;" is:"; VAL(newval$)
  335. '          END IF
  336. '
  337. 'Note: MUST be compiled with the /X switch.
  338. '
  339. '****************************************************************************
  340.  
  341.  
  342. FUNCTION FileExist (file$)
  343. '****************************************************************************
  344. 'Returns TRUE or FALSE depending on whether the specified file exists.  If
  345. ' used with a wildcard, it will return TRUE if any file matches the wildcard.
  346. '****************************************************************************
  347.  
  348.  
  349. FUNCTION FileParts$ (filespec$, operation$)
  350. '****************************************************************************
  351. 'Returns a specified part of an extended filename or other filespec type
  352. ' string.
  353. '
  354. 'The return value depends upon the value of the operation$ argument:
  355. '
  356. 'Example: filespec$ = "C:\GAMES\SAVEGAME.001"
  357. '         FileParts$(filespec$,"P")  -->  "C:\GAMES\"       (Path)
  358. '         FileParts$(filespec$,"F")  -->  "SAVEGAME.001"    (Filename)
  359. '         FileParts$(filespec$,"E")  -->  "001"             (Extension)
  360. '         FileParts$(filespec$,"N")  -->  "SAVEGAME"        (fileName)
  361. '         FileParts$(filespec$,"D")  -->  "C:"              (Drive)
  362. '
  363. '         filespec$ = "HOMEWORK.TXT"
  364. '         FileParts$(filespec$,"P")  -->  ""   Returns null if the requested
  365. '         FileParts$(filespec$,"D")  -->  ""   info is not part of filespec$
  366. '
  367. 'Paths are returned with a trailing backslash.  Drive letters are returned
  368. ' with a trailing colon.  Extensions are returned without a leading period.
  369. '
  370. 'Quirks:  FileParts$() assumes that all pathnames end in a backslash.  If you
  371. ' pass the function one that does not, it will think that it is a filename:
  372. '
  373. ' Example: "C:\GAMES" will be interpreted as a file called "GAMES" in the
  374. '           root directory of C:.  "C:\GAMES\" would be Ok.
  375. '
  376. 'Note: The letter "X" is accepted as well as "E" to get the extension.
  377. '
  378. '****************************************************************************
  379.  
  380.  
  381. FUNCTION FileSize& (file$)
  382. '****************************************************************************
  383. 'Returns a long integer representing the file size of a single file or the
  384. ' combined size of multiple files if a wildcard is passed.
  385. '
  386. 'Should the file(s) not be found, the function will return zero.
  387. '
  388. '****************************************************************************
  389.  
  390.  
  391. FUNCTION GenMen (choice$(), ok(), parm())
  392. '****************************************************************************
  393. 'GenMen() is a general vertical lightbar menu function.  It will return the
  394. ' element number of the selected item or zero if the user presses ESC.
  395. '
  396. 'The ok() array is used to specify which choices are available:
  397. '
  398. '                      0=Not available  Non-zero=Ok
  399. '
  400. 'The ok() array must have subscripts equal to those of choice$() or those
  401. ' specified by parm(6 and 7) - See below.
  402. '
  403. '    parm(1)  =  top row
  404. '    parm(2)  =  left column  0=Center
  405. '    parm(3)  =  # blank lines between choices  >=0
  406. '    parm(4)  =  allow number keys if < 10 choices?  0=No  Non-zero=Yes
  407. '    parm(5)  =  initial selected choice
  408. '    parm(6)  =  minimum choice$() subscript  0=Use actual minimum (LBOUND)
  409. '    parm(7)  =  maximum choice$() subscript  0=Use actual maximum (UBOUND)
  410. '
  411. 'If a combination of any of the above parameters cause one or more menu items
  412. ' to be placed outside the actual screen area, a run-time error will occur.
  413. '
  414. 'parm(4) indicates whether the user can press a number key (1-9) to select an
  415. ' option when there are 9 or less choices.  Identifying the choices by number
  416. ' is the programmer's responsibility if this option is desired.  Note: this
  417. ' option can only be selected when all the choice$() subscripts are positive.
  418. '
  419. '    Example:  choice$(1) = " 1) Do this      "
  420. '              choice$(2) = " 2) Do that      "
  421. '              choice$(3) = " 3) Do the other "
  422. '
  423. 'parm(6 and 7) can specify minimum and maximum elements of the array to use
  424. ' if the actual array contains more elements than you want on the menu.
  425. '
  426. '    Example:  DIM choice$(-10 to 30)              This example would create
  427. '              (assign values to choice$()...)     a lightbar menu using only
  428. '              parm(6) = 1                         choices 1 through 5,
  429. '              parm(7) = 5                         ignoring any element below
  430. '              picked = GenMen(...)                1 or over 5.
  431. '
  432. 'Note: It is not recommended to include subscript zero in the choices sent to
  433. ' GenMen().  You will be unable to tell the difference between the user
  434. ' selecting element zero and the user pressing ESC.  Exception: When element
  435. ' zero is some sort of quit or exit option this might be acceptable.
  436. '
  437. '****************************************************************************
  438.  
  439.  
  440. FUNCTION GenMen2 (choice$(), parm())
  441. '****************************************************************************
  442. 'GenMen2() is identical to GenMen() except that you need not pass the ok()
  443. ' array.  All elements default to available.
  444. '
  445. 'See GenMen() for more information.  The parm() settings are identical.
  446. '
  447. '****************************************************************************
  448.  
  449.  
  450. FUNCTION GetKey$ (parm()) STATIC
  451. '****************************************************************************
  452. 'Used to control user input.  It includes a screensaver routine and a way to
  453. ' trap hotkeys with polling rather than ON KEY.  Use it where you would
  454. ' normally place an INKEY$ loop.
  455. '
  456. 'Chances are, you will want to modify this function for each program that you
  457. ' write.  See below for information about how the screensaver works and how
  458. ' to add hotkey procedures.
  459. '
  460. '****************************************************************************
  461.  
  462.  
  463. FUNCTION HomePath$
  464. '****************************************************************************
  465. 'Returns the name of the current DOS directory.
  466. '****************************************************************************
  467.  
  468.  
  469. SUB InfoBox (msg$(), parm())
  470. '****************************************************************************
  471. 'Displays the text of the msg$() array in a pop-up box.  Basically, it is
  472. ' just a call to PickBox() with only one option of " Ok ".
  473. '
  474. '    parm(1) = top left row  0=Center
  475. '    parm(2) = top left column  0=Center
  476. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  477. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  478. '
  479. 'See function PickBox() for more detailed information.
  480. '
  481. '****************************************************************************
  482.  
  483.  
  484. SUB InfoBox2 (msg$, parm())
  485. '****************************************************************************
  486. 'Works just like InfoBox() but accepts a single text string rather than an
  487. ' array.
  488. '
  489. '    parm(1) = top left row  0=Center
  490. '    parm(2) = top left column  0=Center
  491. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  492. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  493. '
  494. 'See functions InfoBox() and PickBox() for more detailed information.
  495. '
  496. '****************************************************************************
  497.  
  498.  
  499. FUNCTION IsAlpha (text$)
  500. '****************************************************************************
  501. 'Returns TRUE if the text contains only letters and spaces, otherwise FALSE.
  502. '****************************************************************************
  503.  
  504.  
  505. FUNCTION IsNum (text$)
  506. '****************************************************************************
  507. 'Returns TRUE if the text contains only numeric data, FALSE otherwise.
  508. '
  509. 'The function considers a lone minus sign (-) to be an operator, not numeric.
  510. ' The same goes for a lone decimal point.  Both characters ARE allowed if
  511. ' cohabitating with digits (would their mothers approve?).
  512. '
  513. 'Examples:  IsNum("12")   --> TRUE      IsNum("ABC") --> FALSE
  514. '           IsNum("-6")   --> TRUE      IsNum(" ")   --> FALSE
  515. '           IsNum("1.3")  --> TRUE      IsNum("-")   --> FALSE
  516. '           IsNum("")     --> FALSE     IsNum(".")   --> FALSE
  517. '
  518. '****************************************************************************
  519.  
  520.  
  521. FUNCTION Istr$ (i)
  522. FUNCTION Lstr$ (l&)
  523. FUNCTION Sstr$ (s!)
  524. FUNCTION Dstr$ (d#)
  525. '****************************************************************************
  526. 'These functions simply make a string of a number and trim the leading space
  527. ' off of it.  The four differenct functions are for the different numeric
  528. ' variable types: Double precision, Integer, Long integer and Single
  529. ' precision.
  530. '
  531. 'They are not very complicated, but since I use the combination of LTRIM$()
  532. ' and STR$() so often, I might as well make my life easier.
  533. '
  534. '****************************************************************************
  535.  
  536.  
  537. FUNCTION Justify$ (orig$, side)
  538. '****************************************************************************
  539. 'Moves leading or trailing spaces to the appropriate side of the string,
  540. ' while retaining the original length of the string.
  541. '
  542. 'The side argument can take one of the following forms:
  543. '
  544. '    <0  =  Left justify   (move leading spaces to the right side)
  545. '     0  =  Center justify (spread spaces evenly on both sides)
  546. '    >0  =  Right justify  (move trailing spaces to the left side)
  547. '
  548. 'The function works by comparing the size of the original string to the size
  549. ' of the string after trimming the appropriate spaces.  These spaces are then
  550. ' tacked back on to the appropriate side.
  551. '
  552. 'Examples:  Justify$("Some text    ", 0)  -->  "  Some text  "
  553. '           Justify$("Some more    ", 1)  -->  "    Some more"
  554. '           Justify$("   Even more!",-1)  -->  "Even more!   "
  555. '
  556. '****************************************************************************
  557.  
  558.  
  559. FUNCTION LeadZero$ (number, newlen)
  560. '****************************************************************************
  561. '"Stringifys" an integer and pads it on the left with leading zeros up to the
  562. ' desired length.
  563. '
  564. 'This function was created mainly due to PRINT USING's inability to add
  565. ' leading zeros (But you can add asterisks!  Gee, I use that a lot.  NOT!!).
  566. ' Feel free to create additional functions that work on other data types.
  567. '
  568. 'Note: If used on a negative number, the minus sign will be included when
  569. ' calculating the new length.
  570. '
  571. '    Examples: LeadZero$(5,5)  -->  "00005"
  572. '              LeadZero$(-5,5) -->  "-0005"
  573. '
  574. '****************************************************************************
  575.  
  576.  
  577. FUNCTION ListBox (title$, choice$(), parm())
  578. '****************************************************************************
  579. 'ListBox() works just like PickOne(), but it appears in a pop-up box.  It
  580. ' returns the element number of the item selected or zero if the user pressed
  581. ' ESC.  There are no hotkeys in ListBox().
  582. '
  583. 'The title$ argument will be centered on the top border of the box.  If no
  584. ' title is desired, pass a null string.
  585. '
  586. 'The width of the box is determined by the longer of the title or longest
  587. ' choice$() element.
  588. '
  589. '    parm(1) = top row  0=Center
  590. '    parm(2) = left column  0=Center
  591. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  592. '    parm(4) = initial selected choice
  593. '
  594. '****************************************************************************
  595.  
  596.  
  597. FUNCTION MakeDir (directory$)
  598. '****************************************************************************
  599. 'Creates a DOS directory.  Unlike the MKDIR command, MakeDir() can create a
  600. ' directory more than one level deep or on a different drive.
  601. '
  602. 'The directory$ argument may be passed with or without a trailing backslash.
  603. '
  604. 'Returns TRUE if successful, FALSE if unable to create the directory.  If
  605. ' unable to create the directory, MakeDir() DOES NOT clean up after itself by
  606. ' removing any partially created subdirectories.
  607. '
  608. 'If creating a multi-level subdirectory, it is best to pass the whole
  609. ' pathname, including the drive letter.
  610. '
  611. 'Examples:  MakeDir("GAMES")  Creates a subdirectory "GAMES" off the current
  612. '                             directory.
  613. '
  614. '           MakeDir("C:\SCIENCE\DATA")  Creates the specified directory. If
  615. '                                       the \SCIENCE directory doesn't exist,
  616. '                                       it will get created too.  This would
  617. '                                       crash the MKDIR command.
  618. '
  619. 'Note: MUST be compiled with the /X switch due to the RESUME NEXT stuff.
  620. '
  621. 'Caution: If using MakeDir() on a floppy drive, MAKE SURE that there is a
  622. ' diskette in the drive or your computer will hang.
  623. '
  624. '****************************************************************************
  625.  
  626.  
  627.  
  628. FUNCTION Dmax# (a#, b#)
  629. FUNCTION Dmin# (a#, b#)
  630. FUNCTION Imax (a, b)
  631. FUNCTION Imin (a, b)
  632. FUNCTION Lmax& (a&, b&)
  633. FUNCTION Lmin& (a&, b&)
  634. FUNCTION Smax! (a!, b!)
  635. FUNCTION Smin! (a!, b!)
  636. '****************************************************************************
  637. 'The various max() and min() functions simply return the larger or smaller of
  638. ' two numbers.  There is one set of functions for each of the numeric data
  639. ' types.
  640. '
  641. 'While useful by themselves, they can be extremely handy when used in pairs:
  642. '
  643. '    biggest = Imax(a, Imax(b, c))
  644. '
  645. '    smallest! = Smin!(a!, Smin!(b!, c!))
  646. '
  647. '****************************************************************************
  648.  
  649.  
  650. FUNCTION PadC$ (orig$, newlen)
  651. FUNCTION PadL$ (orig$, newlen)
  652. FUNCTION PadR$ (orig$, newlen)
  653. FUNCTION PadX$ (orig$, newlen, side, char$)
  654. '****************************************************************************
  655. 'Pads a string with a specified character on the specified side(s) up to the
  656. ' new length.  A more flexible version of the other "Pad" functions (all of
  657. ' which are merely translated into calls to PadX$() with a space for the pad
  658. ' character!).
  659. '
  660. 'The side argument is expressed like so:  <0 = Left
  661. '                                          0 = Center
  662. '                                         >0 = Right
  663. '
  664. 'Examples: PadX$("Hello!",10,1," ") --> "Hello!    "
  665. '          PadX$("$500",10,-1,"*")  --> "******$500"
  666. '          PadX$("WOW",20,0,"!")    --> "!!!!!!!!WOW!!!!!!!!!"
  667. '
  668. '****************************************************************************
  669.  
  670.  
  671. SUB Panes (row1, col1, row2, col2, row3, col3, boxtype$)
  672. '****************************************************************************
  673. 'Draws a box on the screen at the specified coordinates.  row1 & col1 are the
  674. 'top left corner, row2 & col2 are the bottom right corner.  row3 & col3 are
  675. 'parameters specifying where the box is to be split horizontally and/or
  676. 'vertically.  If either or both row3 or col3 are zero, the box will not be
  677. 'split in that direction.  Experiment with it.
  678. '
  679. 'The appearance of the box is determined by boxtype$, which can either be one
  680. 'character to pick a predefined box type or a string of 11 or more characters
  681. 'to be used as the actual box characters.  See the function body for the
  682. 'exact placement of the characters within the string.
  683. '
  684. 'Examples of boxtype$: "1" or "S"    Draws a single-line box (default)
  685. '                      "2" or "D"    Draws a double-line box
  686. '                      "3" or "H"    Double horizontal lines, single vertical
  687. '                      "4" or "V"    Double vertical lines, single horizontal
  688. '                      "***********" Draws a box made of asterisks
  689. '
  690. 'The box can be drawn as an outline only, not overwriting anything within the
  691. ' box's borders or can be filled with a fill character, effectively placing
  692. ' the box over whatever was already there.  This option is also controlled by
  693. ' the boxtype$ argument:
  694. '
  695. 'If boxtype$ is specified as a number ("1", "2"...) the box will be drawn as
  696. ' an outline only.  If boxtype$ is specified as a letter ("S", "D"...) the
  697. ' box will be filled with spaces.
  698. '
  699. 'If boxtype is a user-supplied string of characters, if it's length is 12 or
  700. ' more, the 12th character will be used as the fill character, otherwise the
  701. ' box will be drawn as an outline.
  702. '
  703. '****************************************************************************
  704.  
  705.  
  706. FUNCTION ParseDie$ (die$)
  707. '****************************************************************************
  708. 'This function takes a string in "standard gaming notation" and returns a
  709. ' string of the stated dice roll's value.
  710. '
  711. 'If the die$ string begins with an asterisk (*), ParseDie$() will interpret
  712. ' it as a constant (non-random value) and will return whatever follows the
  713. ' asterisk.
  714. '
  715. 'If an illegal character is found in the string, the return value will begin
  716. ' with an at-sign (@) followed by the string position of the offending
  717. ' character.  The following characters are recognized by ParseDie$():
  718. '
  719. '                  *0123456789dD+- (spaces are ignored)
  720. '
  721. 'Remember that the Dice() function accepts only integer arguments and returns
  722. ' and integer.  If the result of the die roll (or any of its parts) exceeds
  723. ' the limits of an integer variable (-32,768 to 32,767) a run-time error will
  724. ' occur.  If you need more, just rewrite these functions using long integers.
  725. '
  726. '    Examples: ParseDie$("3d6")   -->  "3" to "18"
  727. '              ParseDie$("1d4+1") -->  "2" to "5"
  728. '              ParseDie$("*15")   -->  "15"
  729. '              ParseDie$("2d3.1") -->  "@4"  (Illegal character in 4th pos.)
  730. '              ParseDie$("")      -->  "0"
  731. '              ParseDie$("  ")    -->  "1" to "4"  (Defaults to 1d4)
  732. '              ParseDie$("2d50000")    Crash!
  733. '
  734. '****************************************************************************
  735.  
  736.  
  737. FUNCTION PickBox (msg$(), choice$(), parm())
  738. '****************************************************************************
  739. 'Allows the user to pick from a horizontal light-bar menu within a pop-up
  740. ' message box.
  741. '
  742. 'The informational text of the box is contained within the msg$() array.
  743. '
  744. 'The choice$() array contains the items the user may pick from.  The function
  745. ' will return the element number of the item selected, or zero if the user
  746. ' presses ESC.
  747. '
  748. '    parm(1) = top left row  0=Center
  749. '    parm(2) = top left column  0=Center
  750. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  751. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  752. '    parm(5) = initial selected choice
  753. '
  754. 'If a combination of any of the above parameters causes a portion of the box
  755. ' to exceed the screen boundaries, a run-time error will occur.
  756. '
  757. '****************************************************************************
  758.  
  759.  
  760. FUNCTION PickInfo$ (p$, k, e)
  761. '****************************************************************************
  762. 'This function interprets the return string from the PickOne$() and
  763. ' PickSome$() functions.
  764. '
  765. 'The return value from the Pick function is passed as p$.  The integer
  766. ' variables passed as k and e will be assigned the value of the keypress and
  767. ' element number respectively.
  768. '
  769. 'PickInfo$() returns the actual character value of the keypress used to exit
  770. ' the Pick function.
  771. '
  772. 'See the comments within PickOne$() for a more detailed explanation of the
  773. ' Pick functions' return values.
  774. '
  775. 'Examples:     k$ = PickInfo$("", k, e)        -->  k$ = CHR$(27)
  776. '                                                   k  = 27
  777. '              (User pressed ESC)                   e  = 0
  778. '
  779. '              k$ = PickInfo$("*-59 4", k, e)  -->  k$ = CHR$(0)+CHR$(59)
  780. '                                                   k  = -59
  781. '              (User pressed F1 on element 4)       e  = 4
  782. '
  783. '              k$ = PickInfo$("19", k, e)      -->  k$ = CHR$(13)
  784. '                                                   k  = 13
  785. '              (User pressed Enter on element 19)   e  = 19
  786. '
  787. 'Note: This function is a good example of how to get more than one return
  788. ' value from a function.
  789. '
  790. '****************************************************************************
  791.  
  792.  
  793. FUNCTION PickOne$ (choice$(), parm())
  794. '****************************************************************************
  795. 'Allow the user to select an item from an array by highlighting it with the
  796. ' cursor keys & pressing Enter.  The function returns a string of the item's
  797. ' element number, or a null string if the user ESCapes.  Other options are
  798. ' available, and are specified in parm().
  799. '
  800. '    parm(1) = top row
  801. '    parm(2) = bottom row
  802. '    parm(3) = column width  0=Calculated by the function (recommended)
  803. '    parm(4) = initial selected element #
  804. '    parm(5) = reset?  0=Subsequent call  Non-zero=Reset
  805. '
  806. 'Any column width specified in parm(3) will be increased by 2 to allow for
  807. ' spaces on either side of each item.  Allow for this when supplying this
  808. ' value.
  809. '
  810. 'parm(6 to 10) are special parameters, designating "hotkeys" that will return
  811. ' control to the calling procedure, and return a string of the key pressed
  812. ' along with the element number of the currently highlighted item.  If no
  813. ' hotkey is desired, merely pass a zero for that parameter.
  814. '
  815. 'To specify a one-byte INKEY$ code, merely pass the ASCII code of the key.
  816. ' If the key is a letter, pass the upper-case ASCII code.  To specify a two-
  817. ' byte key, pass the negative ASCII code of the second byte.
  818. '
  819. ' Examples:  To specify the backspace key, pass 8 ( CHR$(8) ).
  820. '            To specify the F1 key, pass -59 ( CHR$(0)+CHR$(59) ).
  821. '
  822. 'The string returned when a hotkey is pressed will consist of an asterisk
  823. ' followed by the hotkey code specified in the parm() array, a space, and the
  824. ' current element number.
  825. '
  826. ' Example: "*-59 4" would mean that the F1 key was pressed while element #4
  827. '          was highlighted.
  828. '
  829. 'When returning to the function after processing a hotkey, make sure that
  830. ' parm(4) is updated to reflect the current element, and parm(5) is zero.
  831. ' If calling the function for the first time, make sure parm(5) is non-zero.
  832. '
  833. '****************************************************************************
  834.  
  835.  
  836. FUNCTION PickSome$ (choice$(), tag(), parm())
  837. '****************************************************************************
  838. 'PickSome$() works just like the PickOne$() function but also allows for the
  839. ' tagging of multiple items.  See PickOne$() for general information about
  840. ' how these functions work.  Additional information on how the tagging works
  841. ' is described here.
  842. '
  843. '    parm(1) = top row
  844. '    parm(2) = bottom row
  845. '    parm(3) = column width  0=Calculated by the function (recommended)
  846. '    parm(4) = initial selected element #
  847. '    parm(5) = reset  0=Subsequent call  Non-zero=Reset
  848. '    parm(6) = tagging key  Default=32 (spacebar)
  849. '    parm(7) = tag all key  Default=-66 (F8)
  850. '    parm(8) = tag none key  Default=-67 (F9)
  851. '    parm(9) = switch tags key  Default=-68 (F10)
  852. '    parm(10) can be specified as another hotkey (see PickOne$())
  853. '
  854. 'The tagging keys specified by parm(6 to 9) may be disabled by passing -1.
  855. ' The default will be assigned if zero is passed.
  856. ' The tagging key will toggle an individual item's tag to on (1) or off (0).
  857. ' The tag all/tag none keys will set all items' tags to on/off respectively.
  858. ' The switch tags key will change all on tags to off, and all off tags to on.
  859. '
  860. 'The tag array must be an integer array with subscripts identical to the
  861. ' choice$() array.  You may pre-tag items or disable items in the array by
  862. ' setting elements of tag() to one of the following values:
  863. '
  864. '            0 = Untagged/Off   1 = Tagged/On   -1 = Disabled
  865. '
  866. 'If an item is disabled, it will be unaffected by any tagging operations and
  867. ' will appear in the dimmed color specified by parm(FGD) and/or parm(FGDS).
  868. '
  869. '****************************************************************************
  870.  
  871.  
  872. SUB PopBox (t, l, b, r, wide, msg$(), parm())
  873. '****************************************************************************
  874. 'This function is used by other pop-up box functions to zap the box onto the
  875. ' screen.  The procedure that calls this function must have its parm(3 & 4)
  876. ' arguments set up like so:
  877. '
  878. '    parm(3) = box border type 1-4
  879. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  880. '
  881. 'See EditBox(), PickBox(), and Progress() for examples of use.  ListBox() is
  882. ' not included because it doesn't have a msg$() array.
  883. '
  884. '****************************************************************************
  885.  
  886.  
  887. SUB Progress (cur, msg$(), parm()) STATIC
  888. '****************************************************************************
  889. 'Displays a percentage progress bar in a pop-up box.  The actual numeric
  890. ' progress is also shown.  The progress bar is updated in 5% increments.
  891. '
  892. '    parm(1) = top left row  0=Center
  893. '    parm(2) = top left column  0=Center
  894. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  895. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  896. '    parm(5) = maximum: (cur/maximum)*100 = percentage complete
  897. '
  898. 'The function has three different uses.  The first will draw the box on the
  899. ' screen.  The second usage will update the progress bar in the currently
  900. ' displayed box.  The third will remove the box from the screen.
  901. '
  902. 'The cur argument is used to indicate what you want Progress() to do:
  903. '
  904. '    0 = New box
  905. '   >0 = Update current box  (cur/maximum)*100 = %
  906. '   <0 = Remove box
  907. '
  908. 'Only one box may be on screen at any one time.  If you specify an operation
  909. ' that conflicts with the current status of the sub (like requesting a new
  910. ' box when there's already one up) nothing will happen.
  911. '
  912. 'Once the box is on screen, you should not do any PRINTing.  This should not
  913. ' be a problem, as the main usage for this function is for when some major
  914. ' processing is going on and you want the user to know that their computer
  915. ' is actually doing something.
  916. '
  917. 'Another feature of Progress() is the fact that it will always appear for at
  918. ' least 1.5 seconds.  Have you ever used a program & had some message flash
  919. ' by before you got a chance to read it?  Pretty annoying, isn't it.
  920. '
  921. '****************************************************************************
  922.  
  923.  
  924. SUB RestScreen (filename$)
  925. '****************************************************************************
  926. 'Restores a screen saved by SaveScreen().
  927. '
  928. 'You should only pass a filename that you know contains data created by the
  929. ' SaveScreen() sub.  I have no idea what would happen if you used any other
  930. ' kind of data.  Use at your own risk.  If you pass a filename that does not
  931. ' exist, a run-time error will occur.
  932. '
  933. '****************************************************************************
  934.  
  935.  
  936. FUNCTION Rinstr (start, search$, lookfor$)
  937. '****************************************************************************
  938. 'Kind of a "Reverse INSTR" (hence the name).  Returns the character position
  939. ' of the LAST occurrence of a substring within another.
  940. '
  941. 'If the start argument is greater than zero, search$ is truncated to
  942. ' (start-1) before the search begins (I would rather have called it "end" but
  943. ' that word is taken).  The start argument is especially useful for
  944. ' subsequent calls to Rinstr, i.e., to find the second-to-last occurrence,
  945. ' etc.
  946. '
  947. 'Examples:  Rinstr(0,"Peter Piper","er")  --> 10
  948. '           Rinstr(10,"Peter Piper","er") --> 4  (Searches "Peter Pip")
  949. '
  950. '****************************************************************************
  951.  
  952.  
  953. SUB Rise (text$, row, col)
  954. '****************************************************************************
  955. 'Prints text vertically on the screen, rising from the specified row and
  956. ' column position.  If the length of the text would continue above row 1,
  957. ' printing will stop at that point.  See also: SUB Drop()
  958. '
  959. '****************************************************************************
  960.  
  961.  
  962. SUB SaveScreen (filename$)
  963. '****************************************************************************
  964. 'Saves the current text screen to the specified binary file.  If the file
  965. ' already exists, it will be overwritten.
  966. '
  967. 'This function was only tested in text mode (SCREEN 0).  I have no idea what
  968. ' it would do in any other screen mode.  Use at your own risk.
  969. '
  970. '****************************************************************************
  971.  
  972.  
  973. FUNCTION SetCargo$ (c$) STATIC
  974. '****************************************************************************
  975. 'This is a general set/get function that operates on a string.  To query the
  976. ' current value of SetCargo$() without actually changing its value, pass
  977. ' CHR$(0) as the argument.
  978. '****************************************************************************
  979.  
  980.  
  981. FUNCTION SetCursor (cursortype) STATIC
  982. '****************************************************************************
  983. 'A set/get function for turning the cursor on and off and changing its
  984. ' appearance.
  985. '
  986. 'Be sure to include the SETCURS.INC in the calling program and use its
  987. ' constants as arguments to the function.
  988. '
  989. 'To inquire on the current setting without changing it, pass a negative
  990. ' number as an argument (or anything besides one of the defined constants).
  991. '
  992. '****************************************************************************
  993.  
  994.  
  995. SUB SetView (top, bot, parm()) STATIC
  996. '****************************************************************************
  997. 'Used to set the current text viewport (VIEW PRINT) and update the changes in
  998. ' the parm() array.
  999. '
  1000. 'To change the current viewport settings, pass the appropriate values in the
  1001. ' top and/or bot arguments.  Setting both values to zero will have the effect
  1002. ' of releasing the active VIEW PRINT setting and restoring the viewport to
  1003. ' the entire screen.
  1004. '
  1005. 'To reset the the viewport to the values currently stored in parm() without
  1006. ' changing either value, pass negative numbers for both arguments.
  1007. '
  1008. 'Examples:  SetView  0,  0, parm()  -->  Sets viewport to the entire screen.
  1009. '           SetView  4, 24, parm()  -->  Sets viewport to rows 4 through 24.
  1010. '           SetView  6,  0, parm()  -->  Updates the top row of the viewport
  1011. '                                         to 6, leaving the current value for
  1012. '                                         the bottom row unchanged.
  1013. '           SetView -1, -1, parm()  -->  Resets the viewport to the values
  1014. '                                         currently stored in parm() without
  1015. '                                         changing either value.
  1016. '
  1017. '****************************************************************************
  1018.  
  1019.  
  1020. SUB Slide (text$, lr, row, col, delay)
  1021. '****************************************************************************
  1022. 'Slides text onto the screen to the left or right starting at the specified
  1023. ' row and column.
  1024. '
  1025. 'The direction is determined by the argument lr, where a zero value equals
  1026. ' left, non-zero equals right.
  1027. '
  1028. 'delay is measured in 100ths of a second.
  1029. '
  1030. '****************************************************************************
  1031.  
  1032.  
  1033. SUB Spread (text$, row, col, delay)
  1034. '****************************************************************************
  1035. 'Spreads text on the screen in both directions starting from the specified
  1036. 'coordinates.  Delay is measured in 100ths of a second.
  1037. '****************************************************************************
  1038.  
  1039.  
  1040. FUNCTION Squeeze$ (orig$, char$)
  1041. '****************************************************************************
  1042. 'Removes all occurrences of a substring from within a string.
  1043. '
  1044. 'Example: Squeeze$("Peter Piper","er") --> "Pet Pip"
  1045. '
  1046. '****************************************************************************
  1047.  
  1048.  
  1049. FUNCTION Strip$ (orig$, side, char$)
  1050. '****************************************************************************
  1051. 'Strips leading and/or trailing characters from a string.  It works like
  1052. ' LTRIM$() and RTRIM$() but on other characters in addition to spaces.
  1053. '
  1054. 'The side argument is passed in one of the following ways:
  1055. '
  1056. '    <0 = Strip the left side
  1057. '     0 = Strip both sides
  1058. '    >0 = Strip the right side
  1059. '
  1060. 'Combinations of characters can also be stripped from each side as well as
  1061. ' individual characters.  In this case, the length of char$ would be greater
  1062. ' than one.  The characters to be stripped ARE case sensitive.
  1063. '
  1064. 'Examples:     Strip$("00100",-1, "0")  -->  "100"
  1065. '              Strip$("AABAa", 0, "A")  -->  "BAa"
  1066. '              Strip$("00100", 0, "0")  -->  "1"
  1067. '              Strip$("     ", 0, " ")  -->  ""
  1068. '              Strip$("ABCDE", 0, "AB") -->  "CDE"
  1069. '              Strip$("ABCDE", 1, "AB") -->  "ABCDE"
  1070. '
  1071. '****************************************************************************
  1072.  
  1073.  
  1074. FUNCTION Stuff$ (orig$, position, delnum, char$)
  1075. '****************************************************************************
  1076. 'Inserts and/or deletes character(s) in(to) a string at the specified
  1077. ' character position.  Very simple, but very useful.
  1078. '
  1079. 'The position argument tells the function where to start its operations upon
  1080. ' the original.
  1081. '
  1082. 'The delnum argument tells it how many (if any) characters to delete starting
  1083. ' at that position.
  1084. '
  1085. 'The value of char$ determines what gets put into the string at position.  If
  1086. ' null, nothing will get put in, effectively deleting characters from within
  1087. ' the string.
  1088. '
  1089. 'Examples: Stuff$("QBasic",2,0,"uick") --> "QuickBasic" (Adds characters)
  1090. '          Stuff$("Landlocked",5,4,"") --> "Landed"     (Deletes characters)
  1091. '          Stuff$("Trifle",4,1,"bb")   --> "Tribble"    (Replaces characters)
  1092. '
  1093. 'Specifying a delnum of zero and a null char$ will do nothing.
  1094. '
  1095. '****************************************************************************
  1096.  
  1097.  
  1098. SUB TeleType (text$, delay)
  1099. '****************************************************************************
  1100. 'Prints text one character at a time beginning at the current cursor location.
  1101. '
  1102. 'The delay between each character being printed is measured in 1/100ths of a
  1103. ' second (a delay of 100 would equal one second).  If a value of zero or less
  1104. ' is specified, the delay defaults to 5/100ths of a second.  If a key is
  1105. ' pressed during the SUB, the remainder of the string is printed without any
  1106. ' delay.
  1107. '
  1108. 'You could easily add some sound to this procedure.  I recommend using SOUND
  1109. ' 20000,1 after each letter except spaces and a delay of at least 7.
  1110. '
  1111. '****************************************************************************
  1112.  
  1113.  
  1114. FUNCTION TempName$ (path$) STATIC
  1115. '****************************************************************************
  1116. 'Used to create a temporary filename.  The filename will reside in the
  1117. ' specified path, or in the current directory if path$ is null.
  1118. '
  1119. 'The path$ argument may be passed with or without a trailing backslash.
  1120. '
  1121. 'The filename will consist of a leading underscore, the current value of the
  1122. ' system timer, and an extension of ".TMP".
  1123. '
  1124. 'This standardized naming of temporary files will make it easy to delete any
  1125. ' leftover temporary files all at once with a wildcard.
  1126. '
  1127. '    Example filenames:  _4573921.TMP   _230117.TMP
  1128. '
  1129. '    Example deletion command:  KILL "_*.TMP"
  1130. '
  1131. 'The filename given by TempName$() is stored in a static variable in case the
  1132. ' function is called more than once in the same 100th of a second (It's not
  1133. ' as unlikely as you think).  This allows you to get two or more temporary
  1134. ' filenames without having to create each one before getting the next one.
  1135. ' The function can produce about 20 filenames per second when called in
  1136. ' rapid succession.  When called normally (once), I was unable to measure the
  1137. ' time it took.
  1138. '
  1139. 'See function HomePath$() for an example of use.
  1140. '
  1141. '****************************************************************************
  1142.  
  1143.  
  1144. FUNCTION VPage (p) STATIC
  1145. '****************************************************************************
  1146. 'This function is used to allocate and release pages of video memory.
  1147. '
  1148. 'To request (allocate) a page, pass zero as the argument.  The function will
  1149. ' return the page number that has been allocated, or zero if none are left.
  1150. '
  1151. 'To release a video page when your procedure is finished with it, pass the
  1152. ' page number as the argument to the function.  The function will note the
  1153. ' page as being available, and will return zero.
  1154. '
  1155. 'The reason behind the function is so that procedures that need to use or
  1156. ' swap video pages can do so without fear of using a page that may already
  1157. ' be in use by another procedure.
  1158. '
  1159. 'The function doesn't actually do anything at all with video pages.  It
  1160. ' merely keeps track of a small array that remembers which pages are in use.
  1161. '
  1162. 'NOTE: This function assumes VGA video with 8 pages (0-7) of video memory for
  1163. ' screen mode 0.  It also assumes that page 0 is always in use, and does not
  1164. ' bother to keep track of it.
  1165. '
  1166. 'See function ColorSet() or any of the pop-up box functions for examples of
  1167. ' use.
  1168. '
  1169. '****************************************************************************
  1170.  
  1171.  
  1172. SUB Wipe (row)
  1173. '****************************************************************************
  1174. 'Clears a row on the screen.
  1175. '****************************************************************************
  1176.  
  1177.  
  1178. SUB WipeArea (row1, col1, row2, col2)
  1179. '****************************************************************************
  1180. 'Clears an area of the screen.
  1181. '****************************************************************************
  1182.  
  1183.  
  1184. FUNCTION YesNo (msg$(), yesword$, noword$, parm())
  1185. '****************************************************************************
  1186. 'Works like PickBox() but returns TRUE if the yes option is selected or FALSE
  1187. ' if the no option is selected or ESC is pressed.
  1188. '
  1189. '    parm(1) = top left row  0=Center
  1190. '    parm(2) = top left column  0=Center
  1191. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  1192. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  1193. '    parm(5) = initial selected choice as TRUE or FALSE
  1194. '
  1195. 'The function defaults to the words " Yes " and " No ".  If these are what
  1196. ' you want, pass null strings for the optional words.  Common alternatives
  1197. ' might be " Ok " and " Cancel ".
  1198. '
  1199. 'See function PickBox() for more detailed information.
  1200. '
  1201. '****************************************************************************
  1202.  
  1203.  
  1204. FUNCTION YesNo2 (msg$, yesword$, noword$, parm())
  1205. '****************************************************************************
  1206. 'Works like YesNo() but accepts a single message string rather than an array.
  1207. '
  1208. '    parm(1) = top left row  0=Center
  1209. '    parm(2) = top left column  0=Center
  1210. '    parm(3) = box border type 1-4.  See SUB Panes() for numeric boxtypes.
  1211. '    parm(4) = message justification  <0=Left  0=Center  >0=Right
  1212. '    parm(5) = initial selected choice as TRUE or FALSE
  1213. '
  1214. 'See functions YesNo() and PickBox() for more detailed information.
  1215. '
  1216. '****************************************************************************
  1217.  
  1218.