r/qb64 • • Nov 18 '23

Question In QB64, do I need to put direct path ?

0 Upvotes

By direct path, I mean like "C:\Dev\qb64_dev\FBD\puns.txt" ?

Can't I just do "./puns.txt" if the program is in the same dir like in Python or JS ? I tested and it says file not found.

'20 lines and more

_Title "FBD Broadcast Reader"

Open "C:\Dev\qb64_dev\FBD\puns.txt" For Input As #1

10

For x% = 1 To 20

Line Input #1, line$ ' A way to loop threw until the 1st 20 lines area read in

Print line$

Next x%

Input "Read more or Quit"; responce$

If responce$ = "Go On" Then

Cls

GoTo 10 'starts over and gets the next 20

Else

Close #1

System

End If


r/qb64 • • Nov 04 '23

I am looking to create and NEXT level PRNG that can be used in both encryption and in games etc it will be integer based up until it spits out a random number the program would be a function

1 Upvotes

I would like to write a function to generate prng #'s unlimited perfect random numbers using an integer based maths system, and at one final step the prng creates a floating point value that is 0 -1, it would be nice if this were a 256 bit float value or that the seed it accepts is 256 bits and it would have an incredibly long "cycle" or maybe even no periodic cycle.. just pure random values from software no devices used...


r/qb64 • • Nov 18 '23

Question In QB64, do I need to put direct path ?

1 Upvotes

By direct path, I mean like "C:\Dev\qb64_dev\FBD\puns.txt" ?

Can't I just do "./puns.txt" if the program is in the same dir like in Python or JS ? I tested and it says file not found.

'20 lines and more

_Title "FBD Broadcast Reader"

Open "C:\Dev\qb64_dev\FBD\puns.txt" For Input As #1

10

For x% = 1 To 20

Line Input #1, line$ ' A way to loop threw until the 1st 20 lines area read in

Print line$

Next x%

Input "Read more or Quit"; responce$

If responce$ = "Go On" Then

Cls

GoTo 10 'starts over and gets the next 20

Else

Close #1

System

End If


r/qb64 • • Oct 09 '19

C++ Compiler errors for no reason on Win 64 bit systems. Utterly ridiculous! What's the fix?

0 Upvotes

(SOLVED! - SEE LAST FEW COMMENTS. THANKS!)

Ok, the C++ Compilation errors have gotten to ridiculous levels. I have to trick the IDE into thinking it's a new program to run, either by renaming and quickly saving the program as a .BAS file with a new name, or copy/pasting the code to after a "new" program with the editor and running it. I am able to compile and run the program several times then (tested) AS LONG AS I DON'T EDIT EVEN 1 CHARACTER. THE MOMENT I EDIT A SINGLE CHARACTER, I GET A C++ COMPILATION ERROR...EVEN IF IT'S JUST A SPACE BAR PRESS.

This is utterly ridiculous, amateurish, and unprofessional. I NEVER had this issue before, but now it's there. I thought maybe it was my version of Windows 7, or even the version of Windows 8 or 10 on the other machines. I decided to start fresh with a virtual machine and a fresh copy of Windows 7, 8, and 10 respectively with NO other programs installed. I then downloaded QB64 GL straight from the site and ran it. Guess what? It is doing the exact same thing.

QB64 would be utterly UNUSABLE if not for the fact that I also have a Linux partition, and I have QB64 for that as well. The Linux version of QB64 WORKS, THE WINDOWS VERSION DOES NOT COMPILE ANYMORE! I also wanted to note that I get random IDE errors on line 15,671 randomly (only on the main machine) when I compile and run programs it doesn't like or there are high memory loads. It will say that, then act like there is a file/path access error, and then completely crash. Although that isn't happening with the virtual machines and the Windows 8 and 10 systems, those are still not compiling the same as the Win7 system and spitting out BS errors for C++ Compilation.

The Mac OS X version works flawlessly as does the Linux version, and the old Windows 2000 and QB64 0.9 from 2011 work fine on it. QB64 GL works in an emulator with Windows XP SP3 and (thus far) doesn't crash or give the C++ Compilation errors...but each of the other systems for Windows 7,8, and 10 as 64 bit versions do.

Running compiled programs with compatible target systems after compile (if successful) does not crash.

My question is this: What the hell has happened to QB64 for WINDOWS to where it crashes if I press the space bar or add a comma or comment? WHO is managing the source code and the compiler and these changes to make it do this?! And what exactly has been changed to where it spits bogus C++ compiler errors from G++ the moment a single character is edited or changed? Can this be fixed, or is QB64 too far gone at this point?

I first started to notice this after Android support was added to QB64. It seems that whatever was going on with the builds after that, it started to crash and refuse to run anything anymore...

Any input or ideas to fix this for Windows would be nice. Right now, the only way I am able to write target programs for QB64 for Windows is to use the emulator and Windows XP, compile it, then pass it over the network drive to the Windows 7 machine.

Linux and Mac OS X still work fine...but neither of those 2 older versions have any Android support, and I don't believe they were the GL versions, either. I can compile and run on those. I've seen a few other people posting about this, and know that I'm not alone. I hope that an answer to this question will help others here and anyone searching online who are currently experiencing the same thing.


r/qb64 • • Nov 18 '23

Question Who could convert me this JS to qb64

Thumbnail self.qbasic
2 Upvotes

r/qb64 • • May 08 '19

Efficiency Tip - Learn Which Operations Are Fast/Slow

2 Upvotes

This is probably common knowledge among more experienced coders but since QB is regarded as a beginner language so it's worth pointing out (I'm a beginner too). Some math operations are much faster than other functionally identical ones.

x + x is faster than x*2

x * 0.5 is faster than x / 2

x*x is much much faster than x^2

etc

x = x + x + x + x is still quicker than x = x*4 but obviously there would reach a point where multiplication is quicker and In a lot of cases the extra nano seconds per operation won't make a noticeable difference and readability is often preferable but if you're trying to for example pump millions of pixels to the screen per second using PSET and For loops knowing this can make a huge difference to performance.

I've written a short program which compares the performance of 5*5*5*5*5 to 5^5, 5^5 is far far slower. Have a play around and test other operations

aTotal = 0
bTotal = 0

PRINT "5^5 (Seconds)", , "5 = 5 * 5...Seconds", "For 1M Loops"
FOR count = 1 TO 20

    a## = TIMER
    FOR i = 1 TO 10000000
        x = 5 ^ 5
    NEXT i
    a## = TIMER - a##
    aTotal = aTotal + a##
    b## = TIMER
    FOR i = 1 TO 10000000
        x = 5 * 5 * 5 * 5 * 5
    NEXT i
    b## = TIMER - b##
    bTotal = bTotal + b##
    PRINT a##, , b##
NEXT count
PRINT aTotal; "Seconds", , bTotal; "Seconds"

r/qb64 • • Apr 18 '22

Can't seem to figure out how to play audio

2 Upvotes

I'm trying to make a tiny program to open an .mp3 file that I have downloaded on my computer. I'm making this one as practice for a larger one that I've been working on. Anyone mind telling me what I'm doing wrong here?

Dim Lavender

Lavender = _SndOpen("C:\Users\datbo\Desktop\lavender.mp3")

_SndPlay Lavender


r/qb64 • • Jan 03 '21

PREDICT ME 0.1

2 Upvotes

PREDICT ME 0.1 for MS-DOS is a very simple program, made to generate predictions. It will choose random sentences, messages and predictions and put them together to create a personal and unique text about one's future. At the moment it's only available in SPANISH. THE *.BAS FILE IS INCLUDED IN THE ZIP JUST IN CASE YOU WANT TO CHECK IT OUT. https://archive.org/details/predict-0.1


r/qb64 • • Mar 17 '22

☘️ HAPPY ST. PATRICK'S DAY! ☘️

Thumbnail self.qbart
3 Upvotes

r/qb64 • • Sep 20 '23

My text adventure framework gets a GUI

14 Upvotes

r/qb64 • • Apr 07 '22

Blast from the past - QBasic 4.5

Thumbnail
warped3.substack.com
7 Upvotes

r/qb64 • • Mar 29 '22

I just made a tech demo that scales up the pixels while emulating the aspect ratio of SCREEN modes 2 and 8 from GW-BASIC and QBasic. Because QB64 often uses square pixels by default even for legacy SCREEN modes that were intended for tall pixels.

Thumbnail self.qbart
2 Upvotes

r/qb64 • • Feb 25 '22

News within the last week, I created a few new subreddits to share programs made with QB64 and other QB family interpreters for some specialized purposes, so I can allow r/qb64 to have tech support posts be more visible to subscribers.

6 Upvotes

I created a few of these subreddits for some good purposes:

/r/QBmusic, I created this sub so we can share music compositions using the PLAY command

/r/QBprograms, I created this sub so QB and GW programs in general can be shared.

/r/QBart, I created this so we can share some visual art that uses QB code to render.

and I plan to create a few more sister subs for other specialty program categories later on.


I created the above subreddits, so that way I can share my programs in a separate sub, while I allow subscribers in /r/qb64 post for tech support help and other types of things to say about QB64.


r/qb64 • • Mar 05 '22

A program that uses LOCK KEYS to toggle color bits, my first program to make use of all three LOCK keys, as well as my first program to make use of any LOCK key for purposes outside of their primary functions.

Thumbnail self.qbprograms
1 Upvotes

r/qb64 • • Mar 25 '22

I just made a clock that uses the grille ASCII characters of text mode in place of the pixels of the digit text characters of a _SOURCE image handle.

Thumbnail self.qbart
2 Upvotes

r/qb64 • • Mar 09 '22

SCREEN 0 color PALETTE value switchboard, a useful tool for toggling switches of the 6-bit range of colors one can assign to 16 simultaneous attributes for creation of ASCII art.

Thumbnail self.qbart
3 Upvotes

r/qb64 • • Mar 24 '22

A demonstration of converting QB64 image handle pixels to ASCII characters in SCREEN 0 text mode

Thumbnail self.qbart
2 Upvotes

r/qb64 • • Apr 08 '22

InForm – A GUI engine and WYSIWYG interface designer for QB64, it is somewhat similar to Visual Basic

Thumbnail
inform.qb64.org
4 Upvotes

r/qb64 • • Mar 14 '22

I just wrote a program to resemble a post-it-note

Thumbnail self.qbart
2 Upvotes

r/qb64 • • Jan 06 '21

Question OPENING A .EXE FILE WITH QB64

3 Upvotes

I actually made a few programs with qb64..and i want to open them through a program in which it displays all the programs i made and which you want to open...any such program ideas please...


r/qb64 • • Feb 05 '21

I made a (***very*** crude) window manager in QB64! =D Just thought I'd show it here, as I'm quite proud of it.

Post image
8 Upvotes

r/qb64 • • Nov 29 '19

Question How do I use a _RGB32 with PSET?

1 Upvotes

I’m using the SCREEN _NEWIMAGE(x, y, 32) graphics screen and I’m trying to use a specific color with PSET but it’s not working. Can someone help?

Also: I am having this problem with the PAINT statement.


r/qb64 • • Apr 05 '23

Global arrays in QB64

1 Upvotes

I am a newcomer to QB64, my only previous experience was messing around with the sample programs years ago. I am porting a Minesweeper game I made in Python to QB64. One issue I am running into is that QB64 does not let you create global variables inside functions. In my original Python code, I have a function called newGame which creates the Level array, as well as variables such as the level width and height and the number of mines. The function then determines if the player is retrying the same level or starting a new level, and if so asks the player the level width, height, number of mines and assigns those to the previously mentioned variables and passes them to a function called generateLevel, which returns an array which is then assigned to the Level array. The main game loop is then called, with the aforementioned variables and Level array passed to it. If not, then the function skips all the way to calling the main game loop, and because the Level array is global, the previous level is preserved.

In QB64, you cannot create global variables inside functions, so I had to move the width/height/mines variables to the main program. However, I'm not sure what I can do with the level array. Because the size of the level array is determined by the user's input, I cannot simply move the DIM statement to outside of the function. If the DIM statement is kept inside the function, and I simply do not make it SHARED, then it obviously does not work properly - while the player can generate a new level, if the player wants to retry the same level then it will not work, as the contents of the Level array are lost.

How might I be able to work around this issue? I can provide code if necessary, but it's pretty terrible on both the Python and QB64 side.


r/qb64 • • Apr 11 '23

Question Shifting a 2D array down in QB64

3 Upvotes

Let's say I have a 2D array in QB64 that looks like this:

0, 0, 1, 0, 0
1, 1, 0, 0, 1
1, 1, 0, 0, 0
0, 0, 1, 1, 1
1, 0, 1, 1, 0

I want to shift the array down, so that after 1 iteration it would look like this:

0, 0, 0, 0, 0
0, 0, 1, 0, 0
1, 1, 0, 0, 1
1, 1, 0, 0, 0
0, 0, 1, 1, 1

And after 3 iterations it would look like this:

0, 0, 0, 0, 0
0, 0, 0, 0, 0
0, 0, 0, 0, 0
0, 0, 1, 0, 0
1, 1, 0, 0, 1

I'm sure you get the idea. This is the code I have right now to do this (Pretend that the array is 11x6 and not the 5x5 example I gave):

For K = 1 To 6
    For L = 0 To 11
        Board(L, 7 - K) = Board(L, 6 - K)
    Next L
Next K
For K = 0 To 11
    Board(K, 0) = 0
Next K

Is there a less beginner and/or more QB64-like way to do this? Sorry if this is a stupid question, I am a beginner to QB64 and though I know other languages I'm not great at them either.


r/qb64 • • May 30 '22

I just made some time-scale comparisons between the introduction of Microsoft BASIC, QBasic 1.1's year of release, and next year's anticipated SWEET 16 of QB64.

Thumbnail self.timescalecomparisons
5 Upvotes