Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 484
» Latest member: BigDog
» Forum threads: 2,799
» Forum posts: 26,411

Full Statistics

Latest Threads
Mean user base makes Stev...
Forum: General Discussion
Last Post: Pete
1 hour ago
» Replies: 25
» Views: 391
A question on using Infor...
Forum: Help Me!
Last Post: justsomeguy
1 hour ago
» Replies: 7
» Views: 110
New Message Box Library U...
Forum: Works in Progress
Last Post: Pete
1 hour ago
» Replies: 1
» Views: 24
SaucerZap
Forum: QBJS, BAM, and Other BASICs
Last Post: Pete
1 hour ago
» Replies: 6
» Views: 41
Let's Make a Wheel!
Forum: Help Me!
Last Post: Pete
2 hours ago
» Replies: 2
» Views: 23
GNU C++ Compiler error
Forum: Help Me!
Last Post: Kernelpanic
5 hours ago
» Replies: 47
» Views: 681
_IIF limits two question...
Forum: General Discussion
Last Post: madscijr
Yesterday, 03:53 AM
» Replies: 9
» Views: 174
What do you guys like to ...
Forum: General Discussion
Last Post: Pete
12-22-2024, 05:16 PM
» Replies: 11
» Views: 195
Fast QB64 base64 encoder ...
Forum: a740g
Last Post: a740g
12-21-2024, 04:43 AM
» Replies: 3
» Views: 472
DeflatePro
Forum: a740g
Last Post: a740g
12-21-2024, 02:11 AM
» Replies: 2
» Views: 80

 
  Bug report - Ctrl+Shift+G - Linux version 3.11.0
Posted by: Circlotron - 02-05-2024, 12:24 PM - Forum: General Discussion - Replies (2)

When an error is detected in a line of code, Ctrl+Shift+G should take the cursor to the relevant line but it does not. Instead a "G" is printed at the current line.

Print this item

  Feature Request - SOUND breaks on/off
Posted by: Abazek - 02-05-2024, 05:41 AM - Forum: General Discussion - Replies (6)

Could you add a function or statement that would turn on/off the brief break (silence) after a SOUND command?  You could have this ON by default, so things wouldn't be any different than they are now.  But, if the programmer wanted to, they could turn this OFF, to make old style SOUNDs not be so "buzzy".  Maybe something like _SoundBreakOn and _SoundBreakOff or perhaps _SoundBreak(x) where x could be 1 or 0.

As an example, try running this code in QBasic (DosBox), in QB64PE 3.6, and the current (at the time of this writing) QB64PE 3.11.
Notice the difference in sound quality for each.  In QBasic it is loud and clear.  In 3.6 it is slightly buzzy/clicky.  In 3.11 it is VERY buzzy.

Code: (Select All)
For w = 1 To 3
    For q = 100 To 2000 Step 10
        Sound q, .2
    Next q
    For q = 2010 To 110 Step -10
        Sound q, .2
    Next q
Next w
End

There is an old game I started but never finished back in the 1990's (in QBasic), that I have started to work on again in QB64PE.  It has a lot of "retro video game" style sounds that do things similar to the code above.  I've been compiling it with QB64PE 3.6 because in newer versions the sound quality is TERRIBLE, but in 3.6 it is decent.  I would much rather use the current version (QB64PE 3.11), the only thing stopping me from doing that is the poor/buzzy sound quality.

If there was a command like _SoundBreakOff that I could add to the start of my program, which would make the sound work as it does in 3.6 (or better yet, if it is at all possible, as it does in QBasic), I would be able to use the current version, which would be fantastic!!

Thanks so much for QB64PE - you all are doing some amazing work!!

Print this item

  ARRAY declaration in GOSUB routines.
Posted by: bartok - 02-04-2024, 01:05 PM - Forum: Help Me! - Replies (19)

I have noticed the following.

OPTION _EXPLICIT
[main code]
CALL test
END

SUBROUTINE test
[variable declaration]
[arrays declaration]
[CODE in which arrays are not used]
GOSUB section 1
[CODE]
section 1:
'[variable declaration]
'[arrays declaration]
[CODE in which arrays are used]
RETURN
END SUB

So, OPTION _EXPLICIT requires the declaration. If not, it get error. However, for it, it's the same that:
[variable declaration]
[arrays declaration]
is put at the beginning of the main code of the subroutine, or at the beginning of the GOSUB routine. The important, for it, is that the declaration takes place before the use of varriable and arrays to be declared.

But I noticed that if I put [arrays declaration] in the main code of the subroutine and not at the beginning of the GOSUB routine, then I have an OUT OF RANGE error executing the program with the reference to the lines in which the arrays are used.

Why?

The GOSUB routines, regardless if they are used in the main code or in a suroutine, are not considered as a part, respectively, of the main code/subroutine?

Print this item

  UBOUND
Posted by: bartok - 02-03-2024, 08:54 PM - Forum: Help Me! - Replies (5)

As you can see, I'm in the mood for questions.

Look at this:

Code: (Select All)

OPTION _EXPLICIT
DIM myArray%(5)
PRINT UBOUND(myArray%)

the result is "5".

Fine.

Look at this:
Code: (Select All)

OPTION _EXPLICIT
DIM myArray%
PRINT UBOUND(myArray%)

This is less "fine".
1. If OPTION_EXPLICIT is activeted, it says "myArray" is not defined.... why?
2. If OPTION_EXPLICIT is deactiveted, the result is "10"... why?

Print this item

  QBJS v0.8.2 - Release
Posted by: dbox - 02-02-2024, 11:29 PM - Forum: QBJS, BAM, and Other BASICs - No Replies

Hi all,

I've just published a patch update to the last QBJS release.  This fixes a couple of issues related to exported programs.  A dependency js file was not being included in the export and was preventing _Inflate$ and _Deflate$ from working correctly in the exported program.  Also, an update was made to the OPEN keyword so that it could open resources directly from the server for an exported program.

This had the interesting side-effect / new feature of being able to use OPEN to read directly from external URLs.  Here's an example with more details:

Print this item

  CLEAR command
Posted by: bartok - 02-02-2024, 10:13 PM - Forum: Help Me! - Replies (20)

Hi, I need an explanation about the command "CLEAR".

DIM a% locates a part of memory for the variable a%, that is empty.

a%=1 give to the variable a% the value 1.

What does CLEAR? Does it makes a% empty again, or does it deletes the memory located for a%, virtually "deleting" the command DIM a%?

Print this item

  suggestion: create a custom puppy linux distro that includes QB64PE out of the box
Posted by: madscijr - 01-31-2024, 08:00 PM - Forum: General Discussion - Replies (13)

I am NOT a Linux or a Puppy Linux guru, but I am drawn to the idea of an self-contained OS that runs on a thumb drive, and comes prepackaged and preconfigured with a set of software to do a certain job (e.g., play emulated games, for artists, video production, robotics, etc.)

A Puppy Linux "QB64PE" distro would be pretty cool, especially for people who might be interested in testing their QB64PE programs in Linux but don't have the knowhow / time / patience to dive into Linux proper.

Anyway, I thought I'd share this link with anyone inclined to explore spinning off their own Linux distro... 


PS Along those lines, there is at least one Puppy Linux distro - RasPup - made to run on Raspberry Pi. 
A Raspberry Pi QB64PE distro would be pretty neat & useful!

Some reading:
If this gives someone a cool project to jump into, great. 
If not, I won't lose any sleep, just thought I'd share that idea...

Print this item

  "boot to basic" mini pc!
Posted by: madscijr - 01-31-2024, 07:27 PM - Forum: General Discussion - No Replies

Some of you might find this DIY project interesting:

RETRO 1 - Home Computer Console | Hackaday.io

it's based on a project called PicoMiteVGA "Boot to BASIC" which apparently aims to recreate the old school 8-bit home computers, which started up in the BASIC prompt by default.

Good times!

It would be cool if they made something similar with a Raspberry Pi running QB64PE! Big Grin

Enjoy

Print this item

  accessing the CLI in a prog
Posted by: PhilOfPerth - 01-31-2024, 01:31 AM - Forum: Help Me! - Replies (17)

How does one access the C Prompt (CLI) from within a  QBPE programme? I don't see any functions like CMD or COMMAND, but I know it can be (and is) done frequently by members. I've tried to interpret what they did, with no success. How do I get to put Shell "c: dir" (and others) into my programme? (maybe another lesson about CLI access etc ?)

Print this item

  Item$ Tools for Getting Strings to Behave Like Arrays
Posted by: bplus - 01-29-2024, 01:58 AM - Forum: bplus - Replies (1)

Allot of people complain you can't use arrays in UDT's but you can use strings and a string can function like an array, in fact they can be more dynamic than arrays! see InsertItem$

Luke gave us some nice routines for strings behaving as numeric arrays, here I will deal with variable length strings in a bigger variable length string.

These Item$ tools are for a string of variable length strings separated by Delimiter$

Code: (Select All)
_Title "Item$() and SetItem$ test demo" ' b+ 2024-01-28
' another test demo of array like strings

months$ = "February, March, April, May, June, July, August, September, October"
Print Item$(months$, ", ", 1)
months$ = InsertItem$(months$, ", ", "January", 1)
Print months$
months$ = InsertItem$(months$, ", ", "December", 12)
Print months$
months$ = SetItem$(months$, ", ", "November", 11)
Print months$
Print "9th Month = "; GetItem$(months$, ", ", 9)

' this gets the index& number Item$ from source string delimited by delimiter$
Function Item$ (Source$, Delimiter$, Index&)
    Dim c As Long, d As Long, lastd As Long
    If Len(Source$) = 0 Then Item$ = "": Exit Function
    lastd = 1: d = InStr(lastd, Source$, Delimiter$)
    While d > 0
        c = c + 1
        If c = Index& Then
            Item$ = Mid$(Source$, lastd, d - lastd): Exit Function
        Else
            lastd = d + 1: d = InStr(lastd, Source$, Delimiter$)
        End If
    Wend
    c = c + 1
    If c <> Index& Then Item$ = "" Else Item$ = Mid$(Source$, lastd, Len(Source$))
End Function

' Insert Insert$ in Source$ Delimiter$ string at the NthPlace& all values after slide over 1 place
Function InsertItem$ (Source$, Delimiter$, Insert$, NthPlace&)
    'use: Function StrCount& (AString$, Char$ )
    'use: Function StrPlace& (AString$, Char$, Nth&)
    'use: Function StrCopies$ (NumberOfCopies&, S$)

    ReDim Astring$, wCnt&, nthPlaceAt&, head$, tail$
    Astring$ = Source$ ' Source$ gets changed so return result through function name$
    wCnt& = StrCount&(Astring$, Delimiter$) + 1
    'make sure we have enough delimiters
    If wCnt& <= NthPlace& Then Astring$ = Astring$ + StrCopies$(NthPlace& - wCnt&, Delimiter$)
    If NthPlace& <= 1 Then
        'If something there then it comes before but if nothing probably just starting out.
        If Astring$ <> "" Then Astring$ = Insert$ + Delimiter$ + Astring$ Else Astring$ = Insert$
    ElseIf NthPlace& > wCnt& Then
        ' AString$ will be modified such that only insert has to be tacked to end after delimiter
        Astring$ = Astring$ + Insert$
    ElseIf NthPlace& <= wCnt& Then
        nthPlaceAt& = StrPlace&(Astring$, Delimiter$, NthPlace& - 1)
        head$ = Mid$(Astring$, 1, nthPlaceAt& + Len(Delimiter$) - 1) ' include delim
        tail$ = Mid$(Astring$, nthPlaceAt& + Len(Delimiter$)) ' no delim
        If tail$ <> "" Then
            Astring$ = head$ + Insert$ + Delimiter$ + tail$
        End If
    End If
    InsertItem$ = Astring$
End Function

' set or edit the NthPlace in Source$ delimited string with Value$
Function SetItem$ (Source$, Delimiter$, Value$, NthPlace&)
    'use: Function StrCount& (AString$, Char$ )
    'use: Function StrPlace& (AString$, Char$, Nth&)
    'use: Function StrCopies$ (NumberOfCopies&, S$)

    ReDim Astring$, wCnt&, nthPlaceAt&, nextAt&
    Astring$ = Source$ 'AstringCopy$ gets changed so return result through function name$
    wCnt& = StrCount&(Astring$, Delimiter$) + 1
    'make sure we have enough delimiters
    If wCnt& <= NthPlace& Then Astring$ = Astring$ + StrCopies$(NthPlace& - wCnt&, Delimiter$)
    ' string$ is the problem!!!!!
    If NthPlace& > wCnt& Then ' AString$ will be modified such that only insert has to be tacked to end after delimiter
        Astring$ = Astring$ + Value$
    ElseIf wCnt& = 1 Then 'If something there then it comes before but if nothing probably just starting out.
        Astring$ = Value$
    Else ' NthPlace& is between 2 delimiters
        nthPlaceAt& = StrPlace&(Astring$, Delimiter$, NthPlace& - 1)
        nextAt& = StrPlace&(Astring$, Delimiter$, NthPlace&)
        If NthPlace& = wCnt& Then 'no delim  on right end
            Astring$ = Mid$(Astring$, 1, nthPlaceAt& + Len(Delimiter$) - 1) + Value$
        ElseIf NthPlace& <= 1 Then 'no delim of left end
            If nextAt& Then Astring$ = Value$ + Mid$(Astring$, nextAt&) Else Astring$ = Value$
        Else 'between 2 delimiters
            Astring$ = Mid$(Astring$, 1, nthPlaceAt& + Len(Delimiter$) - 1) + Value$ + Mid$(Astring$, nextAt&)
        End If
    End If
    SetItem$ = Astring$
End Function

Function GetItem$ (AString$, Delimiter$, Index As Long) ' alternate Item$() function
    'use: Function StrCount& (AString$, Char$ )
    'use: Function StrPlace& (AString$, Char$, Nth&)

    ReDim cnt As Long, p1 As Long, p2 As Long
    cnt = StrCount&(AString$, Delimiter$) + 1
    p1 = StrPlace&(AString$, Delimiter$, Index - 1)
    p2 = StrPlace&(AString$, Delimiter$, Index)
    If Index > cnt Or Index < 1 Then
        Exit Function ' beyond the limit of string
    ElseIf Index = 1 Then
        GetItem$ = Mid$(AString$, 1, p2 - 1)
    ElseIf Index = cnt Then
        GetItem$ = Mid$(AString$, p1 + Len(Delimiter$))
    Else 'between
        GetItem$ = Mid$(AString$, p1 + Len(Delimiter$), p2 - p1 - Len(Delimiter$))
    End If
End Function

Function StrCopies$ (NumberOfCopies&, S$) ' Concatenate repeated copies of S$
    Dim i&, rtn$
    For i& = 1 To NumberOfCopies&
        rtn$ = rtn$ + S$
    Next
    StrCopies$ = rtn$
End Function

Function StrCount& (AString$, S$) ' Count S$ in Astring$
    ReDim place As Long, cnt As Long, lenS As Long
    place = InStr(AString$, S$): lenS = Len(S$)
    While place
        cnt = cnt + 1
        place = InStr(place + lenS, AString$, S$)
    Wend
    StrCount& = cnt
End Function

Function StrPlace& (Astring$, S$, Nth As Long) ' Locate the place the Nth S$ is in Astring$
    ReDim place As Long, cnt As Long, lenS As Long
    place = InStr(Astring$, S$): lenS = Len(S$)
    While place
        cnt = cnt + 1
        If cnt = Nth Then StrPlace& = place: Exit Function
        place = InStr(place + lenS, Astring$, S$)
    Wend
End Function

Print this item