Recent Posts

Pages: [1] 2 3 ... 10
1
QB64 Discussion / Re: Using DavsIDE for QB64 editor or Steves
« Last post by RhoSigma on October 16, 2017, 10:37:39 pm »
@RhoSigma my revised Notepad++ numbers reflect my ignorance as to what is safe to throw out including a copy of your extracted .zip for setting up Notepad++ for QB64. I left in all the plug-ins for PL's because I have several of them and eliminated all languages but 2 for English.

As to your provided screenshot:
NppThemesQB can be completely deleted, if you're done with installing the stuff. QB64Library and QB64GuiTools are not required for the NPP/QB keyword/shortcus stuff, I just mentioned it in NppThemesQB/Info.txt, as its keywords are part of the NPP/QB UDL. If you wanna keep these two, then move them  into your qb64 folder, that's where they belong to, otherwise the libs/examples in it won't probably work, as the $INCLUDEs within doesn't match the right location then.
2
Development / Re: BETA TESTERS WANTED: QB64 1.2 release candidate
« Last post by Petr on October 16, 2017, 10:20:12 pm »
Johny B: Thank you. We have the same view. I wanted to answer with the answer that what Fellippe writes about the programmer can be said about the developer when he apologizes for this mistake in this way as he wrote ..... but I did not want to irritate him.
3
QB64 Discussion / Re: Using DavsIDE for QB64 editor or Steves
« Last post by bplus on October 16, 2017, 09:42:38 pm »
I think for a number of reasons Notepad++ edges out Davs IDE:

+ Multiple files can be viewed in tabbed listings AND as we discussed recently two files can be viewed side by side in Notepad

+ Notepad++ can be used for many other things as well as QB64 editor, why learn a new editor for every language you want to try?

+ much more learning to use Notepad because of all the features available. Learning is a plus if not overwhelming and app works intuitively.

+ With RhoSigma's help it worked right out of the box, for me Davs IDE did not though fixable (I think).

The tables would be completely be turned if Dav was around and actively updating AND/OR it was a QB64 app with source code available.

I don't see myself abandoning the QB64 IDE, I like it's syntax checking and line formatting. OK's

@RhoSigma my revised Notepad++ numbers reflect my ignorance as to what is safe to throw out including a copy of your extracted .zip for setting up Notepad++ for QB64. I left in all the plug-ins for PL's because I have several of them and eliminated all languages but 2 for English.
4
Development / Re: BETA TESTERS WANTED: QB64 1.2 release candidate
« Last post by rezo on October 16, 2017, 07:56:46 pm »
Quote
All-in-all, what QB64 has been doing since version 1.000 when you try to load an image in 256-color mode is to ignore the directive and actually load it in 32bit mode. The way we're attempting to bring back the functionality is hacky right now and it makes me wonder if people really have been missing this ability since the switch from version .954 to version 1.000.

I've been missing 8-bit screen modes quite a bit. Have a program that uses a bunch of massive monochrome images and it's a needless memory hog, so  I dove onto this update to test it out. Unfortunately the program took several times longer to load  and it ended up using more memory than before. Hopefully a good solution emerges at some point =\

5
Development / Re: BETA TESTERS WANTED: QB64 1.2 release candidate
« Last post by Johny B. on October 16, 2017, 06:46:45 pm »
Now now, let's not get too worked up. Repeat after me everyone: "C++ compilation errors are QB64 bugs". Once more with feeling now: "C++ compilation errors are QB64 bugs". Well done everyone.

This bug has been in there for a while, actually. I'm surprised no one noticed it until now.
6
Sample Programs / Re: Addition to QBASIC Chess
« Last post by bplus on October 16, 2017, 06:20:38 pm »
Hi TempodiBasic and all,

If I understand your last reply, you are working to make this a game so a player can choose either Black or White and the computer plays the other color and hoping the AI can play both ways (maybe with some fixes)?

Good goal!

And for that, you want to get getInput simplified because it does have a very similar code block repeated while trying to get the 2nd click.

Getting these clicks you would think would use a very similar code block but while getting the second click, we worry about highlighting mouse over blocks, not needed when getting first click, so there are two different modes of getting the click off the board.

But also while waiting for clicks, there is possibility the user will just Ctrl+K and enter the whole move through keyboard. Need to be on alert in code for that option as well.

Here is an idea for another approach that might by-pass this sneaky recursion that creeps in.
Left mouse button down on the piece to move, drag mouse / highlight squares until the Left mouse button is released on the square to move the piece to. Get the two positions from one click.

I think Fellippe's solution worked around this, assuring that mouse up square was THE SAME as the mouse down square. We could try the opposite!

On the other hand, I have learned from feedback from others about a game I developed in another PL using mouse down, dragging and mouse up, that mouse dragging, moving the mouse while left button is held down is not particularly enjoyed by users.

I am curious of other peoples thoughts on this.
7
Sample Programs / WEB Site Crawler & Grabber
« Last post by eoredson on October 16, 2017, 06:06:29 pm »
This is a program which crawls the index.html of any WEB site and allows you to download source files..

Source files could contain .gif or .jpg, etc. This code is QB64 public domain 2017.

Code: [Select]
REM Crawler2.bas  -  The WEB site index.html crawler. v1.0a PD 2017 ejo.

REM uses C:\TEMP for index.htm, and C:\TEMP\dload.htm for files downloaded.

REM $DYNAMIC

DECLARE DYNAMIC LIBRARY "kernel32"
    FUNCTION CreateDirectoryA% (F$, BYVAL X&&)
    FUNCTION SetCurrentDirectoryA% (f$)
END DECLARE

DECLARE DYNAMIC LIBRARY "urlmon"
    FUNCTION URLDownloadToFileA% (BYVAL pCaller AS LONG, szURL AS STRING, szFileName AS STRING, BYVAL dwReserved AS LONG, BYVAL lpfnCB AS LONG)
END DECLARE

DIM SHARED HtmlTags(1) AS STRING
DIM SHARED NumTags AS SINGLE

DIM SHARED HtmlSrc(1) AS STRING
DIM SHARED NumSrc AS SINGLE

DIM SHARED StartDir AS STRING
DIM SHARED TempDir AS STRING
DIM SHARED URLfile AS STRING

DIM SHARED URLdload AS STRING

CONST TempUrl$ = "tempindex.htm"

' force default path
x$ = _STARTDIR$
StartDir$ = x$
IF RIGHT$(StartDir$, 1) <> "\" THEN
    StartDir$ = StartDir$ + "\"
END IF
f$ = x$ + CHR$(0)
x = SetCurrentDirectoryA(f$)

TempDir$ = "C:\TEMP\"
IF _DIREXISTS(TempDir$) = 0 THEN
    f$ = TempDir$ + CHR$(0)
    x = CreateDirectoryA(f$, 0)
END IF

URLdload = "C:\TEMP\dload.htm\"
IF _DIREXISTS(URLdload) = 0 THEN
    f$ = URLdload$ + CHR$(0)
    x = CreateDirectoryA(f$, 0)
END IF

' File to save URL as
URLfile$ = TempDir$ + TempUrl$

' URL to grab (page or a file)
CLS
COLOR 15
PRINT "Sample URL:"
COLOR 14
PRINT "http://www.starbase3.com/"
DO
    COLOR 15
    LOCATE , , 1
    PRINT "Enter URL";
    INPUT URL$
    IF URL$ = "" THEN END
    r = Crawl(URL$)
    IF r = 0 THEN
        COLOR 11
        PRINT "Site not found."
    END IF
    IF r THEN
        DO
            COLOR 15
            PRINT "URLS:"; NumTags
            PRINT "SRC:"; NumSrc
            PRINT
            PRINT "URL Menu:"
            COLOR 14
            PRINT " (D)ownload"
            PRINT " (G)rab ALL"
            PRINT " (S)RC list"
            PRINT " (U)RL list"
            COLOR 15
            PRINT "Option(Q to Quit)";
            Quit = 0
            DO
                _LIMIT 50
                LOCATE , , 1
                x$ = LCASE$(INKEY$)
                IF x$ = "q" THEN Quit = -1: PRINT: EXIT DO
                IF x$ = "d" THEN PRINT: CALL Download(URL$): EXIT DO
                IF x$ = "g" THEN PRINT: CALL DownloadAll(URL$): EXIT DO
                IF x$ = "s" THEN
                    PRINT: CALL SrcList: EXIT DO
                END IF
                IF x$ = "u" THEN
                    PRINT: CALL TagList: EXIT DO
                END IF
            LOOP
            IF Quit THEN EXIT DO
        LOOP
    END IF
LOOP
COLOR 7
END

FUNCTION Crawl (URL$)
NumTags = 0!
NumSrc = 0!
IF RIGHT$(URL$, 1) <> "/" THEN
    URL$ = URL$ + "/"
END IF

' get index.html
IF DownloadHtml&(URL$, URLfile$) > 0& THEN
    Crawl = 0
    EXIT FUNCTION
END IF

' init index.html
C& = GetTags(TempUrl$)

' search for <a href="sitepage.htm">
Z! = 0!
DO
    Z! = Z! + 1!
    IF Z! > NumTags THEN
        EXIT DO
    END IF
    Html$ = HtmlTags(Z!)
    IF LEFT$(Html$, 1) = "/" THEN
        Eat$ = ""
    ELSE
        IF LEFT$(Html$, 5) = "http:" THEN
            Eat$ = ""
        ELSE
            IF LEFT$(Html$, 6) = "https:" THEN
                Eat$ = ""
            ELSE
                IF RIGHT$(Html$, 4) = ".htm" THEN
                    NextURL$ = URL$ + Html$
                    IF DownloadHtml&(NextURL$, URLfile$) = 0& THEN
                        C& = GetTags(TempUrl$)
                        D& = GetSrc(TempUrl$)
                    END IF
                END IF
            END IF
        END IF
    END IF
LOOP
Crawl = -1
END FUNCTION

' Download html.
'   Returns 0 if started.
FUNCTION DownloadHtml& (URL$, URLFile$)
DownloadHtml& = URLDownloadToFileA%(0, URL$ + CHR$(0), URLFile$ + CHR$(0), 0, 0)
END FUNCTION

' Read .htm file and store inbedded links.
FUNCTION GetTags& (URL$)
TagsFound& = 0&
OPEN TempDir$ + URL$ FOR INPUT AS #1
DO WHILE EOF(1) = 0
    LINE INPUT #1, Html$
    V = INSTR(LCASE$(Html$), "<a href=")
    IF V THEN
        Html$ = MID$(Html$, V)
        V = INSTR(Html$, CHR$(34))
        IF V THEN
            Html$ = MID$(Html$, V + 1)
            V = INSTR(Html$, CHR$(34))
            IF V THEN
                Html$ = LEFT$(Html$, V - 1)
                Found = 0
                FOR Z! = 1! TO NumTags
                    IF HtmlTags(Z!) = Html$ THEN
                        Found = -1
                        EXIT FOR
                    END IF
                NEXT
                IF Found = 0 THEN
                    NumTags = NumTags + 1&
                    REDIM _PRESERVE HtmlTags(NumTags) AS STRING
                    HtmlTags(NumTags) = Html$
                    TagsFound = TagsFound + 1!
                END IF
            END IF
        END IF
    END IF
LOOP
CLOSE #1
GetTags& = TagsFound
END FUNCTION

' Read .htm file and store inbedded src.
FUNCTION GetSrc& (URL$)
SrcFound& = 0&
OPEN TempDir$ + URL$ FOR INPUT AS #1
DO WHILE EOF(1) = 0
    LINE INPUT #1, Html$
    V = INSTR(LCASE$(Html$), "src=")
    IF V THEN
        Html$ = MID$(Html$, V)
        V = INSTR(Html$, CHR$(34))
        IF V THEN
            Html$ = MID$(Html$, V + 1)
            V = INSTR(Html$, CHR$(34))
            IF V THEN
                Html$ = LEFT$(Html$, V - 1)
                Found = 0
                FOR Z! = 1! TO NumSrc
                    IF HtmlSrc(Z!) = Html$ THEN
                        Found = -1
                        EXIT FOR
                    END IF
                NEXT
                IF Found = 0 THEN
                    NumSrc = NumSrc + 1&
                    REDIM _PRESERVE HtmlSrc(NumSrc) AS STRING
                    HtmlSrc(NumSrc) = Html$
                    SrcFound = SrcFound + 1!
                END IF
            END IF
        END IF
    END IF
LOOP
CLOSE #1
GetSrc& = SrcFound
END FUNCTION

SUB TagList
COLOR 14
FOR Z! = 1! TO NumTags
    PRINT HtmlTags(Z!)
    C = C + 1
    IF C = 24 THEN
        C = 0
        COLOR 15
        LOCATE , , 1
        PRINT "-more-";
        WHILE INKEY$ = "": WEND: PRINT
    END IF
NEXT
IF C THEN
    COLOR 15
    LOCATE , , 1
    PRINT "-more-";
    WHILE INKEY$ = "": WEND: PRINT
END IF
END SUB

SUB SrcList
FOR Z! = 1! TO NumSrc
    COLOR 14
    PRINT HtmlSrc(Z!)
    C = C + 1
    IF C = 24 THEN
        C = 0
        COLOR 15
        LOCATE , , 1
        PRINT "-more-";
        WHILE INKEY$ = "": WEND: PRINT
    END IF
NEXT
IF C THEN
    COLOR 15
    LOCATE , , 1
    PRINT "-more-";
    WHILE INKEY$ = "": WEND: PRINT
END IF
END SUB

SUB Download (URL$)
FOR Z! = 1! TO NumSrc
    COLOR 14
    LOCATE , , 1
    PRINT Z!; ": "; URL$ + HtmlSrc(Z!)
    C = C + 1
    IF C = 24 THEN
        C = 0
        COLOR 15
        LOCATE , , 1
        PRINT "-more-";
        WHILE INKEY$ = "": WEND: PRINT
    END IF
NEXT
IF C THEN
    COLOR 15
    LOCATE , , 1
    PRINT "-more-";
    WHILE INKEY$ = "": WEND: PRINT
END IF
COLOR 14
LOCATE , , 1
PRINT "Enter src(1-" + LTRIM$(STR$(NumSrc)); ")";
INPUT T!
IF T! = 0 THEN EXIT SUB
IF T! >= 1 AND T! <= NumSrc THEN
    URLget$ = URL$ + HtmlSrc(T!)
    URLfile$ = HtmlSrc(T!)
    FOR V = LEN(URLfile$) TO 1 STEP -1
        IF MID$(URLfile$, V, 1) = "/" THEN
            URLfile$ = MID$(URLfile$, V + 1)
            EXIT FOR
        END IF
    NEXT
    URLfile$ = URLdload + URLfile$
    COLOR 15
    LOCATE , , 1
    PRINT "dload "; URLget$; " - "; URLfile$
    IF DownloadHtml&(URLget$, URLfile$) = 0& THEN
        PRINT "Download started."
    END IF
END IF
END SUB

SUB DownloadAll (URL$)
COLOR 14
LOCATE , , 1
PRINT "Download ALL. Are you sure(y/n)?";
DO
    _LIMIT 50
    LOCATE , , 1
    x$ = LCASE$(INKEY$)
    IF x$ = "n" THEN EXIT SUB
    IF x$ = "y" THEN EXIT DO
LOOP
FOR T! = 1! TO NumSrc
    URLget$ = URL$ + HtmlSrc(T!)
    URLfile$ = HtmlSrc(T!)
    FOR V = LEN(URLfile$) TO 1 STEP -1
        IF MID$(URLfile$, V, 1) = "/" THEN
            URLfile$ = MID$(URLfile$, V + 1)
            EXIT FOR
        END IF
    NEXT
    URLfile$ = URLdload + URLfile$
    COLOR 15
    LOCATE , , 1
    PRINT "dload "; URLget$; " - "; URLfile$
    IF DownloadHtml&(URLget$, URLfile$) = 0& THEN
        COLOR 14
        LOCATE , , 1
        PRINT "Download started."
    END IF
    _DELAY 1
NEXT
END SUB

8
QB64 Discussion / Re: Using DavsIDE for QB64 editor or Steves
« Last post by Mal-2 on October 16, 2017, 05:56:09 pm »
Compare stats on 2 editors that work for QB64 based on Scintilla:

Notepad++
20.7 MB, 48 Folders, 463 Files

Davs IDE
445 KB, 1 Folder, 3 files EXE, INI, TXT document.

Well Notepad++ is geared as General Editor that can be configured for many purposes and Davs IDE tailored for QB.

Personally I can't get too worked up over a 20 MB program. The game I'm trying to get into some sort of demonstrable shape by the end of the month already weighs in at 150 MB, mostly because of having 50 songs. The "source" for a two minute song is often around 100 MB, and the FLAC that is required by Bandcamp will come in at about 15 MB. There certainly was a time when I fastidiously cleaned out drive space. Now I just add a drive every few years, or upgrade one and move the still-working old drive to another purpose.
9
QB64 Discussion / Re: Using DavsIDE for QB64 editor or Steves
« Last post by bplus on October 16, 2017, 05:11:45 pm »
Hey RhoSigma!

Looks like good diet plan for my disk space. I should ask what you might have for humans...

I guess I have some unpacking yet to do, I had forgotten I put your QB stuff in there when I was downloading, extracting and moving... Yes, it was a full Install, recommended for those who don't know what they are doing.
10
Beginner's Help / Re: a graphic qwestion.
« Last post by bplus on October 16, 2017, 04:57:15 pm »
Ah deadlines, too well named, should call them lifelines if it's about survival.

OK good excuse but you might put learning subs and functions at top of your To Do List after all the survival stuff is done and you have some time left to live...

Can I help? I mean from my perspective it's like what's to learn (about subs and functions)?

A SUB is just like a GOSUB except all the variables are private to the main code AND you pass arguments to the SUB through the SUB's parameters listed in parenthesis next to the subName.

Lesson 1:

SUB subName(subParameter1, subParameter2, ...)
   'do normal code in here

   EXIT SUB 'if want to leave sub before reaching end sub

END SUB

In QB64 the arguments (variables with values assigned to parameters when the sub is actually called by main module) are passed "by reference" which means if they are changed in the sub, the changes will stick when you return to the main code module.
That's probably the most complicated part of subs and that is only because you are unfamiliar with the terms. Every other variable used in a sub is erased when you return back to the code that called the sub. (Unless you use STATIC or SHARE values between Main and Sub but this is scoping rules told in a later lesson.)

;) I can go on if anyone is interested...
Pages: [1] 2 3 ... 10