Problem with program...

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Problem with program...

Post by Sinuvoid »

When i put my program to an EXE and run it, it gives me this message

Input run-time module path:

Please help me if you know this, and thank you very much! :D
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

You are using QB in an unfamiliar path

Post by burger2227 »

There are two ways this can happen.

1) The QB.EXE file cannot find a file outside of it's folder. Thus it asks for the path to it's folder files. You need to put the paths to all of QuickBasics EXE, Help, Include, and Library files into the Options menu of the IDE if they are not in the same folder you are working in.

2)When working in a directory other than QB's the EXE file can only access files in it's home folder. You must move the focus of QB by using CHDIR or SHELL to DOS commands to change to another folder. Then QB can find the module's files needed.

What I do is create all of my Modules in the same directory as QB.EXE so that everything works. Once I am done with a module I store them and any associated files into a ZIP file and move them to another folder for safekeeping. However I now have over 200 BAS files in the QB folder anyhow LOL.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

You dont know what I mean, do you? LOL
I mean I complied my QB program into a EXE, but when I run it, it gives me that message. Understand or is it me that doesnt understand XD
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

Did you perhaps compiled it with brun45.exe? If so, you need that program along with it.

But you could just recompile and make sure you don't ask for that thing.
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

Yup, that was the probelm that i complied it with BRUN45.exe... but then i did it again to be a stand alone, Thanks! :D
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

sometimes the solution is simpler than we think...

anytime...

good luck on the programming!!
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

LOL Who needs BRUN45? That should have been my first thought, but most programs do not require it.

If you use CHAIN then you can use it so that you pass COMMON SHARED values to the other module. Stand alone modules CHAINED will need a file to pass the values.

In any case, you still needed some type of file when that message comes up.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

burger2227, it happens to the best. I just thought of it because I used QB4.5 for a very long time. Now a days I use PDS7.1 thanks to Z!re.

Grtz
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

now how can I make my program faster? Ill post the code....

Code: Select all

'Actor database of ZSO
DEFINT A-Z
CLS

Wbackround:
FOR i = 1 TO 30
COLOR 15, 12
LOCATE 15, 20
PRINT "Loading, Please wait."
FOR b = 1 TO 3000
NEXT b
CLS
LOCATE 15, 20
PRINT "Loading, Please wait.."
FOR C = 1 TO 3000
NEXT C
CLS
LOCATE 15, 20
PRINT "Loading, Please wait..."
FOR d = 1 TO 3000
NEXT d
CLS
NEXT i

CLS
test:
COLOR 15, 12
LOCATE 1, 1
PRINT "A production of Souylsin."
SLEEP 1
LOCATE 2, 1
PRINT "A find by the community of ZSO."
SLEEP 1
LOCATE 3, 1
PRINT "ZSO DAT 0.01"
SLEEP 1
LOCATE 4, 1
PRINT "Locating Actordat..."



OPEN "Actordat.txt" FOR INPUT AS #1
INPUT #1, there$
CLOSE #1
IF there$ = "0000 0000 Link (may sometimes cause Z-buffer glitches)" THEN
GOTO con
ELSE
LOCATE 5, 1
PRINT "Could not locate Actordat, now exitting..."
SLEEP 1
END
END IF


con:
DO
LOCATE 5, 1
PRINT there$
LOCATE 6, 1
PRINT "There are "; LEN(there$); " characters in this file."
LOCATE 7, 1
PRINT "Actordat Located successfully"
LOCATE 8, 1
PRINT "TEST COMPLETE"
LOCATE 9, 1
PRINT "Press Any key to Continue"
kp$ = INKEY$
IF kp$ <> "" THEN GOTO Menu
LOOP


Menu:
CLS
LOCATE 10, 20
Color 14,12
PRINT "Database of Zelda Actors"
LOCATE 20, 5
Color 10, 12
PRINT "(S)earch for Actors"
Color 15, 12
LOCATE 20, 50
PRINT "(E)xit"

DO
kp$ = INKEY$
IF kp$ = "s" THEN GOTO srcaktr
IF kp$ = "e" THEN GOTO ext
LOOP

srcaktr:

asearch:
CLS
LOCATE 1, 1
INPUT "Actor name, or part of one:", sactname$
cmd$ = "FIND /I " + CHR$(34) + sactname$ + CHR$(34) + " Actordat.txt"
SHELL cmd$
PRINT "(A)nother search or (E)xit?"
DO
kp$ = INKEY$
IF kp$ = "a" THEN GOTO asearch
IF kp$ = "e" THEN GOTO ext
Loop

ext:
CLS
RANDOMIZE TIMER
C = INT(RND * 0 + 15) + 1
COLOR C
SHELL "Title COW"
LOCATE 10, 25
PRINT "BYE!"
SLEEP 1
END

bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

Wont make it faster but you could get riddof whole lot of LOCATE's.

Code: Select all

SUB Text(a AS Integer, b AS Integer, c AS String)
    LOCATE a, b
    PRINT c
END SUB
Now you can replace these
LOCATE 15, 20
PRINT "Loading, Please wait."


with this
TEXT 15, 12, "Loading Please wait."

Things that slows your program mostly are these ;)

Code: Select all

FOR b = 1 TO 3000
NEXT b 
If you want some delay there, i would ratherly use SLEEP with one or two second parameter. Your way depends of computer speed.
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

Ok, thanks for the tip :) so thats how sub's work eh? Its like putting 2 commands together...AWESOME!
bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

Well, thats a one way to say it. Not right but not wrong either :D
Here is another tip. I thought to create it after looking your start of code.

Code: Select all

Temp$ = "Loading, Please wait..."
CLS ' no need to locate since CLS allways put's cursor at 1,1.
For counter = 1 TO LEN(Temp$)
	Print MID$(Temp$, counter, 1);	' important to have ; at the end so line wont change.
	'DELAY CODE HERE: SLEEP 1 or something
Next Counter
Dont get frustrated, you are goin good there. Just keep on learning ;)
http://www.ascii-world.com/qbasic-snippets

E.K.Virtanen
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

Um wanna explain the code to me? Might help a bit, but i need the locate so the string appears in the middle of the screen, and not a 1,1. Know what I mean? Ill show you a update of my code shortly, maybe in like 10minutes.

EDIT:How would I be able to turn this into a sub?

Code: Select all

find:
OPEN file$ FOR INPUT AS #1
INPUT #1, there$
CLOSE #1
IF there$ = "0000 0000 Link (may sometimes cause Z-buffer glitches)" THEN
LOCATE a, 1
PRINT file$ " Located successfully."
GOTO done
ELSE
LOCATE a, 1
PRINT "Could not locate"; file$ "now exitting..."
SLEEP 1
END
END IF
bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

Lee wrote:Um wanna explain the code to me? Might help a bit, but i need the locate so the string appears in the middle of the screen, and not a 1,1. Know what I mean? Ill show you a update of my code shortly, maybe in like 10minutes.
http://www.ascii-world.com/centering-text-on-the-screen
EDIT:How would I be able to turn this into a sub?...
You need to make that as function with return value. If value = ok, then call sub done and so on.
Example of simple function.Rude and anti-beautifull but it does the job.

Code: Select all

CONST OK = 1

Function OkOrNot(a AS Integer, FileName AS String) AS Integer
	OPEN FileName FOR INPUT AS #1
		INPUT #1, there$
	CLOSE #1

	locate a, 1

	IF there$ = "0000 0000 Link (may sometimes cause Z-buffer glitches)" THEN
		Print FileName; " Located successfully."
		RETURN OK
	ELSE
		PRINT "Could not locate"; FileName "now exitting..."
		SLEEP 1
		END
	END IF
END Function

' this works after you create "Done" as sub.
IF OkOrNot(a, "filenamehere") = OK Then Done
Take a look of sub/function tutorials in this site ;)

E.K.Virtanen
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

ok, ive tried a bunch of things to make a "highlight" menu. but no luck. can you please take my code and put one in? thanks :)

Code: Select all

DECLARE SUB TEXT (a AS INTEGER, b AS INTEGER, C AS STRING)
'A database of Souylsin
DEFINT A-Z
CLS

Wbackround:
FOR i = 1 TO 3
COLOR 15, 12
TEXT 15, 20, "Loading, Please wait."
SLEEP 1
CLS 2
TEXT 15, 20, "Loading, Please wait.."
SLEEP 1
CLS 2
TEXT 15, 20, "Loading, Please wait..."
SLEEP 1
CLS 2
NEXT i

CLS
test:
COLOR 15, 12

LOCATE 1, 1
PRINT "A production of Souylsin."
SLEEP 1
LOCATE 2, 1
PRINT "Thanks to everyine who has contributed to this production."
SLEEP 1
LOCATE 3, 1
PRINT "WikiDAT 0.11"
SLEEP 1
SHELL "TYPE help.txt"
SLEEP 1
LOCATE 10,1
PRINT "TEST COMPLETE"
LOCATE 11, 1
PRINT "Press Any key to Continue"
kp$ = INKEY$
IF kp$ <THEN> 4 THEN selection% = 1
   GOSUB Redraw
  CASE " "
goto 
END SELECT
LOOP

Redraw:
CLS
FOR i = 1 TO 4
 PRINT Menu$(i)
NEXT i
LOCATE selection%, 1
COLOR 15, 12
PRINT Menu$(selection%)
COLOR 0, 12
RETURN

LOCATE 5, 20
COLOR 14, 12
PRINT "Database of Zelda Actors"

ssearxh:
GS:
fnar:
Anicode:
asearch:
CLS 2
INPUT "Actor name, or part of one:", sactname$
cmd$ = "FIND /I " + CHR$(34) + sactname$ + CHR$(34) + " Actordat.txt"
SHELL cmd$
PRINT "(A)nother search or (B)ack to main?"
goto choice

ext:
CLS 2
RANDOMIZE TIMER
C = INT(RND * 0 + 15) + 1
COLOR C
LOCATE 10, 25
PRINT "BYE!"
SLEEP 1
END

SUB TEXT (a AS INTEGER, b AS INTEGER, C AS STRING)
LOCATE a, b
PRINT C
END SUB

bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm »

Sorry but i am extremely busy today and tomorrow. I try to help you at sunday if i got time.
But you have done well there, just keep on pushing and you find the way ;)

Try to create and use subs and functions instead of goto, will make your code way easier to read and handle.

E.K.Virtanen
User avatar
Seb McClouth
Veteran
Posts: 342
Joined: Wed Nov 09, 2005 7:47 am
Location: Inside the Matrix...
Contact:

Post by Seb McClouth »

on file, thing wouldn't it be wise to use

Code: Select all

do...until EOF(filenr%)
? Because a file could contain more, or heck, not even exist for that matter.
QBinux is a Linux distribution with the aim of integrating the work of the vast community of free software developers at Pete's QBASIC Site in order to create a modern, performant, safe and easy to use system for system administrators and desktop users.
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

Whoa?? Gotta be more descriptive with me heh...
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

A TIMER Delay

Post by burger2227 »

Here is a simple Delay SUB that works for seconds down to .02 seconds and it is good on any speed computer:

Code: Select all

SUB Delay (Dela!)
   start = TIMER
   DO WHILE start + dela! > TIMER
   IF start > TIMER THEN start = start - 86400      'midnite correction
   LOOP
END SUB
I use this instead of SLEEP for a very important reason. SLEEP only stops a program until a keypress by the user!

To call the sub:

Code: Select all

Delay .5   '1/2 second delay
                        ' or
CALL Delay(.5)
I use this SUB in many of my programs to slow things down. A call can also slow down loops.

As to file access, you MUST not try to read data that is past the End Of File or EOF(#) or you will get an error. Here is an example with a loop and without one:

Code: Select all

DO WHILE (NOT EOF(1))        'loop until end of file
INPUT #1, nme$, Phone$, age%, Zip% 
IF nme$ = name$ THEN EXIT DO
LOOP

IF (NOT EOF(1)) THEN LINE INPUT #1, Line$   'in an IF statement
The first example reads data from a file, numbered #1 in an OPEN statement, one piece at a time until the name matches. If the name is not found, the loop stops at the end of the file!
The second is used with IF to see if the EOF has been reached while taking an entire line of data like text. It will not Input data if it is at the end of the file!

Ted
Last edited by burger2227 on Wed Nov 28, 2007 5:07 pm, edited 1 time in total.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

ok that may help. The delay thing will help a bit.
Post Reply