QBasic and QB64 Discussion Board

[QB Forum Archives (1999-2009)/ ] [QB FAQ] [QB Links and Downloads] [Subforums and Chat Room] [Search]

QB64.Net Homepage   QB/QB64 Keywords   QB Graphics Forum   Homework Policy



Pete I fixed your LineNumber removal code. Got any more changes?

by (Login burger2227)
R

It was missing RETURN linenumber.

Why is ERL in there? It RETURNS a linenumber, but it won't be in the code happy.gif

Let me know if you made any other updates to the code posted here:
http://www.qb64.net/wiki/index.php/Line_number

Posted on Aug 9, 2013, 10:11 PM

Respond to this message   

Return to Index


Don't worry friends...

by gopus (no login)

I heard that Clippy was no longer going to be helping out here because he thought QuickBASIC/QB45/QB64/FreeBASIC users were worthless. In his absence, I have decided to frequent here in order to aid anybody in need of help. I have reacquired moderation and admin status (via pete) to help aid you all better.

So send me your QB questions. I'm here for you.

Posted on Aug 1, 2013, 7:56 PM

Respond to this message   

Return to Index


* Stop lying.

by (Login MCalkins)
Moderator

Posted on Aug 1, 2013, 8:11 PM

Respond to this message   

Return to Index


Michael Calkins!

by gopus (no login)

It is 11pm. What on Earth are you doing here?

Posted on Aug 1, 2013, 8:12 PM

Respond to this message   

Return to Index


Also...

by gopus (no login)

I seem to have forgotten my password. Can you make me a new account, and give me moderator status again please? You know me and my always forgetting my password LOL.

Posted on Aug 1, 2013, 8:14 PM

Respond to this message   

Return to Index


But seriously...

by gopus (no login)

You became a regular on the forum about five years or so after I left - right? You and I wouldn't know each other, right? You sound familiar but I can never be sure. It makes me feel bad when I don't remember someone I should know.

Posted on Aug 1, 2013, 8:18 PM

Respond to this message   

Return to Index


Re: But seriously...

by (Login MCalkins)
Moderator

The QBasic help and the forum activity are welcome, and a little bit of comedy is okay too. But the power plays aren't necessary, and the blatant lies are evil. (Are they meant to be jokes?) It seems like every time that you come here, you have a delusion of importance or a power play.

It is a bit funny, aside from the dishonesty.

Regards,
Michael

Posted on Aug 1, 2013, 8:30 PM

Respond to this message   

Return to Index


*Michael, you have every right to call yourself a Christian.

by (Login qb432l)
R

*

Posted on Aug 2, 2013, 9:10 PM

Respond to this message   

Return to Index


hey where do

by (no login)

I find a comparable CD DVD drive for my computer

Posted on Aug 4, 2013, 7:43 AM

Respond to this message   

Return to Index


It doesn't have one?

by (Login MCalkins)
Moderator

I'll see if I have one laying around. Otherwise, we'll have to order one on eBay.

Regards,
Michael

Posted on Aug 4, 2013, 7:55 AM

Respond to this message   

Return to Index


Re: hey where do

by (Login MCalkins)
Moderator

I'll be coming to town this afternoon, but I'll be riding with my parents, and might not have much time to stay. I also plan to come to town on Tuesday.

If you're wanting to watch DVDs on your computer, we'll also have to install the K-Lite Mega Codec Pack, but we'll need to install Service Packs 2 and 3 first.

This subforum is mostly for QBASIC / QB64 discussion. In the future, if you want to discuss general computer stuff, this is the best place:

http://www.network54.com/Forum/190885/

Or, if you just want to chat, this is the best place:

http://www.network54.com/Forum/183705/

You can get to the subforums from here:

http://www.network54.com/Index/10167

Regards,
Michael

Posted on Aug 4, 2013, 8:20 AM

Respond to this message   

Return to Index


Calkans...

by gopus (no login)

It is not my intention for anyone to believe I am serious, especially since I have done this no less than 4 times. The only individuals to date who have been bothered by it are those who take themselves too seriously. Fact.

Posted on Aug 4, 2013, 5:47 PM

Respond to this message   

Return to Index


Re: Calkans...

by SMcNeill (no login)

You were joking?! Don't DO that!

Jokes are dangerous weapons for the unskilled. Your license to laugh is going to get revoked at this rate. :(

Posted on Aug 5, 2013, 3:10 PM

Respond to this message   

Return to Index


The biggest joke is his name!

by (Login burger2227)
R

GOP US

Posted on Aug 5, 2013, 4:59 PM

Respond to this message   

Return to Index


QB64 GL

by (no login)

I fot all excited when I saw that QB64-GL would incorporate all the .dll files that my programs apparently needed to run after download. But, when building the .EXE file the compiler runs for hours, or says Compile failed. No codes, no hints as to what was wrong.

It could be my computer, as it is still running XP (sp3), and the programs are too close to DOS to work out there. Too bad. I did some good work. If you want to see what I'm talking about, the website is pfepracticetests.com. Works on Win 7 if compatibility mode set to XP Home (sp3). And if malware hasn't stepped on your SDL.dll files, all should work fine.

Any ideas? email smsrdavis53@yahoo.com

Thanks.

Posted on Jul 30, 2013, 12:23 PM

Respond to this message   

Return to Index


The GL version is not complete yet

by (Login burger2227)
R

Could you give us a list of keywords you are using if not the entire code that fails to compile? A download link like Drop Box would be best if the program is large.

Posted on Jul 30, 2013, 5:45 PM

Respond to this message   

Return to Index


QB64 links don't work. Updates don't either

by (Login burger2227)
R

Sure got things screwed up now.

QB64 tried to update itself and could not find the links. Found pageok...happy.gif

Posted on Jul 17, 2013, 11:01 PM

Respond to this message   

Return to Index


*Yeah, I get pageok, too, so it's not your browser this time.

by (Login qb432l)
R

*

Posted on Jul 18, 2013, 9:36 AM

Respond to this message   

Return to Index


Turn off automatic updates in older versions of QB64

by (Login burger2227)
R

It attempted to download updates 10 times and then says to press ESC to quit. First time I ever saw that!

Galleon will have to give us a download link for updates to older stuff so that QB64 can go to the correct link. It could have been worse and just kept updating every time I opened it.

I'd tell him about it, but he forgot to lift my ban. So screw it.

Posted on Jul 18, 2013, 12:34 PM

Respond to this message   

Return to Index


Petesqbsite?

by Angros47 (no login)

Is it down?

Posted on Jul 17, 2013, 4:48 AM

Respond to this message   

Return to Index


It works for me.

by Pete (Login The-Universe)
Admin

But maybe you have to be named Pete?

http://petesqbsite.com/

Posted on Jul 17, 2013, 1:20 PM

Respond to this message   

Return to Index


New link because forum updated

by (Login burger2227)
R

Posted on Jul 17, 2013, 10:56 PM

Respond to this message   

Return to Index


Waiting for access to Petes QB site

by JT (no login)

10 days ago I tried to get an account on Petes QB Site, for the forum, as of today I'm still locked out. Is there a story to why this is taking so long? Pete wont answer emails.
JT

Posted on Jul 20, 2013, 5:28 PM

Respond to this message   

Return to Index


Email me your sign up info and I will approve you.

by (Login burger2227)
R

The new forum has been swamped with robots. I get 60 applications a day and most are spammer names.

Give me your registered sign on name, email address used, and the date you signed up. Did you get any reply automatically? Give me that date if you did.

Posted on Jul 21, 2013, 9:26 PM

Respond to this message   

Return to Index


*Thank you! Message sent.

by JT (no login)

Posted on Jul 22, 2013, 1:11 PM

Respond to this message   

Return to Index


output from old qbasic run under qb64

by old_cobol_app_pgmr (no login)

When I try to run:

CD\P\BC
DIR /B >\Y\BCTEAMF1.Y02
CD\P\BC\COACHES
DIR /B >\Y\BCTEAMF2.Y02
CD\P\BP
DIR /B >\Y\BPTEAMF1.Y02
CD\P\BP\COACHES
DIR /B >\Y\BPTEAMF2.Y02
C:\QB64\QB64.EXE /RUN C:\P\BC\PROG\COACH1V0.BAS
SORT /+1 <\Y\BBCCHNM1.Y02 >\Y\CCHSRTNM.Y02
SORT /+1 <\Y\BBCCHTM1.Y02 >\Y\CCHSRTTM.Y02

The output from "coach1v0" isn't picked up by the 2 following SORT statements. Any ideas? The 2 input files for the SORT statements DO already exist, but I would expect the output from COACH1V0 to overlay them, and the SORTS should pick up the files from COACH1V0.

Question 2: Why would I ever want to use the SLEEP command? Why delay the execution of my program at some point?

Thanks.

Posted on Jul 13, 2013, 9:20 AM

Respond to this message   

Return to Index


Re: output from old qbasic run under qb64

by SMcNeill (no login)

QB64 is a compiler, not an interpreter like QB45. It doesn't have a /run parameter from the command line. The way to work the above in QB64 would be to compile COACH1V0 to an exe file, and then call the exe directly.


As for SLEEP, we tend to use it so it'll pause the program and give the user time to read or react to output on the display. Think of it like displaying the pages of a book. The computer can read them and toss them on the screen in just a few seconds. Can you read a whole novel that fast without a pause in there?

SLEEP is just one of the easiest pause routines we can add into a program. ;)

Posted on Jul 13, 2013, 11:43 AM

Respond to this message   

Return to Index


Trouble dealing with the .EXE

by old_cobol_app_pgmr (no login)

Thanks for your response.

So, I need to compile the program to create a .EXE module, and store it on a path somewhere. Then, execute the .EXE?

Can I do that in the 1 ".BAT" file in my previous example?

What parms do I need to add to the "qb64\qb64.exe" line to create a ".EXE" module, and how do I specify the location for the ".EXE"?

Posted on Jul 13, 2013, 1:59 PM

Respond to this message   

Return to Index


Re: Trouble dealing with the .EXE

by (Login MCalkins)
Moderator

use the -x parameter.

qb64 -x myprog.bas

you can't specify a destination folder. But you can move the EXE afterwards. (If you have the old SDL version, the folder would need some DLL files also.)

Regards,
Michael

Posted on Jul 13, 2013, 3:15 PM

Respond to this message   

Return to Index


.exe question

by old_cobol_app_pgmr (no login)

After using the "-x", where would the ".exe" be, so that I can move it?

In the same folder as the ".bas" code?

Isn't there a way to:

1. use the -x to create the .exe and
2 run the .exe as the next step of a ".bat" file?

Posted on Jul 13, 2013, 4:55 PM

Respond to this message   

Return to Index


Re: .exe question

by (Login MCalkins)
Moderator

In the QB64 folder.

Yes.

You wouldn't need to recompile the program unless the program changes. You could compile the program once manually, and then run the EXE from the batch file.

If you want the batch file to wait for the EXE to terminate before proceeding, make sure that you put:
$CONSOLE
in your BAS program. That makes the resulting EXE a console program, and cmd.exe will wait for it to terminate before continuing to run the BAT script. Otherwise, you could have a race condition, if the BAT script depends on side effects from the EXE. Remember, Windows is a multitasking operating system.

Regards,
Michael

Posted on Jul 13, 2013, 7:33 PM

Respond to this message   

Return to Index


Where to put the $CONSOLE

by old_cobol_app_pgmr (no login)

Michael,

Thanks for your help. I never would have gotten thru this without you guys. My 9 year old DELL (Windows XP, 32-bit, I think) is going kaput one of these days, and I would have been stuck.

Does it matter where in COACH1V0.BAS that I put the $CONSOLE?

Posted on Jul 13, 2013, 8:02 PM

Respond to this message   

Return to Index


* I don't think so, but I usually put it at the start.

by (Login MCalkins)
Moderator

Posted on Jul 13, 2013, 8:59 PM

Respond to this message   

Return to Index


Windows Multi-tasking

by old_cobol_app_pgmr (no login)

On this multi-tasking issue, I never had to consider instigating any kind of "program delay" when running qbasic pgms in .bat files under windows x/p.

I quite frequently ran a qb program that produced an output file, then sorted the file in the next .bat file command. I used no delay mechanism in the qb program.

Is this another anomaly of qb64 being strictly a compile (instead of interpreter) process that produces a .exe module that then has to be executed via another .bat file command?

Am I missing something?

Thanks.

Posted on Jul 20, 2013, 11:28 AM

Respond to this message   

Return to Index


Re: Windows Multi-tasking (4 edits)

by (Login MCalkins)
Moderator

No, it's a matter of QB64 programs being GUI by default instead of console.

cmd.exe detects whether the Win32 program that it runs is a console program or a GUI program. (There is a field in the PE file header that indicates this.) It waits for console programs, but does not wait for GUI programs.

Consider, if you are at a command prompt, and type "notepad" or "explorer", Cmd invokes the program, and then immediately gives you another "C:\>". It doesn't wait for notepad or explorer to close before printing the new prompt. But if you type "ipconfig" or "ping", it does wait, otherwise the "C:\>" would be mixed in with whatever Ipconfig or Ping is printing. So, it waits for Ipconfig or Ping to terminate before printing the new prompt... Or, if Cmd didn't wait, if the console program also tried to read from the input buffer, they would both be trying to read from the same input buffer at the same time.

By putting:
$CONSOLE
at the start of your QB64 program, you tell QB64 to tell the linker to make it a console program. Then Cmd will wait for it.

This is not a problem with QBASIC, as QBASIC was a DOS program, with no concept of GUI or multitasking. Cmd waits for it. (The process is actually NTVDM, which outlives the execution of QBASIC. Somehow, NTVDM informs Cmd when it can continue. Perhaps NTVDM release a mutex that Cmd waits for.)

If you start a Win16 program, like SkiFree (\weppb\ski.exe), Cmd does not wait for it. Somehow it knows that it is a GUI program. Perhaps NTVDM tells it...

(It looks like each Win16 program gets its own thread in NTVDM. It also looks like Win16 and DOS programs don't run in the same NTVDM.)

You can use ProcessExplorer to watch the state of Cmd's thread while child processes are running. (In ProcessExplorer, right click the "cmd.exe" process, choose "Properties...", and go to the "Threads" tab.

While you are at the prompt, even as you type, the state of Cmd's only thread is "Wait:WrLpcReply", and the context switches should stay the same. If you press enter on the line, you will see the context switches increase. (The thread state will be "Running" very briefly, too briefly for ProcessExplorer to show it.) If you run a GUI program like Notepad, or Explorer, you will come straight back to the prompt, and a thread state of "Wait:WrLpcReply".

If you run a console program like "ping google.com", you will see Cmd's only thread increase its context switch count, and go into a state of "Wait:UserRequest". Then, when Ping terminates a few seconds later, there is another increase in context switch count, and Cmd's thread is back to "Wait:WrLpcReply".

You might be wondering why there are no context switches as you type individual letters into the Cmd prompt. For that you need to watch Csrss.exe. It has numerous threads, but you should see that at least one of them responds with more context switches as you type into or move the mouse over the console window. (It might have about 2 context switches per second while the console window has focus, but many more while you type or move the mouse over the console window.)

In multitasking, a context switch is whenever the operating system scheduler stops one thread and starts another. This involves saving the thread's CPU registers to memory, and loading another thread's CPU registers from memory. Each CPU core can be running 1 thread.

Regards,
Michael

P.S. If you start a GUI program from cmd, especially one that is not already cached in RAM, you might see cmd's thread's state become "Ready".

"Running" means that the thread is currently running on one of the CPU cores.

"Ready" means that the thread is not currently running, but is ready to run. It isn't currently running because all the CPU cores are currently running other threads of higher or equal priority.

"Wait" means that the thread has agreed to not run until certain conditions are met, such as a mutex being released, a thread or process dying, a GUI event occurring, a timeout occurring, etc...

"Suspended" means that the thread has been suspended, and will not run until some other thread resumes it.

Posted on Jul 20, 2013, 7:13 PM

Respond to this message   

Return to Index


Re: Windows Multi-tasking (4 edits)

by old_cobol_app_pgmr (no login)

Michael, thanks.

I didn't understand everything that you explained, but I understand that in invoking a .EXE module, the .bat file doesn't wait for it to finish, like it did in QB Interpreter. So if the .EXE program creates a file that you want to sort in the next .bat file command, it won't find the file to SORT, especially if the .EXE program takes more than a nano-second to run. Maybe even less than a nano-second.

Posted on Jul 27, 2013, 10:12 AM

Respond to this message   

Return to Index


It does wait if you use $CONSOLE.

by (Login MCalkins)
Moderator

' Uncomment the following line to make a console program.
'      $CONSOLE

DIM i AS LONG
FOR i = 0 TO 7
 PRINT i
 _DELAY .5
NEXT
SYSTEM



Compile that program, then run the EXE from the command prompt. Position the command prompt window so that the EXE's window won't cover it, so that you can see both windows.

Notice that the new prompt appears immediately.

Then, uncomment the $CONSOLE, recompile the program, and try again running it from the command prompt. Notice that, this time, the new prompt is not printed until after the EXE terminates.

Regards,
Michael

Posted on Jul 28, 2013, 12:13 AM

Respond to this message   

Return to Index


Thanks

by old_cobol_app_pgmr (no login)

I've run out of questions for the moment. I'm adding the $CONSOLE to all my old QB programs, and modifying my .bat files to run the .exe, instead of the .bas like I did in the Interpreter world. Compilation using qb64.exe seems to be working well. I'll let you know if I find any problems as I test the new process.

Thanks again.

Posted on Aug 4, 2013, 11:40 AM

Respond to this message   

Return to Index


* you're welcome

by (Login MCalkins)
Moderator

Posted on Aug 4, 2013, 2:24 PM

Respond to this message   

Return to Index


Getting to QB64

by SMcNeill (no login)

QB64 has recently moved servers, and Galleon is now hosting the website on his own computers.

The DNS lookup servers are still directing people to the old GoDaddy site which no longer exists. All they say is something silly like "pageok" at the top of them.

To get to QB64s new servers directly, go to:

Main Page ---->http://223.27.25.123/
Forums -------->http://223.27.25.123/forum
Wiki ---------->http://223.27.25.123/wiki
Chat ---------->http://webchat.freenode.net/ (channel #qb64, make your own chat handle)

Things should settle down over the next few days (hopefully), and traffic should start being routed to the new server. Until then though, you can always use the direct connections above to get where you might want to be. wink.gif

Posted on Jul 12, 2013, 4:51 PM

Respond to this message   

Return to Index


* LMAO @ "Page ok" Something is missing...

by (Login burger2227)
R

Posted on Jul 13, 2013, 7:24 AM

Respond to this message   

Return to Index


* Thanks for the links

by Cyperium (no login)

Posted on Jul 15, 2013, 5:11 PM

Respond to this message   

Return to Index


Help needed

by (no login)

I was trying to set a T1$ = 1/4" on qbasic, was not it supposed to be
T1$ = "1/4"""?

Why there is an error code saying that " expected operator in equation on current line"?

Any solution for it?

Thanks

Posted on Jul 11, 2013, 7:08 AM

Respond to this message   

Return to Index


Re: Help needed

by (Login MCalkins)
Moderator

T1$ = "1/4"

Regards,
Michael

Posted on Jul 11, 2013, 8:01 AM

Respond to this message   

Return to Index


Re: Help needed

by (no login)

Is it possible to set T1$=1/4"( one quarter inch )?
In other words, how to display inch symbol (") in qbasic?

Thanks,

Li

Posted on Jul 11, 2013, 8:07 AM

Respond to this message   

Return to Index


Re: Help needed

by (Login MCalkins)
Moderator

T1$ = "1/4" + CHR$(&H22)

Regards,
Michael

Posted on Jul 11, 2013, 8:55 AM

Respond to this message   

Return to Index


Re: Help needed

by Li Jin (no login)

That works.
Thanks Michael.

Posted on Jul 11, 2013, 10:44 AM

Respond to this message   

Return to Index


* yw.

by (Login MCalkins)
Moderator

Posted on Jul 11, 2013, 10:46 AM

Respond to this message   

Return to Index


getting "path not found"

by old_cobol_app_pgmr (no login)

I'm trying to run:

CD\P\BC
DIR /B >\Y\BCTEAMF1.Y02
CD\P\BC\COACHES
DIR /B >\Y\BCTEAMF2.Y02
CD\P\BP
DIR /B >\Y\BPTEAMF1.Y02
CD\P\BP\COACHES
DIR /B >\Y\BPTEAMF2.Y02
C:\QB64\QB64.EXE /RUN C:\P\BC\PROG\COACH1V0.BAS
SORT /+1 <\Y\BBCCHNM1.Y02 >\Y\CCHSRTNM.Y02
SORT /+1 <\Y\BBCCHTM1.Y02 >\Y\CCHSRTTM.Y02

On the qb64.exe statement, I get "path not found". The "making exec" doesn't show. I've checked and re-checked. Is the format wrong? Any ideas?

Thanks.

Posted on Jul 10, 2013, 7:59 PM

Respond to this message   

Return to Index


Never mind

by old_cobol_app_pgmr (no login)

Never mind. I found the problem.

Posted on Jul 10, 2013, 8:33 PM

Respond to this message   

Return to Index


Help with Path Algorithm

by Zack (no login)

Hi, I am was looking into shortest path algorithms and such for my game. Dijkstras is good but I changed my mind and decided that the characters and monsters in my game should not always take the most efficient route to the destination. There would be deviation and error based on the intelligence of the character or creature. Now I needed not to find only the shortest path, but all paths from point a to point b.

I wrote my own recursive algorithm to try and solve this problem but I can't get it right. I know it is ugly bear with me :P

What it is (trying) to do is look at the initial point and, if it is not up against a wall or something, take each point around it and tree off until it finds the destination. Currently it just closes without any error when it tries to run the algorithm. Also I can forsee a problem with the way I am passing the storepaths() array. As it is recursed, the index will change and when it comes back to the function that called it, it will have to rewrite the next path with every step before itself and itself. I am not sure how exactly to accomplish this yet. If someone could take a look and it and maybe tweak it a bit or give suggestions:


--------
_TITLE "Shortest Distance Finder"
SCREEN 12

TYPE POINT
x AS LONG
y AS LONG
END TYPE

REDIM grid(20, 20) AS _BIT
REDIM path(20, 20) AS _BIT

REDIM makepath_paths(0, 0) AS POINT
REDIM makepath_distance(0) AS LONG
REDIM makepath_storepath(0) AS STRING

DIM source AS POINT
DIM destination AS POINT

DO
_LIMIT 32
CLS
SELECT CASE instruction
CASE 0
PRINT "Create walls and such to make an environment."
CASE 1
PRINT "Select an initial point."
CASE 2
PRINT "Select a destination point."
CASE 3
dx = makepath(grid(), source, destination, path(), pathefficiency(50), 0, makepath_paths(), makepath_storepath(), makepath_distance())
IF dx THEN
instruction = intstuction + 1
ELSE
instruction = instruction + 2
END IF
CASE 4
PRINT "Shortest path found."
CASE 5
PRINT "Could not find a path."
END SELECT
FOR grid = 0 TO 20
LINE (50 + 20 * grid, 50)-STEP(0, 400), 7
LINE (50, 50 + 20 * grid)-STEP(400, 0), 7
NEXT grid
FOR colorgridx = 1 TO 20
FOR colorgridy = 1 TO 20
IF grid(colorgridx, colorgridy) THEN PAINT (49 + 20 * colorgridx, 49 + 20 * colorgridy), 15, 7
IF instruction = 4 THEN
IF path(colorgridx, colorgridy) THEN PAINT (49 + 20 * colorgridx, 49 + 20 * colorgridy), 14, 7
END IF
IF source.x = colorgridx AND source.y = colorgridy THEN PAINT (49 + 20 * colorgridx, 49 + 20 * colorgridy), 10, 7
IF destination.x = colorgridx AND destination.y = colorgridy THEN PAINT (49 + 20 * colorgridx, 49 + 20 * colorgridy), 12, 7
NEXT colorgridy, colorgridx
IF k$ = CHR$(27) THEN SYSTEM
IF k$ = CHR$(13) AND instruction < 4 THEN instruction = instruction + 1
IF NOT click AND oldclick THEN
FOR buttonx = 1 TO 20
FOR buttony = 1 TO 20
IF isonbox(x, y, 50 + (buttonx - 1) * 20, 50 + (buttony - 1) * 20, 50 + buttonx * 20, 50 + buttony * 20) THEN
SELECT CASE instruction
CASE 0
grid(buttonx, buttony) = grid(buttonx, buttony) XOR 2 ^ 0
CASE 1
source.x = buttonx
source.y = buttony
CASE 2
destination.x = buttonx
destination.y = buttony
END SELECT
END IF
NEXT buttony, buttonx
END IF
oldclick = click
k$ = INKEY$
DO WHILE _MOUSEINPUT
x = _MOUSEX
y = _MOUSEY
click = _MOUSEBUTTON(1) OR _MOUSEBUTTON(2) OR _MOUSEBUTTON(3)
LOOP
LOOP

FUNCTION pathefficiency (intelligence AS SINGLE)
efficiency = 1 - (1 / SQR(intelligence * 4))
END FUNCTION

FUNCTION makepath` (graph() AS _BIT, source AS POINT, destination AS POINT, path() AS _BIT, efficiencyfactor AS SINGLE, pathcount AS LONG, paths() AS POINT, storepaths() AS STRING, distance() AS LONG)
DIM treeloc AS _BIT
DIM dimensiontoggle AS _UNSIGNED _BIT
DIM checkforstep AS INTEGER
DIM pointcount AS INTEGER
DIM graphxmax AS LONG
DIM graphxmin AS LONG
DIM graphymax AS LONG
DIM graphymin AS LONG
DIM parsepaths AS LONG
DIM pathchoice AS LONG
DIM rippoints AS LONG
DIM sketchpathx AS LONG
DIM sketchpathy AS LONG
DIM storepathcount AS LONG
DIM buildpoint AS STRING
DIM pointslice AS STRING
DIM passsource AS POINT
DIM storesource AS POINT
IF NOT pathcount THEN
REDIM path(20, 20) AS _BIT
REDIM storepaths(1) AS STRING
graphxmax = UBOUND(graph)
graphxmin = LBOUND(graph)
graphymax = UBOUND(graph, 2)
graphymin = LBOUND(graph, 2)
treeloc = -1
pathcount = 1
END IF
storesource = source
storepathcount = pathcount
IF pathcount > UBOUND(storepaths) THEN REDIM _PRESERVE storepaths(pathcount)
storepaths(pathcount) = storepaths(pathcount) + TRIMnum$(source.x) + CHR$(255) + TRIMnum$(source.y) + CHR$(255)
IF source.x = destination.x AND source.y = destination.y THEN EXIT FUNCTION
IF source.x > graphxmin THEN
IF NOT graph(source.x - 1, source.y) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x - 1) + CHR$(255) + TRIMnum$(source.y) + CHR$(255)) THEN
passsource.x = source.x - 1
passsource.y = source.y
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF source.x < graphxmax THEN
IF NOT graph(source.x + 1, source.y) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x + 1) + CHR$(255) + TRIMnum$(source.y) + CHR$(255)) THEN
passsource.x = source.x + 1
passsource.y = source.y
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF source.y > graphymin THEN
IF NOT graph(source.x, source.y - 1) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x) + CHR$(255) + TRIMnum$(source.y - 1) + CHR$(255)) THEN
passsource.x = source.x
passsource.y = source.y - 1
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF source.y < graphymax THEN
IF NOT graph(source.x, source.y + 1) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x) + CHR$(255) + TRIMnum$(source.y + 1) + CHR$(255)) THEN
passsource.x = source.x
passsource.y = source.y + 1
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF source.x > graphxmin AND source.y > graphymin THEN
IF NOT graph(source.x - 1, source.y - 1) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x - 1) + CHR$(255) + TRIMnum$(source.y - 1) + CHR$(255)) THEN
passsource.x = source.x - 1
passsource.y = source.y - 1
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF source.x > graphxmin AND source.y < graphymax THEN
IF NOT graph(source.x - 1, source.y + 1) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x - 1) + CHR$(255) + TRIMnum$(source.y + 1) + CHR$(255)) THEN
passsource.x = source.x - 1
passsource.y = source.y + 1
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF source.x < graphxmax AND source.y > graphymin THEN
IF NOT graph(source.x + 1, source.y - 1) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x + 1) + CHR$(255) + TRIMnum$(source.y - 1) + CHR$(255)) THEN
passsource.x = source.x - 1
passsource.y = source.y + 1
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF source.x < graphxmax AND source.y < graphymax THEN
IF NOT graph(source.x, source.y + 1) AND NOT INSTR(storepaths(pathcount), TRIMnum$(source.x) + CHR$(255) + TRIMnum$(source.y + 1) + CHR$(255)) THEN
passsource.x = source.x + 1
passsource.y = source.y + 1
pathcount = pathcount + 1
REDIM _PRESERVE storepath(pathcount)
nextpath = makepath(graph(), passsource, destination, path(), efficiencyfactor, pathcount, paths(), storepaths(), distance())
END IF
END IF
IF treeloc THEN
REDIM paths(UBOUND(storepaths), 1)
REDIM distance(UBOUND(storepaths))
FOR parsepaths = 1 TO UBOUND(storepaths)
dimensioncount = 0
pointcount = 1
buildpoint = ""
FOR rippoints = 1 TO LEN(storepaths(parsepaths))
pointslice = MID$(storepaths(parsepaths), rippoints, 1)
IF pointslice = CHR$(255) THEN
SELECT CASE dimensioncount
CASE 0
paths(rippoints, pointcount).x = VAL(buildpoint)
buildpoint = ""
CASE 1
paths(rippoints, pointcount).y = VAL(buildpoint)
pointcount = pointcount + 1
IF pointcount > UBOUND(paths, 2) THEN REDIM _PRESERVE paths(UBOUND(storepaths), pointcount)
END SELECT
dimensioncount = dimensioncount XOR 2 ^ 0
ELSE
buildpoint = buildpoint + pointslice
END IF
NEXT rippoints
distance(rippoints) = pointcount
NEXT parsepaths
choice = INT(RND * UBOUND(paths) + 1)
FOR sketchpathx = graphxmin TO graphxmax
FOR sketchpathy = graphymin TO graphymax
FOR checkforstep = 1 TO UBOUND(paths, 2)
IF paths(choice, checkforstp).x = sketchpathx AND paths(choice, checkforstp).y = sketchpathy THEN
path(sketchpathx, sketchpathy) = -1
EXIT FOR
END IF
NEXT checkforstep, sketchpathy, sketchpathx
makepath = -1
END IF
END FUNCTION


FUNCTION isonbox` (x AS LONG, y AS LONG, x1 AS LONG, y1 AS LONG, x2 AS LONG, y2 AS LONG)
isonbox = -1
IF x < x1 OR x > x2 THEN isonbox = 0
IF y < y1 OR y > y2 THEN isonbox = 0
END FUNCTION

FUNCTION TRIMnum$ (n AS SINGLE)
TRIMnum$ = LTRIM$(RTRIM$(STR$(n)))
END FUNCTION
--------

Posted on Jul 9, 2013, 9:00 PM

Respond to this message   

Return to Index


I just did a basic pathfinder

by SMcNeill (no login)

I just did one of these for a simple 2d (x/y) grid, over at the QB64 forums. Http://www.qb64.net/forum
Head to the sample area, and you'll see my little demo there. Feel free to use it, abuse it, and alter it as needed for your own use. As with all my junk, it's free to the world ware. :)

Posted on Jul 10, 2013, 3:37 PM

Respond to this message   

Return to Index


Facial recognition

by NSA (no login)

Has anyone here successfully implemented a facial recognition algorithm?

Posted on Jul 6, 2013, 6:14 PM

Respond to this message   

Return to Index


* Black face or white is all I got so far...

by (Login burger2227)
R

Posted on Jul 6, 2013, 6:42 PM

Respond to this message   

Return to Index


*NSA wants to use qbasic??

by lawgin (no login)

Posted on Jul 6, 2013, 6:44 PM

Respond to this message   

Return to Index


Re:

by NSA (no login)

Some of the best programmers know qbasic, but are not limited to it. The same programming concepts and algorithms apply to other, more modern languages.

Posted on Jul 6, 2013, 6:48 PM

Respond to this message   

Return to Index


That's true for sequential structured programming

by Solitaire (no login)

but not for object-oriented programming.

I prefer the old-fashioned logic and structure of sequential programming and don't teach 00P in my beginning classes, even though it's emphasized in the textbooks.

Posted on Jul 6, 2013, 11:31 PM

Respond to this message   

Return to Index


Obviously I'm not really NSA

by NSA (no login)

No Such Agency

Posted on Jul 7, 2013, 12:11 PM

Respond to this message   

Return to Index


*but it say's NSA ?

by (Login GarryRicketson)
R

Posted on Jul 8, 2013, 10:23 AM

Respond to this message   

Return to Index


*typo :-)

by NISSAN (no login)

Posted on Jul 8, 2013, 6:33 PM

Respond to this message   

Return to Index


How can I evaluate a boolean statment from user input?

by linuxlalala (no login)

Hello everyone,

I would like to parse user input in QBASIC and evaluate it as a boolean statement, such as this one:

Enter a boolean statement:
1 = 1

True .

Any ideas on how to do it?

Posted on Jul 2, 2013, 5:47 AM

Respond to this message   

Return to Index


Boolean?

by Solitaire (Login Solitaire1)
S

There is no way you can evaluate a user input statement as Boolean in QB. All inputs are entered as strings, and you would need to parse each character of the string separately. It can get extremely complex, with lots of errors. The best you can do is get each part of the statement as a single numeric input, and use the relational operator in a SELECT CASE block. Here is an example:

===============================================================================
CLS
DIM bool AS STRING, snum AS STRING, oper AS STRING
DIM first AS DOUBLE, second AS DOUBLE
bool$ = "FALSE"
PRINT "Return a Boolean value comparing 2 parts of a statement"
PRINT "separated by a relational operator:  =, >, <, >=, <=, <>"
PRINT "Each part must be a single numeric value."
PRINT
INPUT "Enter first part:  ", snum$
first = VAL(snum$)
INPUT "Enter second part:  ", snum$
second = VAL(snum$)
INPUT "Enter relational operator:  ", oper$
SELECT CASE oper$
    CASE "="
        IF first = second THEN bool$ = "TRUE"
    CASE ">"
        IF first > second THEN bool$ = "TRUE"
    CASE "<"
        IF first < second THEN bool$ = "TRUE"
    CASE ">="
        IF first >= second THEN bool$ = "TRUE"
    CASE "<="
        IF first <= second THEN bool$ = "TRUE"
    CASE "<>"
        IF first <> second THEN bool$ = "TRUE"
    CASE ELSE
        oper$ = "invalid operator"
END SELECT
PRINT
PRINT "Your statement is:  "; first; " "; oper$; " "; second
PRINT : PRINT "The Boolean value is "; bool$; "."
END
===============================================================================

Note: You can also compare string values, in which case it will use the ASCII values for alphabetical order. Here is a variation of the above code, using strings:

===============================================================================
CLS
DIM bool AS STRING, oper AS STRING
DIM first AS STRING, second AS STRING
bool$ = "FALSE"
PRINT "Return a Boolean value comparing 2 parts of a string statement"
PRINT "separated by a relational operator:  =, >, <, >=, <=, <>"
PRINT "Each part will be compared using the ASCII values of each string."
PRINT
INPUT "Enter first part:  ", first$
INPUT "Enter second part:  ", second$
INPUT "Enter relational operator:  ", oper$
SELECT CASE oper$
    CASE "="
        IF first$ = second$ THEN bool$ = "TRUE"
    CASE ">"
        IF first$ > second$ THEN bool$ = "TRUE"
    CASE "<"
        IF first$ < second$ THEN bool$ = "TRUE"
    CASE ">="
        IF first$ >= second$ THEN bool$ = "TRUE"
    CASE "<="
        IF first$ <= second$ THEN bool$ = "TRUE"
    CASE "<>"
        IF first$ <> second$ THEN bool$ = "TRUE"
    CASE ELSE
        oper$ = "invalid operator"
END SELECT
PRINT
PRINT "Your statement is:  "; first$; " "; oper$; " "; second$
PRINT : PRINT "The Boolean value is "; bool$; "."
END



Posted on Jul 2, 2013, 9:52 AM

Respond to this message   

Return to Index


Re: Boolean?

by linuxlalala (no login)

Do you happen to know about the 'shunting yard' algorithm?

Posted on Jul 6, 2013, 3:47 PM

Respond to this message   

Return to Index


shunting yard algo

by lawgin (no login)

There's a thread in qb64.net on it's implementation in Basic.

http://www.qb64.net/forum/index.php?PHPSESSID=1b4vjmdhcnhsvcrf20jl73k365&topic=7301.0;wap2

Posted on Jul 6, 2013, 4:21 PM

Respond to this message   

Return to Index


Re: shunting yard algo

by Ben (no login)

I've made this one some time ago, using shunting yard, you could easily swap out/add operators for boolean ones:
they are in subs and can be recycled.

http://www.network54.com/Forum/648955/thread/1344810946/calculator+and+graphs

I've made a full error free optimized implementation of the algorithm in C for my mathematics software project as well, which i may port to basic if someone wishes

Posted on Jul 6, 2013, 6:14 PM

Respond to this message   

Return to Index


Qbasic returns -1 for true statements, 0 for false ones

by (Login burger2227)
R


PRINT 1 = 1
PRINT 1 = 2
PRINT 2 = 2
PRINT 5 = 4 + 1

You can use Boolean statements in algebraic calculations also



Posted on Jul 2, 2013, 10:28 AM

Respond to this message   

Return to Index


That's true

by Solitaire (Login Solitaire1)
S

But it can't be done with user inputs. It would simply print the string entered by the user, if the input was a string. Otherwise, will return 0.

More:

CONST FALSE = 0
CONST TRUE = NOT FALSE
'NOT 0 is the same as -1
CLS
PRINT "Flags are usually BOOLEAN type -- either TRUE or FALSE."
flag = FALSE
PRINT "FALSE flag value = "; flag
flag = TRUE
PRINT "TRUE flag value = "; flag
INPUT "Enter a number: ", num
IF num = FALSE THEN
   PRINT "False"
ELSE
    PRINT "True"
END IF
END

Posted on Jul 2, 2013, 12:21 PM

Respond to this message   

Return to Index


I only printed the numerical statements to show the values

by (Login burger2227)
R

Numerical statements can be evaluated as boolean true or false and used in mathematical calculations.

The following two equations use Boolean statements to determine if a year is a leap year:


INPUT "Enter a year greater than 1583: ", annum$
Y = VAL(annum$)
leap1 = (Y MOD 4 = 0 AND Y MOD 100 0) OR (Y MOD 400 = 0)
leap2 = (Y MOD 4 = 0) - (Y MOD 100 = 0) + (Y MOD 400 = 0)
PRINT "Year = "; annum$, "Leap1 = "; leap1, "Leap2 = "; leap2

-1 means that the year is a leap year. 1584 was the first time leap years were calculated this way. Each Boolean statement is in parenthesis and the result is also true or false.

-1 and 0 are not much to go with, but you can subtract -1 to add to a value or multiply -1 times a negative to increase it. False values would do nothing.

Posted on Jul 2, 2013, 5:06 PM

Respond to this message   

Return to Index


An awkward (and probably useless) way to do it

by lawgin (no login)

OPEN "boolchk.bas" FOR OUTPUT AS #1
INPUT "Enter a Boolean statement: "; b$
PRINT #1, "PRINT "; b$
CLOSE 1
CHAIN "boolchk.bas"







Posted on Jul 2, 2013, 5:39 PM

Respond to this message   

Return to Index


Thank you.

by linuxlalala (no login)

I think I am going to use this code. Do you mind using this techinique on other programms of mine, or you need permission or credit?

Posted on Jul 3, 2013, 3:11 AM

Respond to this message   

Return to Index


I think I am going to use it on this project.

by linuxlalala (no login)

https://sourceforge.net/projects/lpm/

Is an interpreter for a homebrew educational programming language, which lacks boolean support. Do you have any problems with that?

Posted on Jul 3, 2013, 3:17 AM

Respond to this message   

Return to Index


If it is ever used, of course.

by linuxlalala (no login)

...

Posted on Jul 3, 2013, 3:53 AM

Respond to this message   

Return to Index


Re: Thank you.

by lawgin (no login)

I seek no credit for my solution. My response merely illustrates a rough way to solve the problem. It needs a lot of polishing to be practical.

Posted on Jul 3, 2013, 9:57 AM

Respond to this message   

Return to Index


lawgin: Tried this code

by Solitaire (no login)

but it deletes itself and overwrites the file with the user's input. Is there any way to save the original code?

Posted on Jul 3, 2013, 8:34 AM

Respond to this message   

Return to Index


It shouldn't overwrite the code

by lawgin (no login)

I used 2 separate files. The code I posted was saved as bool.bas and is not overwritten. boolchk.bas is created at run time and contains the boolean statement.

I wanted to CHAIN back to the original code to get the next boolean statement but I couldn't remember how to enclose quotes within quotes:

OPEN "boolchk.bas" FOR OUTPUT AS #1
INPUT "Enter a Boolean statement: "; b$
PRINT #1, "PRINT "; b$
PRINT #1, "CHAIN "bool.bas""; this statement is wrong
CLOSE 1
CHAIN "boolchk.bas"

















Posted on Jul 3, 2013, 10:12 AM

Respond to this message   

Return to Index


Untested, since I can't run QBASIC anymore, but I think this would work:

by (Login Kewbie)
R

DQ$ = CHR$(22)

OPEN "boolchk.bas" FOR OUTPUT AS #1
INPUT "Enter a Boolean statement: "; b$
PRINT #1, "PRINT "; b$
PRINT #1, "CHAIN " + DQ$ + "bool.bas" + DQ$
CLOSE 1
CHAIN "boolchk.bas"

Posted on Jul 3, 2013, 10:48 AM

Respond to this message   

Return to Index


Thanks, it does

by lawgin (no login)

It works with old QB. The code below does not work with qb64, however. I don't know why.

bool.bas is this code:

OPEN "boolchk.bas" FOR OUTPUT AS #1
INPUT "Enter a Boolean statement: "; b$
PRINT #1, "PRINT "; b$
PRINT #1, "CHAIN " + CHR$(34) + "bool.bas" + CHR$(34)
CLOSE 1
CHAIN "boolchk.bas"







Posted on Jul 3, 2013, 11:29 AM

Respond to this message   

Return to Index


It won't work in QB64 because...

by linuxlalala (no login)

...It tries to compile whatever mentioned in a CHAIN command, if there is no corresponding .EXE (or another binary) file. I think that happens with almost every compiler, but I will test it with FreeBASIC now.

Posted on Jul 3, 2013, 8:55 PM

Respond to this message   

Return to Index


It won't work in FreeBASIC, too.

by linuxlalala (no login)

The produced .asm doesn't even mention the CHAIN command.

Posted on Jul 3, 2013, 9:03 PM

Respond to this message   

Return to Index


Given that I know NOTHING about qb64...

by (Login Kewbie)
R

If qb64 does actually compile the target of the CHAIN statement, perhaps you need to KILL the "chain target".EXE file before CHAINing.

That's just a guess.

Kew

Posted on Jul 4, 2013, 10:31 AM

Respond to this message   

Return to Index


You are absolutely right

by lawgin (no login)

Deleting the executable forces a recompilation for every boolean expression.

SHELL "del boolchk.exe"
OPEN "boolchk.bas" FOR OUTPUT AS #1
INPUT "Enter a Boolean expression: "; b$
PRINT #1, "PRINT "; b$
PRINT #1, "CHAIN " + CHR$(34) + "bool.bas" + CHR$(34)
CLOSE 1
CHAIN "boolchk.bas"







Posted on Jul 4, 2013, 2:23 PM

Respond to this message   

Return to Index


File overwrites itself with the user's input

by Solitaire (no login)

I've tried copying and pasting several of your code posts and it just doesn't work for me. I'm running QB (not 64). It says file wasn't saved and asks if I want to save it. If I say OK, it overwrites the file, deleting the original code. If I say no, it opens a different file which I already have with the name BOOL. If I change the name, it does nothing.

Posted on Jul 4, 2013, 4:26 PM

Respond to this message   

Return to Index


Re: File overwrites itself with the user's input

by lawgin (no login)

Are you sure that you are using 2 files. boolchk.bas is created at runtime and contains the user's input. bool.bas is the code that I have posted. It sounds like you're using the same name for both.

Posted on Jul 4, 2013, 7:07 PM

Respond to this message   

Return to Index


Tried it again. File overwrites itself

by Solitaire (no login)

I copied and pasted your code. Named the program BOOLCHK. Renamed my old program from BOOL to BOOLA, so it doesn't get called up.

When I run the program it asks me to save it. Whether or not I do, it replaces the code with the user input.

Posted on Jul 5, 2013, 12:16 AM

Respond to this message   

Return to Index


*As we tell the newbies, Solitaire, post your code.

by (Login Kewbie)
R

Posted on Jul 5, 2013, 5:53 AM

Respond to this message   

Return to Index


*I second that

by lawgin (no login)

Posted on Jul 5, 2013, 10:10 AM

Respond to this message   

Return to Index


It's EXACTLY the same code as lawgin posted above.

by Solitaire (no login)

SHELL "del boolchk.exe"
OPEN "boolchk.bas" FOR OUTPUT AS #1
INPUT "Enter a Boolean expression: "; b$
PRINT #1, "PRINT "; b$
PRINT #1, "CHAIN " + CHR$(34) + "bool.bas" + CHR$(34)
CLOSE 1
CHAIN "boolchk.bas"

Posted on Jul 5, 2013, 11:28 PM

Respond to this message   

Return to Index


And that code is in a file called bool.bas, correct?

by (Login Kewbie)
R

The code you posted, Solitaire, is the code for bool.bas. It creates boolchk.bas and then CHAINs to it, having given the instruction to CHAIN back to itself as the last action of the created program boolchk.bas.

If you're putting the given code into a file named boolchk.bas, then of course it will overwrite itself.

Also, if you're running this program using QBASIC, there's no need to delete boolchk.exe, since it never gets compiled.
Kew

P.S. Well, the formatted text feature doesn't work as documented. Try using *s to indicate italics.

Posted on Jul 6, 2013, 7:07 AM

Respond to this message   

Return to Index


Ok, I just tested it under QBASIC and it worked just fine for me

by (Login Kewbie)
R

And now I have QBASIC back on my computer, although it's a real pain to work with.

Posted on Jul 6, 2013, 8:13 AM

Respond to this message   

Return to Index


Not just for boolean expressions

by lawgin (no login)

This technique also functions kind of a crude calculator. If the user types in 25-20+2*sqr(64), the response is 21. The code below works for QB (not qb64).

You must save this code as calc.bas or it will not work.

OPEN "answer.bas" FOR OUTPUT AS #1
INPUT "Enter a calculation: "; b$
PRINT #1, "CLS"
PRINT #1, "PRINT " + CHR$(34) + b$ + CHR$(34) + CHR$(34) + "=" + CHR$(34)
PRINT #1, "PRINT "; b$
PRINT #1, "PRINT"
PRINT #1, "CHAIN " + CHR$(34) + "calc.bas" + CHR$(34)
CLOSE 1
CHAIN "answer.bas"

Posted on Jul 6, 2013, 10:59 AM

Respond to this message   

Return to Index


Revised code

by Solitaire (no login)

I cleaned up your code same as the previous one. Saved it as CALC.BAS. Still getting the annoying message to save the file.


│OPEN "answer.bas" FOR OUTPUT AS #1
│PRINT
│INPUT "Enter a calculation or nothing to stop: ", b$
│CLS

│IF VAL(b$) = 0 THEN
│ CLOSE #1
│ END
│ELSE
│ PRINT : PRINT b$; " = ";
│END IF

│PRINT #1, "PRINT "; b$
│PRINT #1, "PRINT"
│PRINT #1, "CHAIN " + CHR$(34) + "calc.bas" + CHR$(34)
│CLOSE 1
│CHAIN "answer.bas"

Posted on Jul 6, 2013, 11:31 AM

Respond to this message   

Return to Index


Re: Revised code

by lawgin (no login)

I see that you've printed the calculation before chaining out. That makes a lot more sense.

Strange that you're still being prompted to save. I only see that when I've made a change to calc.bas. You should be prompted to save in this case before the program exits via CHAIN "answer.bas". Subsequently that prompt should not appear.

Btw, your post had vertical lines in front of each line of code. These appeared to be some kind of unicode characters which had to be deleted.

Posted on Jul 6, 2013, 1:56 PM

Respond to this message   

Return to Index


Still having problems

by Solitaire (no login)

I revised the code to clear the screen, display the expression and result on one line, and stop when user presses Enter. The is the code I copied to BOOL.BAS:

=============================================================
OPEN "boolchk.bas" FOR OUTPUT AS #1
PRINT
INPUT "Enter a Boolean expression or nothing to stop: ", b$
CLS

IF VAL(b$) = 0 THEN
END
ELSE
PRINT : PRINT b$; " is ";
END IF

PRINT #1, "PRINT "; b$
PRINT #1, "CHAIN " + CHR$(34) + "bool.bas" + CHR$(34)
CLOSE 1
CHAIN "boolchk.bas"
==============================================================

When I ran the original program (saved as BOOL.BAS), I would get a box that said, "Loaded file is not saved. Save it now?" If I answered Yes, it displayed the result and continued to work. If No, it erased the code. This happened every time I ran the program, before and during the time I made revisions to the original code.

Now all of a sudden, it runs without asking me to save it.

Posted on Jul 6, 2013, 11:07 AM

Respond to this message   

Return to Index


File wasn't closed.

by Solitaire (no login)

The reason it didn't ask to save the file is because I ENDed it without closing the file. If I place CLOSE #1 before END then I get the same annoying message again. How can the file be saved before the message comes up?

Posted on Jul 6, 2013, 11:17 AM

Respond to this message   

Return to Index


Re: File wasn't closed.

by lawgin (no login)

I ran your code without the CLOSE #1 and got the same results as you.

I inserted the CLOSE #1. Now I was prompted to save as I should be because the program was modified.

Subsequent runs did not get a save prompt.

Your remarks seem to indicate that you are being asked to save the unclosed file (boolchk.bas). This shouldn't happen. The code below runs without any save prompt.

OPEN "test.bas" FOR OUTPUT AS #1
PRINT #1, "xxx"
END

Posted on Jul 6, 2013, 2:30 PM

Respond to this message   

Return to Index


Prompt to save

by Solitaire (Login Solitaire1)
S

I get the prompt every time I open and run the program. I can keep running it without another prompt, but if I close the program and reopen it to run it, the prompt comes up again. Is this normal? Is there any way to save it without the prompt coming up?

Posted on Jul 6, 2013, 4:31 PM

Respond to this message   

Return to Index


It's not normal

by lawgin (no login)

If I close the program then reopen and run it, I get no save prompt. Why should you get a prompt to save the program when you have made no changes to it? Your QB is acting a little nutty.

Posted on Jul 6, 2013, 5:18 PM

Respond to this message   

Return to Index


* She changed the BAS file name

by (Login burger2227)
R

Posted on Jul 6, 2013, 5:26 PM

Respond to this message   

Return to Index


*How do you know?

by lawgin (no login)

Posted on Jul 6, 2013, 6:40 PM

Respond to this message   

Return to Index


It's working now.

by Solitaire (no login)

I just tried running both the BOOL and CALC programs. It no longer asks to save the file.

???

Maybe I just had to close QB for awhile.

Posted on Jul 6, 2013, 11:28 PM

Respond to this message   

Return to Index


No. This can't be done...

by linuxlalala (no login)

Because QB64 generates c code, it translates the CHAIN statements to shell c statements. Also, if you look at freeBASIC's ASM output, the instruction for CHAIN is COMPLETELY missing.

Posted on Jul 6, 2013, 9:45 PM

Respond to this message   

Return to Index


Hi People!

by (no login)

Just popped in to say hi. I see QBasic is still alive and kicking--I'm amazed. And I see there's still plenty of people on here from when I was on here *waves*.

-/\lipha


*waits for the flood of replies*

Posted on Jun 19, 2013, 8:19 AM

Respond to this message   

Return to Index


*Hey, it's the Programming Kid! Hi!

by (Login qb432l)
R

*

Posted on Jun 19, 2013, 8:33 AM

Respond to this message   

Return to Index


lol. It's crazy that there's a QB64 now

by (no login)

Congrats to the maker of QB64. I downloaded it and opened it up. Making that must have been years of hard work. I'm amazed.

-/\lipha

Posted on Jun 19, 2013, 8:45 AM

Respond to this message   

Return to Index


*It's certainly great for hobby programmers like me - more capability, no learning curve.

by (Login qb432l)
R

*

Posted on Jun 19, 2013, 8:54 AM

Respond to this message   

Return to Index


Hi Alipha!

by Solitaire (no login)

How are you doing? What have you been up to? I've always had great expectations from you!

Posted on Jun 19, 2013, 6:34 PM

Respond to this message   

Return to Index


I'm good

by (no login)

I've been up to a lot. I graduated college in 2009 and worked at a web development company doing ColdFusion (Calm down people. Yes, ColdFusion isn't the greatest language. At least it's not COBOL :-) ). Then just recently, I quit that job and have been working from home doing C# web development--C# is a much nicer language :-) So I've been doing that for the past 7 months.

In other news, I bought a townhouse. I have a fiancée whom I've known for two years and we're getting married next June. I also have two cats, a dog, and a fish!

So yeah, that's pretty much everything with me. If anyone wants to chat, you should come onto ##qbasic on irc.freenode.net. Yes, there's two #'s, and yes, I'm the only one in there right now, heh.

-/\lipha

Posted on Jun 20, 2013, 7:58 AM

Respond to this message   

Return to Index


Congratulations and good luck!

by Solitaire (no login)

Best wishes on your upcoming marriage.

I've been teaching a college course on introduction to programming, using Visual Basic 2010 with a little C# thrown in. I may have to switch over to C# next semester, but haven't heard from the coordinator about any changes as of yet.

Which version of Visual Studio (2010, 2012) are you using, and which version of Windows? Note, I am now the moderator of the "Visual Basic and Visual Studio.NET" subforum, so you can post there if you wish.

I'm still using Windows XP at home, in order to be able to run the old QB without any problem. My school is using Windows 7. I'm told it's not possible to install VS 2012 on Windows XP. I was also told it is possible to create and run programs back and forth between VS 2010 and VS 2012 (as long as they don't use the new features). So that is probably what I will have to do if the school upgrades to VS 2012.


Posted on Jun 20, 2013, 1:35 PM

Respond to this message   

Return to Index


VS 2012 on Windows 8

by (no login)

Though many of my coworkers are still on Windows 7 and VS 2010, since they've been around awhile and no reason to upgrade. But I'm new, so I get new stuff! And I think Windows 8 is fine--people just freak out about little stuff like not having a start menu. I do have some gripes, but it's not about the start menu, heh (Though it was a good thing.)

Switch over to C# ;-) I'm sure the VB.NET language is much more familiar to you, but honestly, C#'s syntax is so much nicer once you get used to it.

Thanks for the wishes!

If you, or anyone here, wants to keep in touch, we should probably move this to email or somewhere else because I'm going to disappear from this forum again shortly. I don't code in QB anymore; there's no reason for me to be here. I'm sorry to disappoint anyone who thought I might be here longer.

-/\lipha

Posted on Jun 20, 2013, 3:27 PM

Respond to this message   

Return to Index


Keep in touch

by Solitaire (Login Solitaire1)
S

(C# code with my disguised email address was deleted.)

Posted on Jun 20, 2013, 5:30 PM

Respond to this message   

Return to Index


* lol, I have it. you could have just emailed me ;-)

by (no login)

Posted on Jun 20, 2013, 5:51 PM

Respond to this message   

Return to Index


GET OFF MY FORUM!

by Pete (Login The-Universe)
Admin

I hate it when people smarter than me show up out of the past. Makes me feel like Clippy!

Just kidding of course, but seriously, I think we would all would like to know if you pursued a career in programming or computer science.

Additionally, if you are using QB64, and asked to get an account at QB64, it may take awhile. Galleon probably only authorizes new requests once a month. You are more than welcome to post here about any of the new features, and although I enjoy life's role of being Clippy's mortal enemy, I would have to state Clippy really did a great job on the QB64 Wiki... except for all those %$^&$^ exclamation marks!!!!!!!!!!! (See?) Anyway, he can help a bunch with advanced graphics questions if you have any, right here. Me. I'll stick with screen 0, however, it is worth noting I was able to combine my office suite software into an 80,000 + line qb64 program, and it runs. No way possible using that much memory in QB. QB64 is a great product, indeed.

Hope to see you around,

Pete

Posted on Jun 19, 2013, 11:13 PM

Respond to this message   

Return to Index


* You get off my forum! I was here first! (or was I?)

by (no login)

Posted on Jun 20, 2013, 10:31 AM

Respond to this message   

Return to Index


You were here first.

by Pete (Login The-Universe)
Admin

I think I started posting in 2002. I recall you had some good posts, I enjoyed them. Mac owned the forum then. He became a good friend of mine, but passed away a few years ago. I still miss him. He turned the forum over to me before he passed, and thanks to those who have stayed active in QB, Rob, who developed QB64, Clippy, because every great story needs an antagonist, and Network54, which makes this place worth more because it is hosted on an antique message board system, we are still carrying on a tradition of BASIC programming in the best language I have ever had the pleasure to program in.

I do web development, too. But Cold Fusion? Come on man, get a grip!happy.gif

Pete

Posted on Jun 20, 2013, 6:13 PM

Respond to this message   

Return to Index


Pete's Qbasic Site is upgrading

by (Login burger2227)
R

Preview:

[linked image]

Posted on Jun 21, 2013, 8:11 AM

Respond to this message   

Return to Index


* The site wasn't made in QBasic? How disappointing ;-)

by (no login)

Posted on Jun 21, 2013, 8:58 AM

Respond to this message   

Return to Index


* If you can make one, then this place could use an update.

by (Login burger2227)
R

Posted on Jun 21, 2013, 9:31 AM

Respond to this message   

Return to Index


HAHA Alipha

by gopus (no login)

You huge turd.

Posted on Aug 1, 2013, 8:12 PM

Respond to this message   

Return to Index


*Hi Leaf. Nice to hear from you.

by (Login Kewbie)
R

Posted on Jun 21, 2013, 10:10 AM

Respond to this message   

Return to Index


* Kewbie! You're still on here too!

by (no login)

Posted on Jun 21, 2013, 10:44 AM

Respond to this message   

Return to Index


I'm probably more of a lurker than anything else.

by (Login Kewbie)
R

I rarely contribute, if at all, since I no longer use QB. I switched over to PowerBASIC a few years ago for my BASIC programming needs. But I still enjoy keeping up with what's going on in the old Q-munity.

Nice to see you here again, even if it's only briefly.

Kew

Posted on Jun 21, 2013, 10:36 PM

Respond to this message   

Return to Index


* Well quit lurking off and download QB64!

by Pete (Login The-Universe)
Admin

Posted on Jun 21, 2013, 11:15 PM

Respond to this message   

Return to Index


*I don't have space for it on my HD.

by (Login Kewbie)
R

Posted on Jun 21, 2013, 11:50 PM

Respond to this message   

Return to Index


Well tell Barb to give up a spa day. so you can buy a new computer!

by Pete (Login The-Universe)
Admin

Just don't tell Barb I was the one who gave you the idea.

Pete happy.gif

Posted on Jun 22, 2013, 11:16 AM

Respond to this message   

Return to Index


Yeah take it out on the woman

by (Login burger2227)
R

They should stay barefoot at home cooking for the master.

Posted on Jun 22, 2013, 3:04 PM

Respond to this message   

Return to Index


*Agree on that :)

by (Login GarryRicketson)
R

Posted on Jun 22, 2013, 7:25 PM

Respond to this message   

Return to Index


*I didn't say I didn't have space on my HD.

by (Login Kewbie)
R

Posted on Jun 22, 2013, 10:34 PM

Respond to this message   

Return to Index


Greetings

by (Login PhyloGenesis)
R

Hey Alipha,

I feel like I've seen your posts before. Like Kewbie, I'm really just a lurker as I don't program except at work anymore. I too use on C# at work on VS 2012 with ReSharper, and MAN does the combo rock hard. I'm so spoiled with it it's hard to program in anything else now. o.O

PhyloGenesis

Posted on Jun 27, 2013, 1:36 PM

Respond to this message   

Return to Index


* Oh, I remember you PhyloGenesis. And yes, it does definitely spoil people :-)

by (no login)

Posted on Jun 30, 2013, 6:39 PM

Respond to this message   

Return to Index


* Well, hello there, Alipha. ;)

by (Login ComputerGhost)
R

Posted on Jul 3, 2013, 10:52 PM

Respond to this message   

Return to Index


Prog wanted

by (no login)

Hi,

I have the task to evaluate the surface of an apartment according to plan, but the plan is complicated... the shape isn't quite simple.

So how a program would do that, first i must colorize the areas, then the program should performs an integration of that. Well, scanning each line, adding up if the color is meet..

But finally i wouldn't know how to convert the output in m2...

Ok, i do it with a decimeter

L

Posted on Jun 12, 2013, 8:48 AM

Respond to this message   

Return to Index


Re: Prog wanted

by lawgin (no login)

How about this? Display the floor plan on the screen then use POINT(x,y) to scan every pixel, keeping a running total of how many pixels are of each color. The totals would be in the same proportions as the areas of the rooms.

Posted on Jun 12, 2013, 11:15 AM

Respond to this message   

Return to Index


scale issue

by (no login)

yes,

A flood algo would be overkill.. but no, it would be perfect. Avoiding me colorizing. But anyway, the transaction was cancelled unfortunately.

One should take care about the scale too, since zooming etc introduce transformation. On my plan is written 1:50, but it's not relevant.

for 4,05 meter, i see 5.5 cm. scale would be 73..

L

Posted on Jun 12, 2013, 1:00 PM

Respond to this message   

Return to Index


nested loops

by (no login)

They should be programmed from inside out.

L

Posted on Jun 12, 2013, 12:22 AM

Respond to this message   

Return to Index

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement