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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 483
» Latest member: aplus
» Forum threads: 2,795
» Forum posts: 26,345

Full Statistics

Latest Threads
GNU C++ Compiler error
Forum: Help Me!
Last Post: bplus
21 minutes ago
» Replies: 21
» Views: 272
What do you guys like to ...
Forum: General Discussion
Last Post: Pete
1 hour ago
» Replies: 11
» Views: 155
Mean user base makes Stev...
Forum: General Discussion
Last Post: Pete
Yesterday, 06:39 PM
» Replies: 8
» Views: 225
Fast QB64 base64 encoder ...
Forum: a740g
Last Post: a740g
Yesterday, 04:43 AM
» Replies: 3
» Views: 458
_IIF limits two question...
Forum: General Discussion
Last Post: bplus
Yesterday, 02:56 AM
» Replies: 6
» Views: 117
DeflatePro
Forum: a740g
Last Post: a740g
Yesterday, 02:11 AM
» Replies: 2
» Views: 72
New QBJS Samples Site
Forum: QBJS, BAM, and Other BASICs
Last Post: dbox
12-20-2024, 06:16 PM
» Replies: 25
» Views: 902
Raspberry OS
Forum: Help Me!
Last Post: Jack
12-20-2024, 05:42 PM
» Replies: 7
» Views: 162
InForm-PE
Forum: a740g
Last Post: Kernelpanic
12-20-2024, 05:22 PM
» Replies: 80
» Views: 6,192
Merry Christmas Globes!
Forum: Programs
Last Post: SierraKen
12-20-2024, 03:46 AM
» Replies: 10
» Views: 151

 
  The Width statement
Posted by: eoredson - 04-05-2024, 04:43 AM - Forum: Help Me! - Replies (15)

Since QB64pe has declared full functional QB45 compatible I have posted this snippet:

The QB45 contains Width with Device$

Code: (Select All)
' sample program to set Width statements.
Dim screenwidth As Integer
Dim screenheigth As Integer

Dim widthx As Integer
widthx = 80

screenwidth = 80
screenheight = 25

' reset file width
filenumber = FreeFile
Open "tempfile.xyz" For Output As #filenumber
Width #filenumber, widthx

' reset some printers
Width "lpt1:", widthx
Width "lpt2:", widthx
Width "lpt3:", widthx

' resets some drvies
Width "cons:", widthx
Width "scrn:", widthx

' reset lprint
Width LPrint widthx

' reset screen
'PRINT screenwidth, screenheight
Width screenwidth, screenheight
End

Where:

Code: (Select All)
WIDTH Statement Details  
    
Syntax  
   WIDTH [columns][,lines]  
   WIDTH {#filenumber | device},width  
   WIDTH LPRINT width  
    
Both files and devices can be assigned an output-line width.  
    
  Syntax                    Description  
  WIDTH [columns][,lines]   Sets the number of columns and lines to  
                            display on the screen.  
    
                            The value of columns must be either 40 or  
                            80. The default value is 80.  
    
                            The value of lines may be 25, 30, 43, 50,  
                            or 60, depending on the display adapter  
                            used and the screen mode (see the SCREEN  
                            statement help topic for more information).  
                            The number of lines displayed when the program  
                            started will determine the default value.  
    
  WIDTH #filenumber,width   Sets the line width of an output device opened  
                            as a file (for example, LPT1: or CONS:).  
    
                            The filenumber argument is the number  
                            associated with the file in the OPEN  
                            statement.  
    
                            This form permits altering the width while  
                            a file is open, since the statement takes  
                            place immediately.  
    
  WIDTH device,width        Sets the line width of device (a device file  
                            name).  
    
                            The device should be a string expression  
                            (for example, "CONS:").  
    
                            Note that this width assignment is deferred  
                            until the next OPEN statement affecting the  
                            device; the assignment does not affect output  
                            for an already open file.  
    
  WIDTH LPRINT width        Sets to width the line width of the line  
                            printer, for use by subsequent LPRINT  
                            statements.

Print this item

  Using color in Draw string
Posted by: PhilOfPerth - 04-04-2024, 05:49 AM - Forum: Help Me! - Replies (30)

How do I (or can I) nominate a colour for the string in this code?

Code: (Select All)
WWidth = 1120: WHeight = 820: Mode = 32: Size = 24
Screen _NewImage(WWidth, WHeight, Mode)
SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", Size, "monospace"): _Font f&
lhs = (_DesktopWidth - WWidth) / 2
_ScreenMove lhs, 86 ' centre display on screen
CPL = WWidth / _PrintWidth("X")

PSet (500, 200): Draw "r100d100l100u100"
Sleep


 I've tried adding C3 etc to the front, which is accepted but ignored, and C_rgb(...) which errors out.

Print this item

  Welcome TheBOB!!
Posted by: SMcNeill - 04-04-2024, 03:23 AM - Forum: General Discussion - Replies (7)

Welcome THE Bob!  Just saw your name as our latest member joined.  Welcome home!!  Big Grin

Print this item

  Reverse search and case-insernsitive search routines
Posted by: TDarcos - 04-04-2024, 12:35 AM - Forum: Utilities - Replies (6)

i had a need of a routine to do the opposite of INSTR( in which I wanted to find the last appearance of a search field in the target string. So I wrote the following functions:

  1. '  Reverse instr: finds last position of search in target
    Function Rinstr& (Target As String, Search As String)
  2. ' Case insensitive search
    Function Iinstr& (start As Long, Target As String, Search As String)
  3. ' Case insensitive reverse seaarch
    Function RIinstr& (Target As String, Search As String)

I'm not sure how useful this would be, but I suspect someone is going to need one of these at some point.

The functions include a program that runs a set of tests to confirm they work.



Attached Files
.bas   rinstr.bas (Size: 1.95 KB / Downloads: 46)
Print this item

  Akalabeth or Ultima 0 RPG, commented and labeled = hackable!
Posted by: madscijr - 04-03-2024, 11:43 PM - Forum: Works in Progress - No Replies

If anyone wants to play with the code for the early adventure game Akalabeth by Richard Garriott & learn how to make a dungeons and dragons style role playing game (or customize it), I cleaned up the spaghetti code somewhat 

  • broke up all multi-statement lines
  • all IF statements have a matching END IF
  • got rid of line numbers, any GOTO / GOSUB destinations instead use a friendly label
and added inline comments that describe what most of the lines are doing (from jtauber's in-depth analysis). 

The map graphics could do with some updating to classic tile graphics (or even roguelike ascii or codepage 437) and the interface could be made friendlier, but as is, it presents a workable framework for learning how to make a basic RPG & dungeon crawler. (I'd eventually like to extract the Ultima 1 BASIC source code from a disk image and get it working in QB64PE & similarly cleaned up + commented, anyone want to help? :-)

Anyway this is the game that came before Ultima 1. See what you can do with it...

(I guess it's too long to post in a code window, so attaching...)

UPDATE: I located where I got the original source code 
https://www.instructables.com/Simple-adventure-game/

The code comments came from
Akalabeth Main Game File | Game File Hacking by jtauber

The original Apple II code can be found at
https://archive.org/details/a2_Akalabeth...Computer_a
also https://gist.github.com/jtauber/9863811

A more recent port of Akalabeth to GWBASIC can be found at:
https://nanochess.org/akalabeth.html
which includes some background on the game, and details of converting AppleSoft BASIC to GW-BASIC (which for the most part runs in QB64PE).



Attached Files
.bas   akala22.bas (Size: 102.68 KB / Downloads: 24)
Print this item

  For our Developers...
Posted by: Pete - 04-03-2024, 10:40 PM - Forum: General Discussion - Replies (16)

Ever consider adding _SAVE and _SAVEAS? I was thinking today (shut up Steve) that since someone changed the IDE save function to a more Windows type look, it might be fairly easy to code these nice features and add them to our keywords, much like the _InputBox feature.

I figure as long as we never lose our BASIC buildings blocks, to be able to build these functions from scratch, additions like this can't hurt the language and they might make the language more attractive to new users.

Oh, and as a side note, did you folks know the IDE cannot correctly save a program with certain control characters enclosed in quotes? Easy enough to work around that by making the string as CHR(0) + CHR$(1)... etc. Anyway, just thought I'd bring it up in case anyone has the time to look into it, after you're done poking fun at Steve's code while on Discord.

Pete

Print this item

  Screen size
Posted by: emfril - 04-03-2024, 10:08 PM - Forum: Help Me! - Replies (3)

I have written a program that reads the coastline coordinates of the continents and prints custom perspectives. I've been using SCREEN 12, which is 320x240 pixels:

https://emf.neocities.org/tmp/WestCiv.png

I would like to make the screen bigger, but if I use the _FULSCREEN command the image is distortedQ

https://emf.neocities.org/tmp/WestCiv2.png

I could of course change the code so that the full screen is not distorted. But I wonder: Is there a way to  make it as big as possible but preserve the aspect ratio?

And, even better: can I specify the size of a (larger) screen in pixels? I would certainly like to increase the shight of the image to that of my screen and have a better resolution.

Thanks.

Print this item

  Port of Paul Dunn's Bubble Universe to QB64-PE + InForm-PE
Posted by: a740g - 04-03-2024, 09:38 PM - Forum: a740g - Replies (2)

This is tiny little fun port of Paul Dunn's (ZXDunny) "Bubble Universe" demo to QB64-PE and InForm-PE.

I threw the port into an InForm project just to see what would happen if I tweaked some of the values during runtime. Well, now I know.


[Image: Screenshot-2024-04-04-025851.png]

Have fun!



Attached Files
.zip   Bubble-Universe.zip (Size: 202.01 KB / Downloads: 54)
Print this item

  Arrays of record variables
Posted by: Kernelpanic - 04-02-2024, 06:58 PM - Forum: General Discussion - No Replies

I didn't find anything about arrays of record variables in the wiki. Here is an example of how to create such arrays.
The first representation is specified in the program, the second can be entered yourself.
Hm, is not a programm, so here.

Code: (Select All)

'Recordarrays. Uebergabe von Recordtype an Array - 1. April 2024

$Console:Only

Option _Explicit

Declare Sub Anzeigen(Motorrad As Any)

'Definition der Datenstruktur
Type MotorradModell
  Modell As String * 30
  Farbe As String * 10
  Hubraum As String * 10
  Kilowatt As String * 15
  Fahrgewicht As String * 10
  Preis As String * 12
End Type

'Array. Global zur Verfuegung stellen in diesem
'Fall nicht noetig.
Dim MotFeld(1 To 10) As MotorradModell

'Modell eingeben
MotFeld(1).Modell = "Honda 350 CB"
MotFeld(1).Farbe = "Rot-Weiss"
MotFeld(1).Hubraum = "350 ccm"
MotFeld(1).Kilowatt = "23 Kilowatt"
MotFeld(1).Fahrgewicht = "156 KG"
MotFeld(1).Preis = "2355.00 Euro"

Locate 2, 0
Print "Daten Selbst eingeben:"

Locate 3, 0
Input "Modell    : ", MotFeld(2).Modell
Input "Farbe      : ", MotFeld(2).Farbe
Input "Hubraum    : ", MotFeld(2).Hubraum
Input "Kilowatt  : ", MotFeld(2).Kilowatt
Input "Fahrgewicht: ", MotFeld(2).Fahrgewicht
Input "Preis      : ", MotFeld(2).Preis

Cls 'Eingabe nicht stehen lassen
Locate CsrLin + 1, 0

'Uebergabe des Arrays von Recordvariablen, und anzeigen
Call Anzeigen(MotFeld(1))

'CsrLin ist noetig, da es sonst zu einer
'Ueberschneidung der Ausgabe kommt
Locate CsrLin + 2, 0
Call Anzeigen(MotFeld(2))

End 'Hauptprogramm

Sub Anzeigen (Motorrad As MotorradModell)

  Print Tab(4); "Modell    : ", Motorrad.Modell
  Print Tab(4); "Farbe      : ", Motorrad.Farbe
  Print Tab(4); "Hubraum    : ", Motorrad.Hubraum
  Print Tab(4); "Kilowatt  : ", Motorrad.Kilowatt
  Print Tab(4); "Fahrgewicht: ", Motorrad.Fahrgewicht
  Print Tab(4); "Preis      : ", Motorrad.Preis
End Sub

[Image: Arrays-von-Recordvariablen2024-04-02.jpg]

Print this item

  Spring Banner Contest (2024) -- VOTE
Posted by: SMcNeill - 04-02-2024, 03:26 PM - Forum: General Discussion - Replies (25)

#1 -- by SMcNeill

[Image: attachment.php?aid=3057]



#2 -- by dbox

[Image: attachment.php?aid=3021]



#3 -- by bplus

[Image: attachment.php?aid=3015]



#4 -- by sprezzo

[Image: qb64pebanner2023.png]



#5 -- by Pete

[Image: attachment.php?aid=2964]



#6 -- by KernalPanic

[Image: QB64-Logo-Fruehling-GR2024.jpg]

Print this item