Author Topic: illeagal function call i dont know why  (Read 1919 times)

0 Members and 1 Guest are viewing this topic.

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
illeagal function call i dont know why
« on: October 20, 2020, 04:31:19 pm »
Hello

This is my entire app at the moment. Please Excuse the rem statements do to a problem i have with my eyes i need to do this to keep the sections of the software from running together.

Problem any time you enter value that is longer then expected it gives an error message (this works) but when i exit the error routine i get an illeagal function call. On the main menu just type in 2 or more chars and hit enter and you will get this error. Please if you would run the code see the message and if you can sort through the code give me a reason why this is going on.

Thanks in advance
Badger
Code: QB64: [Select]
  1. REM ***************************************************************************
  2. REM **** Program Bridal Store *************************************************
  3. REM ***************************************************************************
  4. REM ***************************************************************************
  5. REM **** Author Philip King  **************************************************
  6. REM ***************************************************************************
  7. REM ***************************************************************************
  8. REM ***************************************************************************
  9. REM **** Includes go here *****************************************************
  10. REM ***************************************************************************
  11.  
  12. REM ***************************************************************************
  13. REM ***************************************************************************
  14. REM **** Sreen statements here ************************************************
  15. REM ***************************************************************************
  16. REM ***************************************************************************
  17.  
  18. REM ***************************************************************************
  19. REM **** defines for quick use data types *************************************
  20. REM ***************************************************************************
  21. REM ***************************************************************************
  22.  
  23. REM ***************************************************************************
  24. REM **** Listing of subs and funtions *****************************************
  25. REM ***************************************************************************
  26.  
  27. REM ***************************************************************************
  28.  
  29. REM ***************************************************************************
  30. REM **** arrays decleared here ************************************************
  31. REM ***************************************************************************
  32. imenu = 4
  33. DIM SHARED smenu(imenu) AS STRING
  34. REM ***************************************************************************
  35.  
  36. REM ***************************************************************************
  37. REM **** arrays set to data here **********************************************
  38. REM ***************************************************************************
  39. smenu(1) = "1) Edit Customer Info": smenu(2) = "3) Edit Inventory Data "
  40. smenu(3) = "2) Edit Sales ": smenu(4) = "4) System Maintenance "
  41. REM ***************************************************************************
  42.  
  43. REM ***************************************************************************
  44. REM **** variables declares go here *******************************************
  45. REM ***************************************************************************
  46. CONST null = ""
  47. DIM SHARED zrecordnum
  48. DIM SHARED lrecordlen
  49. DIM shomedir AS STRING
  50. shomedir = _CWD$
  51. REM ***************************************************************************
  52.  
  53. REM ***************************************************************************
  54. REM **** customer info record type ********************************************
  55. REM ***************************************************************************
  56. TYPE customer
  57.     id AS STRING * 10
  58.     sfirst_name AS STRING * 25
  59.     slast_name AS STRING * 25
  60.     saddress AS STRING * 30
  61.     scity AS STRING * 25
  62.     sstate AS STRING * 2
  63.     szip AS STRING * 5
  64.     sphone AS STRING * 10
  65.     sdesc AS STRING * 10
  66.     sfiller AS STRING * 114
  67. REM ***************************************************************************
  68.  
  69. REM ***************************************************************************
  70. REM **** inventory record type ************************************************
  71. REM ***************************************************************************
  72. TYPE inventory
  73.     id AS STRING * 10
  74.     sdesc AS STRING * 10
  75.     sdate_bought AS STRING * 8
  76.     sdate_sold AS STRING * 8
  77.     scost AS STRING * 15
  78.     sretail AS STRING * 15
  79.     ssize AS STRING * 2
  80.     ssold AS STRING * 1
  81.     squanity AS STRING * 2
  82.     sfiller AS STRING * 57
  83. REM ***************************************************************************
  84.  
  85. REM ***************************************************************************
  86. REM **** system data file record **********************************************
  87. REM ***************************************************************************
  88. TYPE systemdat
  89.     sdata0 AS STRING * 64 '   data path for customer discription files
  90.     sdata1 AS STRING * 64 '   data path for inventory discription files
  91.     sdata2 AS STRING * 64 '   data path for pos discription files
  92.     sdbpath AS STRING * 64 '  data path for database files
  93. REM ***************************************************************************
  94.  
  95. REM ***************************************************************************
  96. REM **** point of sale type ***************************************************
  97. REM ***************************************************************************
  98. TYPE sposlposid
  99.     sposid AS STRING * 10
  100. REM ***************************************************************************
  101. DIM SHARED scustinforec AS customer
  102. DIM SHARED systemrec AS systemdat
  103. DIM SHARED sinventoryrec AS inventory
  104. linventorylen = LEN(sinventoryrec)
  105. lcustreclen = LEN(scustinforec)
  106. lsystemreclen = LEN(systemrec)
  107. REM ***************************************************************************
  108.  
  109. REM ***************************************************************************
  110. REM **** metadata commands ****************************************************
  111. REM ***************************************************************************
  112. $VERSIONINFO:CompanyName=Joyces Bridal
  113. $VERSIONINFO:ProductName=Joyce Bridal
  114. $VERSIONINFO:ProductVersion=1.0
  115. $VERSIONINFO:LegalCopyright=10/8/2020
  116. '$VERSIONINFO:
  117. REM ***************************************************************************
  118.  
  119. 'scv = _OS$
  120. GOSUB dircheck
  121. 'IF isysflag = 0 THEN GOTO sys0
  122. GOTO main
  123. REM ***************************************************************************
  124.  
  125. REM ***************************************************************************
  126. REM **** main menu loop *******************************************************
  127. REM ***************************************************************************
  128. menuloop:
  129. GOSUB systemheader
  130. GOSUB printmain
  131. GOSUB mainmenuchoice
  132. IF sr = "" OR sr = CHR$(13) THEN GOTO menuloop
  133. IF sr = "X" THEN END
  134. IF sr = "1" THEN
  135.     CLS
  136.     GOSUB scustinforec_null
  137.     sunit = "Customer Information Maintenance"
  138.     GOSUB systemheader
  139.     GOSUB s0
  140. IF sr = "3" THEN
  141.     CLS
  142.     GOSUB inventoryrec_null
  143.     sunit = "Inventory Information Maintenance"
  144.     GOSUB systemheader
  145.     GOSUB inv0
  146.  
  147. IF sr = "4" THEN
  148.     GOSUB systemdat_null
  149.     sunit = "System Information Maintenance"
  150.     GOSUB systemheader
  151.     GOSUB sys0
  152. REM ***************************************************************************
  153.  
  154. REM ***************************************************************************
  155. REM **** fix computer svc to show no [] in print ******************************
  156. REM ***************************************************************************
  157. svcfix:
  158. svc = _OS$
  159. itemp = LEN(svc)
  160. FOR ix = 1 TO itemp
  161.     IF MID$(svc, ix, 1) = "[" THEN
  162.         MID$(svc, ix, 1) = " "
  163.     END IF
  164.     IF MID$(svc, ix, 1) = "]" THEN
  165.         MID$(svc, ix, 1) = " "
  166.     END IF
  167. NEXT ix
  168. stemp = LTRIM$(LEFT$(svc, 2)) + LCASE$(MID$(svc, 3, 7)) + LTRIM$(MID$(svc, 9, 4)) + " " + MID$(svc, 13, 1)
  169. stemp = stemp + RTRIM$(LCASE$(RIGHT$(svc, 3)))
  170. svc = stemp
  171. REM ***************************************************************************
  172.  
  173. REM ***************************************************************************
  174. REM **** Sytem Header *********************************************************
  175. REM ***************************************************************************
  176. systemheader:
  177. COLOR White, Blue
  178. LOCATE 1, 1: PRINT CHR$(201): LOCATE 1, 80: PRINT CHR$(187)
  179. LOCATE 1, 2: PRINT STRING$(78, 205):
  180. FOR ix = 2 TO 7
  181.     LOCATE ix, 1: PRINT CHR$(186)
  182.     LOCATE ix, 80: PRINT CHR$(186)
  183. NEXT ix
  184. LOCATE 7, 2: PRINT STRING$(78, 205)
  185. LOCATE 7, 1: PRINT CHR$(200): LOCATE 7, 80: PRINT CHR$(188)
  186. LOCATE 4, 30: PRINT "Main System Menu"
  187. LOCATE 4, 63: PRINT "Date ": LOCATE 4, 68: PRINT DATE$
  188. GOSUB svcfix
  189. LOCATE 4, 4: PRINT svc
  190. iten = LEN(sunit)
  191. LOCATE 6, (40 - (iten \ 2)): PRINT sunit
  192.  
  193. REM ***************************************************************************
  194.  
  195. REM ***************************************************************************
  196. REM **** printes in system erros **********************************************
  197. REM ***************************************************************************
  198. sprintserrors:
  199. IF se = "" THEN se = "INVALID RESPONSE"
  200. itemp = LEN(se)
  201. itemp1 = 40 - (itemp / 2)
  202. COLOR 16, 7
  203. LOCATE 25, itemp1: _BLINK ON: PRINT se;
  204. idelay = 1.5
  205. CALL Delay(1.5)
  206. iflag2 = 1
  207. REM ***************************************************************************
  208.  
  209. REM ***************************************************************************
  210. REM **** numeric input sub ****************************************************
  211. REM ***************************************************************************
  212. snumeric:
  213. ftemp = VAL(sr)
  214. IF ftemp < ilow OR ftemp > ihigh THEN
  215.     se = "INPUT OUT OF BOUNDS"
  216.     GOSUB sprintserrors
  217. REM ***************************************************************************
  218.  
  219. REM ***************************************************************************
  220. REM **** alpha input sub ******************************************************
  221. REM ***************************************************************************
  222. salphainput:
  223. iflag2 = 0
  224. ilength1 = LEN(sr)
  225. ilength2 = LEN(saction) + 2
  226. LOCATE 23, 1: PRINT saction; '               prints action menu
  227. LOCATE 23, ilength2 '                        set prompt one space after action menu print
  228. COLOR Yellow, Black: PRINT SPC(ib); '        changes color and prints ib spaces to screen for input lenght
  229. LOCATE 23, ilength2 '                        sets curser at the begining of input space from previouse line
  230. LINE INPUT sr: sr = UCASE$(sr) '             inputs data from user changes it to upper case
  231. IF LEN(sr) > ib THEN
  232.     se = "INVALID INPUT LENGTH"
  233.     GOSUB sprintserrors
  234.     sr = ""
  235.     iflag2 = 1
  236.     GOTO salphainput
  237. IF sr = "X" AND iflag1 = 1 THEN iflag1 = 0
  238. IF iflag1 = 1 AND VAL(sr) < ilow AND VAL(sr) > ihigh THEN GOSUB snumeric
  239. COLOR White, Blue
  240. REM ***************************************************************************
  241.  
  242. REM ***************************************************************************
  243. REM **** main menu to the screen **********************************************
  244. REM ***************************************************************************
  245. printmain:
  246. COLOR White, Blue
  247. FOR ix = 11 TO imenu
  248.     READ smenu(ix): LOCATE ix, 20: PRINT smenu(ix)
  249. NEXT ix
  250. LOCATE 11, 15: PRINT smenu(1)
  251. LOCATE 11, 40: PRINT smenu(2)
  252. LOCATE 13, 15: PRINT smenu(3)
  253. LOCATE 13, 40: PRINT smenu(4)
  254. REM ***************************************************************************
  255.  
  256. REM ***************************************************************************
  257. REM **** menu prompts start here **********************************************
  258. REM ***************************************************************************
  259. mainmenuchoice:
  260. ib = 1
  261. ihigh = 99
  262. ilow = 1
  263. saction = "Choose Menu Option or X to Quit "
  264. GOSUB salphainput
  265. REM ***************************************************************************
  266.  
  267. REM ***************************************************************************
  268. REM **** clean up the prompt area *********************************************
  269. REM ***************************************************************************
  270. clearprompt:
  271. LOCATE 23, 1: PRINT STRING$(79, 32)
  272. REM ***************************************************************************
  273.  
  274. REM ***************************************************************************
  275. REM **** set custinforrec variables to zero or null ***************************
  276. REM ***************************************************************************
  277. scustinforec_null:
  278. scustinforec.id = null
  279. scustinforec.sfirst_name = null
  280. scustinforec.slast_name = null
  281. scustinforec.saddress = null
  282. scustinforec.scity = null
  283. scustinforec.sstate = null
  284. scustinforec.szip = null
  285. scustinforec.sphone = null
  286. REM ***************************************************************************
  287.  
  288. REM ***************************************************************************
  289. REM **** set inventoryrec variables to zero or null ***************************
  290. REM ***************************************************************************
  291. inventoryrec_null:
  292. sinventory.id = null
  293. sinventory.sdesc = null
  294. sinventory.sdate_bought = null
  295. sinventory.sdate_sold = null
  296. sinventory.scost = null
  297. sinventory.fretail = null
  298. sinventory.ssize = null
  299. sinventory.ssold = null
  300. REM ***************************************************************************
  301. REM **** set systemrec variagles to zero or null*******************************
  302. REM ***************************************************************************
  303. systemdat_null:
  304. systemdat.sspath = null
  305. systemdat.sdata1 = null
  306. systemdat.sdata2 = null
  307. systemdat.sdata3 = null
  308. REM ***************************************************************************
  309.  
  310. REM ***************************************************************************
  311. REM **** opens random files ***************************************************
  312. REM ***************************************************************************
  313. randomfiles:
  314. sdbpath = shomedir + "\data\db\"
  315. OPEN sdbpath + "jbridal.db" FOR RANDOM AS #1 LEN = lcustreclen
  316. OPEN sdbpath + "system.db" FOR RANDOM AS #4 LEN = lsystemreclen
  317. OPEN sdbpath + "inventory.db" FOR RANDOM AS #3 LEN = linventorylen
  318. zsystemrecnum = LOF(4) / lsystemreclen
  319. REM ***************************************************************************
  320.  
  321. REM ***************************************************************************
  322. REM **** inserts record into random file **************************************
  323. REM ***************************************************************************
  324. insertrec:
  325. SELECT CASE ifilenum
  326.     CASE 1
  327.         PUT #1, zcustrecnum, scustinforec
  328.     CASE 3
  329.  
  330.         PUT #3, zinventorynum, sinventoryrec
  331. REM ***************************************************************************
  332.  
  333. REM ***************************************************************************
  334. REM **** get last file index for indexing *************************************
  335. REM ***************************************************************************
  336.  
  337. autoindex:
  338. zinventorynum = 0
  339. SELECT CASE ifilenum
  340.     CASE 1:
  341.         zcustrecnum = LOF(1) / lcustreclen
  342.         zcustrecnum = zcustrecnum + 1
  343.         sindex = LTRIM$(STR$(zcustrecnum))
  344.         IF LEN(sindex) < 9 THEN
  345.             sindex = STRING$(9 - LEN(sindex), 48) + sindex
  346.             scustinforec.id = sindex
  347.         END IF
  348.     CASE 3:
  349.         zinventorynum = LOF(3) / linventorylen
  350.         zinventorynum = zinventorynum + 1
  351.         sindex = LTRIM$(STR$(zinventorynum))
  352.         IF LEN(sindex) < 9 THEN
  353.             sindex = STRING$(9 - LEN(sindex), 48) + sindex
  354.             sinventoryrec.id = sindex
  355.  
  356.         END IF
  357.  
  358.  
  359. REM ***************************************************************************
  360.  
  361. REM ***************************************************************************
  362. REM **** shell for notepad for description files by inventory number **********
  363. REM ***************************************************************************
  364. descinput:
  365. sdbtemp = LTRIM$(RTRIM$(sdata)) + LTRIM$(RTRIM$(sdesc)) + ".txt"
  366. ifileexists = _FILEEXISTS(sdbtemp)
  367. IF ifileexists = -1 THEN
  368.     SHELL "wordpad " + CHR$(34) + sdbtemp + CHR$(34)
  369.     OPEN sdbtemp FOR OUTPUT AS #6
  370.     PRINT #6, "Type in your stuff. Save the file and exit."
  371.     CLOSE #6
  372.     SHELL "wordpad " + CHR$(34) + sdbtemp + CHR$(34)
  373. REM ***************************************************************************
  374.  
  375. REM ***************************************************************************
  376. REM **** main modual **********************************************************
  377. REM ***************************************************************************
  378. main:
  379. GOSUB randomfiles
  380. SCREEN _NEWIMAGE(640, 400, 32)
  381. COLOR LightCyan, MidnightBlue
  382. iflag2 = 0
  383. iflag3 = 0
  384. REM ***************************************************************************
  385. mainloop:
  386. GOSUB menuloop:
  387.     CASE "1":
  388.         sdata = shomedir + "\data\custdesc\"
  389.         ifilenum = 1
  390.         GOSUB scustinforec_null
  391.         GOSUB autoindex
  392.         GOSUB s1
  393.         GOTO mainloop
  394.     CASE "2"
  395.         sdata = shomedir + "\data\posdesc\"
  396.         'IF sr = "2" THEN
  397.         'ifilenum = 2
  398.         'GOSUB inventoryrec_null
  399.         'GOSUB inv1
  400.         'GOTO mainloop
  401.         'END IF
  402.  
  403.     CASE "3":
  404.         sdata = shomedir + "\data\invdesc\"
  405.         ifilenum = 3
  406.         GOSUB inventoryrec_null
  407.         GOSUB autoindex
  408.         sinventoryrec.scost = "0.00"
  409.         sinventoryrec.sretail = "0.00"
  410.         GOSUB inv1
  411.         GOTO mainloop
  412.  
  413.     CASE "4":
  414.         'sdb =  shomedir + "\data\custdesc"
  415.         'ifilenum = 4
  416.         ' GOSUB systemdat_null
  417.         ' GOSUB sys1
  418.         ' GOTO mainloop
  419.  
  420. REM ***************************************************************************
  421.  
  422. REM ***************************************************************************
  423. REM **** check for statup directories *****************************************
  424. REM ***************************************************************************
  425. dircheck:
  426.     CASE -1:
  427.         GOTO dirchk1
  428.     CASE 0:
  429.         BEEP
  430.         CLS
  431.         LOCATE 12, 27
  432.         PRINT "Home Director Does not Exists"
  433.         LOCATE 13, 23: PRINT "Please Create Jbridal in Your Home dir"
  434.         LOCATE 14, 30: PRINT "And Rerun The program"
  435.         LOCATE 16, 32: PRINT "Enter to continue"
  436.         LINE INPUT st
  437.         CLOSE
  438.         END
  439.  
  440. dirchk1:
  441.  
  442. iflag = _DIREXISTS(shomedir + "\data")
  443. IF iflag = 0 THEN MKDIR shomedir + "\data"
  444.  
  445. iflag = _DIREXISTS(shomedir + "\data\db")
  446. IF iflag = 0 THEN MKDIR shomedir + "\data\db"
  447.  
  448. iflag = _DIREXISTS(shomedir + "\data\custdesc")
  449. IF iflag = 0 THEN MKDIR shomedir + "\data\custdesc"
  450.  
  451. iflag = _DIREXISTS(shomedir + "\data\invdesc")
  452. IF iflag = 0 THEN MKDIR shomedir + "\data\invdesc"
  453.  
  454. iflag = _DIREXISTS(shomedir + "\data\posdesc")
  455. IF iflag = 0 THEN MKDIR shomedir + "\data\posdesc"
  456. REM ***************************************************************************
  457. REM ***************************************************************************
  458. REM **** system utilities data entry ******************************************
  459. REM ***************************************************************************
  460. sys0:
  461. LOCATE 10, 1: PRINT "Customer Discription File Path  ";: PRINT systemdat.sdata0 = _CWD$
  462. LOCATE 11, 1: PRINT "Inventory Discription File Path ";: PRINT systemdat.sdata1
  463. LOCATE 12, 1: PRINT "Pos Discription File Path       ";: PRINT systemdat.sdata2
  464. LOCATE 13, 1: PRINT "Enter Path For Databases        ";: PRINT systemdat.sdbpath
  465. REM ***************************************************************************
  466. sys1:
  467. saction = "Customer Disc File Path "
  468. ib = 64
  469. ilow = 1
  470. ihigh = 1
  471. iflag1 = 0
  472. GOSUB clearprompt
  473. GOSUB salphainput
  474. IF sr = "" THEN GOTO sys1
  475. IF sr = CHR$(88) THEN RETURN 'X
  476. systemdat.sdata0 = sr
  477. GOSUB sys0
  478. GOTO sys2
  479. REM ***************************************************************************
  480.  
  481. sys2:
  482. saction = "Inventory Disc File Path "
  483. ib = 64
  484. ilow = 1
  485. ihigh = 1
  486. iflag1 = 0
  487. GOSUB clearprompt
  488. GOSUB salphainput
  489. IF sr = "" THEN GOTO sys2
  490. IF sr = CHR$(88) THEN RETURN 'X
  491. systemdat.sdata1 = sr
  492. GOSUB sys0
  493. GOTO sys2
  494. REM ***************************************************************************
  495. sys3:
  496. saction = "POS Disc File Path "
  497. ib = 64
  498. ilow = 1
  499. ihigh = 1
  500. iflag1 = 0
  501. GOSUB clearprompt
  502. GOSUB salphainput
  503. IF sr = "" THEN GOTO sys3
  504. IF sr = CHR$(88) THEN RETURN 'X
  505. systemdat.sdata2 = sr
  506. GOSUB sys0
  507. GOTO sys4
  508. REM ***************************************************************************
  509. sys4:
  510. saction = "Enter Database File Path "
  511. ib = 64
  512. ilow = 1
  513. ihigh = 1
  514. iflag1 = 0
  515. GOSUB clearprompt
  516. GOSUB salphainput
  517. IF sr = "" THEN GOTO sys3
  518. IF sr = CHR$(88) THEN RETURN 'X
  519. systemdat.sdbpath = sr
  520. GOSUB sys0
  521. GOTO sys4
  522. REM ***************************************************************************
  523.  
  524. REM ***************************************************************************
  525. REM ***************************************************************************
  526. REM **** inventory input modual ***********************************************
  527. REM ***************************************************************************
  528. inv0:
  529. LOCATE 10, 1: PRINT "Inventory Number         ";: PRINT sinventoryrec.id
  530. LOCATE 11, 1: PRINT "Description File Name    ";: PRINT sinventoryrec.sdesc
  531. LOCATE 12, 1: PRINT "Date Purchased           ";
  532. PRINT LEFT$(sinventoryrec.sdate_bought, 2) + "/";
  533. PRINT MID$(sinventoryrec.sdate_bought, 3, 2) + "/";
  534. PRINT RIGHT$(sinventoryrec.sdate_bought, 4)
  535. LOCATE 13, 1: PRINT "Date Sold                ";
  536. PRINT LEFT$(sinventoryrec.sdate_sold, 2) + "/";
  537. PRINT MID$(sinventoryrec.sdate_sold, 3, 2) + "/";
  538. PRINT RIGHT$(sinventoryrec.sdate_sold, 4)
  539.  
  540. LOCATE 14, 1: PRINT "Coste of Item            ";: PRINT sinventoryrec.scost
  541. LOCATE 15, 1: PRINT "Retail Price             ";: PRINT sinventoryrec.sretail
  542. LOCATE 16, 1: PRINT "Size Of Item             ";: PRINT sinventoryrec.ssize
  543. LOCATE 17, 1: PRINT "Remove for Inventory Y/N ";: PRINT sinventoryrec.ssold
  544. LOCATE 18, 1: PRINT "Enter Quanity of Item    ";: PRINT sinventoryrec.squanity
  545. REM ***************************************************************************
  546. inv1:
  547. GOSUB inv0
  548. GOTO inv2
  549. REM ***************************************************************************
  550. inv2:
  551. saction = "Enter D for Default, Type Name, X to Exit - To Backup "
  552. ib = 8
  553. ilow = 1
  554. ihigh = 999999999
  555. iflag1 = 0
  556. GOSUB clearprompt
  557. GOSUB salphainput
  558.     CASE CHR$(88): RETURN 'X
  559.         'CASE CHR$(45): GOTO inv2 '-
  560.     CASE "":
  561.         sinventoryrec.sdesc = sinventoryrec.id
  562.         sdesc = sinventoryrec.id
  563.         GOSUB descinput
  564.         GOSUB inv0
  565.         GOTO inv3
  566.  
  567.     CASE CHR$(68): 'D for using the sinventoryrec.id as the file name
  568.         sinventoryrec.sdesc = sinventoryrec.id
  569.         sdesc = sinventoryrec.id
  570.         GOSUB descinput
  571.         GOSUB inv0
  572.         GOTO inv3
  573.     CASE ELSE
  574.         sinventoryrec.sdesc = sr
  575.         sdesc = sr
  576.         GOSUB descinput
  577.         GOSUB inv0
  578.         GOTO inv3
  579. REM ***************************************************************************
  580. inv3:
  581. saction = "Enter Date Bought X to Exit - To Backup "
  582. ib = 8
  583. ilow = 1
  584. ihigh = 999999999
  585. iflag1 = 0
  586. GOSUB clearprompt
  587. GOSUB salphainput
  588.     CASE CHR$(88): RETURN 'X
  589.     CASE CHR$(45): GOTO inv2 '-
  590.     CASE "": GOTO inv4 ' key or ""
  591.     CASE ELSE
  592.         sinventoryrec.sdate_bought = sr
  593.         GOSUB inv0
  594.         GOTO inv4
  595.  
  596. REM ***************************************************************************
  597. inv4:
  598. saction = "Enter Date Sold X to Exit - To Backup "
  599. ib = 8
  600. ilow = 1
  601. ihigh = 999999999
  602. iflag1 = 0
  603. GOSUB clearprompt
  604. GOSUB salphainput
  605.     CASE CHR$(88): RETURN 'X
  606.     CASE CHR$(45): GOTO inv2 '-
  607.     CASE "": GOTO inv5 ' ""
  608.     CASE ELSE
  609.         GOSUB inventoryrec_null
  610.         sinventoryrec.sdate_sold = sr
  611.         GOSUB inv0
  612.         GOTO inv5
  613.  
  614. REM ***************************************************************************
  615. inv5:
  616. saction = "Enter Cost X to Exit - To Backup "
  617. ib = 15
  618. ilow = 1
  619. ihigh = 999999999
  620. iflag1 = 0
  621.  
  622. GOSUB clearprompt
  623. GOSUB salphainput
  624.     CASE CHR$(88): RETURN 'X
  625.     CASE CHR$(45): GOTO inv4 '-
  626.     CASE "": GOTO inv6 '  ""
  627.     CASE ELSE
  628.         GOSUB inventoryrec_null
  629.         sinventoryrec.scost = sr
  630.         GOSUB inv0
  631.         GOTO inv6
  632. REM ***************************************************************************
  633. inv6:
  634. saction = "Enter Retail Price X to Exit - To Backup "
  635. ib = 15
  636. ilow = 1
  637. ihigh = 999999999
  638. iflag1 = 0
  639. GOSUB clearprompt
  640. GOSUB salphainput
  641.     CASE CHR$(88): RETURN 'X
  642.     CASE CHR$(45): GOTO inv5 '-
  643.     CASE "": GOTO inv7 '  ""
  644.     CASE ELSE
  645.         GOSUB inventoryrec_null
  646.         sinventoryrec.sretail = sr
  647.         GOSUB inv0
  648.         GOTO inv7
  649.  
  650. REM ***************************************************************************
  651. inv7:
  652. saction = "Enter Dress Size X to Exit - To Backup "
  653. ib = 2
  654. ilow = 1
  655. ihigh = 999999999
  656. iflag1 = 0
  657. GOSUB clearprompt
  658. GOSUB salphainput
  659.     CASE CHR$(88): RETURN 'X
  660.     CASE CHR$(45): GOTO inv6 '-
  661.     CASE "": GOTO inv8 ' ""
  662.     CASE ELSE
  663.         GOSUB inventoryrec_null
  664.         sinventoryrec.ssize = sr
  665.         GOSUB inv0
  666.         GOTO inv8
  667. REM ***************************************************************************
  668. inv8:
  669. saction = "Did Dress Sale Y/N X to Exit - To Backup "
  670. ib = 1
  671. ilow = 1
  672. ihigh = 999999999
  673. iflag1 = 0
  674. GOSUB clearprompt
  675. GOSUB salphainput
  676.     CASE CHR$(88): RETURN 'X
  677.     CASE CHR$(45): GOTO inv7 '-
  678.     CASE "": GOTO inv8
  679.     CASE ELSE
  680.         GOSUB inventoryrec_null
  681.         sinventoryrec.ssold = sr
  682.         GOSUB inv0
  683.         GOTO inv9
  684. REM ***************************************************************************
  685. inv9:
  686. saction = "Enter Quanity of Inventory X to Exit - To Backup "
  687. ib = 4
  688. ilow = 1
  689. ihigh = 999999999
  690. iflag1 = 0
  691. GOSUB clearprompt
  692. GOSUB salphainput
  693.     CASE CHR$(88): RETURN 'X
  694.     CASE CHR$(45): GOTO inv8 '-
  695.     CASE "": GOTO puttorecord ' ""
  696.     CASE ELSE
  697.         GOSUB inventoryrec_null
  698.         sinventoryrec.squanity = sr
  699.         GOSUB inv0
  700.         GOTO puttorecord
  701. REM ***************************************************************************
  702. REM ***************************************************************************
  703. REM ***************************************************************************
  704. REM **** customer input modual ************************************************
  705. REM ***************************************************************************
  706. s0:
  707. LOCATE 10, 1: PRINT "Customer ID           ";: PRINT scustinforec.id
  708. LOCATE 11, 1: PRINT "Customer First Name   ";: PRINT scustinforec.sfirst_name
  709. LOCATE 12, 1: PRINT "customer Last Name    ";: PRINT scustinforec.slast_name
  710. LOCATE 13, 1: PRINT "Customer Address      ";: PRINT scustinforec.saddress
  711. LOCATE 14, 1: PRINT "Customer City         ";: PRINT scustinforec.scity
  712. LOCATE 15, 1: PRINT "customer State        ";: PRINT scustinforec.sstate
  713. LOCATE 16, 1: PRINT "customer Zip          ";: PRINT scustinforec.szip
  714. LOCATE 17, 1: PRINT "Customer Phone Number ";
  715. PRINT "(" + LEFT$(scustinforec.sphone, 3) + ")-"; MID$(scustinforec.sphone, 4, 3) + "-"; RIGHT$(scustinforec.sphone, 4)
  716. LOCATE 18, 1: PRINT "Description File Name ";: PRINT scustinforec.sdesc
  717. REM ***************************************************************************
  718.  
  719. s1:
  720. scustinforec.sdesc = scustinforec.id
  721. GOTO s2
  722. REM ***************************************************************************
  723.  
  724. s2:
  725. saction = "Enter First Name X to Exit - To Backup "
  726. ib = 25
  727. ilow = 99
  728. ihigh = 99
  729. iflag1 = 0
  730. GOSUB clearprompt
  731. GOSUB salphainput
  732.     CASE "": GOTO s4
  733.     CASE CHR$(88): RETURN 'X
  734.     CASE CHR$(45): GOTO s2 '-
  735.     CASE ELSE
  736.         scustinforec.sfirst_name = sr
  737.         GOSUB s0
  738.         GOTO s3
  739.  
  740.  
  741.  
  742. REM ***************************************************************************
  743. s3:
  744. saction = "Enter Last Name X to Exit - To Back up "
  745. ib = 25
  746. ilow = 99
  747. ihigh = 99
  748. iflag1 = 0
  749. GOSUB clearprompt
  750. GOSUB salphainput
  751.     CASE "": GOTO s4
  752.     CASE CHR$(88): RETURN 'X
  753.     CASE CHR$(45): GOTO s2 '-
  754.     CASE ELSE
  755.         scustinforec.slast_name = sr
  756.         GOSUB s0
  757.         GOTO s4
  758. REM ***************************************************************************
  759.  
  760. s4:
  761. saction = "Enter Address X to Exit - To Back up "
  762. ib = 30
  763. ilow = 99
  764. ihigh = 99
  765. iflag1 = 0
  766. GOSUB clearprompt
  767. GOSUB salphainput
  768.     CASE "": GOTO s5
  769.     CASE CHR$(88): RETURN 'X
  770.     CASE CHR$(45): GOTO s3 '-
  771.     CASE ELSE
  772.         scustinforec.saddress = sr
  773.         GOSUB s0
  774.         GOTO s5
  775. REM ***************************************************************************
  776.  
  777. s5:
  778. saction = "Enter City Name X to Exit - To Back up "
  779. ib = 25
  780. ilow = 99
  781. ihigh = 99
  782. iflag1 = 0
  783. GOSUB clearprompt
  784. GOSUB salphainput
  785.     CASE "": GOTO s6
  786.     CASE CHR$(88): RETURN 'X
  787.     CASE CHR$(45): GOTO s4 '-
  788.     CASE ELSE
  789.         scustinforec.scity = sr
  790.         GOSUB s0
  791.         GOTO s6
  792. REM ***************************************************************************
  793. s6:
  794. saction = "Enter State X to Exit - To Back up "
  795. ib = 2
  796. ilow = 99
  797. ihigh = 99
  798. iflag1 = 0
  799. GOSUB clearprompt
  800. GOSUB salphainput
  801.     CASE "": GOTO s7
  802.     CASE CHR$(88): RETURN 'X
  803.     CASE CHR$(45): GOTO s5 '-
  804.     CASE ELSE
  805.         scustinforec.sstate = sr
  806.         GOSUB s0
  807.         GOTO s7
  808. REM ***************************************************************************
  809.  
  810. s7:
  811. saction = "Enter Zip Code Name X to Exit - To Back up "
  812. ib = 5
  813. ilow = 99
  814. ihigh = 99
  815. iflag1 = 0
  816. GOSUB clearprompt
  817. GOSUB salphainput
  818.     CASE "": GOTO s8
  819.     CASE CHR$(88): RETURN 'X
  820.     CASE CHR$(45): GOTO s6 '-
  821.     CASE ELSE
  822.         scustinforec.szip = sr
  823.         GOSUB s0
  824.         GOTO s8
  825. REM ***************************************************************************
  826. s8:
  827. saction = "Enter Phone Number X to Exit - To Back up "
  828. ib = 10
  829. ilow = 99
  830. ihigh = 99
  831. iflag1 = 0
  832. GOSUB clearprompt
  833. GOSUB salphainput
  834.     CASE CHR$(88): RETURN 'X
  835.     CASE CHR$(45): GOTO s7 '-
  836.     CASE CHR$(68): GOTO s9
  837.     CASE CHR$(0): GOTO s0
  838.     CASE ELSE
  839.         scustinforec.sphone = sr
  840.         GOSUB s0
  841.         GOTO s9
  842. REM ***************************************************************************
  843. REM ***************************************************************************
  844. s9:
  845. saction = "Enter Description File Name D or Enter - To Back up "
  846. ib = 10
  847. ilow = 99
  848. ihigh = 99
  849. iflag1 = 0
  850. GOSUB clearprompt
  851. GOSUB salphainput
  852.     CASE CHR$(88): RETURN 'X
  853.     CASE CHR$(45): GOTO inv1 '-
  854.     CASE "":
  855.         scustinforec.sdesc = scustinforec.id
  856.         sdesc = scustinforec.id
  857.         GOSUB descinput
  858.         GOSUB s0
  859.         GOTO puttorecord
  860.  
  861.     CASE CHR$(68): 'D for using the sinventoryrec.id as the file name
  862.         scustinforec.sdesc = scustinforec.id
  863.         sdesc = scustinforec.id
  864.         GOSUB descinput
  865.         GOSUB s0
  866.         GOTO puttorecord
  867.  
  868.     CASE ELSE
  869.         scustinforec.sdesc = sr
  870.         sdesc = sr
  871.         GOSUB descinput
  872.         GOSUB s0
  873.         GOTO puttorecord
  874.  
  875. REM ***************************************************************************
  876. REM **** ask if you want to put data to record ********************************
  877. REM ***************************************************************************
  878. puttorecord:
  879. saction = "Commit Data to File Y/N"
  880. ib = 1
  881. ilow = 99
  882. ihigh = 99
  883. iflag1 = 0
  884. GOSUB clearprompt
  885. GOSUB salphainput
  886.     CASE "Y":
  887.         GOSUB insertrec
  888.  
  889.     CASE "N":
  890.         RETURN
  891. REM ***************************************************************************
  892.  
  893. REM ***************************************************************************
  894. REM **** delay loop ***********************************************************
  895. REM ***************************************************************************
  896. SUB Delay (dlay!)
  897.     start! = TIMER
  898.     DO WHILE start! + dlay! >= TIMER
  899.         IF start! > TIMER THEN start! = start! - 86400
  900.     LOOP
  901.  
  902.  

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: illeagal function call i dont know why
« Reply #1 on: October 20, 2020, 05:20:05 pm »
Hello

I forgot to tell that you need to have this in your home directory with a dir called jbridal it will create all the other directories for you .. sorry

Badger

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: illeagal function call i dont know why
« Reply #2 on: October 20, 2020, 05:50:13 pm »
Line 463 should be GOTO mainloop, not RETURN.

It wasn't called as a subroutine with GOSUB, so the RETURN is invalid/illegal/full of chicken feathers.

It works better if you plug it in.

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: illeagal function call i dont know why
« Reply #3 on: October 20, 2020, 05:53:23 pm »
Hey

Thanks i will look into this

Badger

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: illeagal function call i dont know why
« Reply #4 on: October 20, 2020, 06:08:27 pm »
Hello

That gosub's return is in the bottom of the s prompts if you want to put the record to file or not. The illeagal function call is in line 251 this line here

COLOR Yellow, Black: PRINT SPC(ib); '        changes color and prints ib spaces to screen for input length

the return for that gosub is in 1 of 2 lines depends on user choice lines 974 and 976 in the section puttorecord:

Badger

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: illeagal function call i dont know why
« Reply #5 on: October 20, 2020, 07:30:00 pm »
$COLOR:32
SCREEN 0

The issue is in the conflicts above.  You can’t use 32-bit graphical color values in a text screen.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: illeagal function call i dont know why
« Reply #6 on: October 20, 2020, 09:46:46 pm »
Hello

thanks very much


i will try some things

Badger

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: illeagal function call i dont know why
« Reply #7 on: October 20, 2020, 09:59:20 pm »
Hello SMcNeil

when this routine is call upon how would it be written to do what i am trying to do with $color:32 being used.

Badger

Code: QB64: [Select]
  1. sprintserrors:
  2. IF se = "" THEN se = "INVALID RESPONSE"
  3. itemp = LEN(se)
  4. itemp1 = 40 - (itemp / 2)
  5. COLOR 16, 7
  6. LOCATE 25, itemp1: _BLINK ON: PRINT se;
  7. CALL Delay(1.5)
  8. iflag2 = 1
  9.  

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: illeagal function call i dont know why
« Reply #8 on: October 20, 2020, 10:10:44 pm »
I commented out the $COLOR thing, here and in the other problem, because I'm a Neanderthal with version 1.3.

« Last Edit: October 20, 2020, 10:12:46 pm by Richard Frost »
It works better if you plug it in.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: illeagal function call i dont know why
« Reply #9 on: October 21, 2020, 01:21:03 am »
If you’re using SCREEN 0, use $COLOR:0 as well.

SCREEN 0
$COLOR:0
COLOR Yellow, Red
PRINT “Hello World”
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: illeagal function call i dont know why
« Reply #10 on: October 21, 2020, 01:09:52 pm »
Hello

if you try to change it back to $color:0 you get an error name already in use so not sure how to switch back and forth..

Badger

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: illeagal function call i dont know why
« Reply #11 on: October 21, 2020, 01:23:48 pm »
Hello

if you try to change it back to $color:0 you get an error name already in use so not sure how to switch back and forth..

Badger

You can’t change back and forth.  $COLOR sets a series of CONST values for the various color names you can use.  You have to choose one, or the other. 

The only way you can do what you’re apparently wanting to do, is to DIM SHARED your variables and then toggle them via some sort of definition method.

For example:


DIM SHARED Red AS _UNSIGNED LONG, Black AS _UNSIGNED LONG, White AS _UNSIGNED LONG

SCREEN _NEWIMAGE(640,400,32)
ColorNames32
COLOR Red, White
PRINT “HELLO WORLD”
SLEEP

SCREEN 0
ColoNames0
Color Red, White
PRINT “Names in screen 0!”

SUB ColorNames0
    Red = 4
    Black = 0
    White = 15
END SUB

SUB ColorNames32
    Red = &HFFFF0000
    Black = &HFF000000
    White = &HFFFFFFFF
END SUB
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: illeagal function call i dont know why
« Reply #12 on: October 21, 2020, 01:30:20 pm »
SMcNeil

Thanks i have a few other bugs to work out i will get to this soon. It has been raining here i have degentertive arthritis really bad so when this type of weather hits i am not a very fast person LOL

I am working on it as i go. Just bought a big dry erase board 71 inches long that is going to help as soon as i get it hung lol.

Thanks again.

You all amaze me with your grasp on the basic language it is very nice to have your help

Badger