Am I being stupid or not? (Illegal Function on GET)

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

User avatar
ScottBeebiWan
Newbie
Posts: 1
Joined: Fri May 06, 2016 11:10 pm

Am I being stupid or not? (Illegal Function on GET)

Postby ScottBeebiWan » Fri May 06, 2016 11:19 pm

Sorry, but I'm not completely sure what the problem is.
So, here's the error:

Code: Select all

Illegal function call
*highlights line #17*

here's the QB version:

Code: Select all

MS-DOS QBasic
Version 1.1
Copyright (C) Microsoft Corporation, 1987-1992.

and, here's the code:

Code: Select all

SCREEN 1
CLS
FOR y = 1 TO 5
FOR x = 1 TO 36
READ z
PSET (x - 1, y - 1), z
NEXT
NEXT
DATA 3,3,3,0,0,0,3,0,0,3,3,0,0,0,0,3,3,3,0,3,0,3,3,3,3,0,0,3,3,0,0,0,0,0,0,0
DATA 0,3,0,3,0,3,0,3,0,3,0,3,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0
DATA 0,3,3,0,0,3,3,3,0,3,0,3,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,3,0,0,0,0,0,0,0
DATA 0,3,0,3,0,3,0,3,0,3,0,3,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0
DATA 3,3,3,0,0,3,0,3,0,3,3,0,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,3,0,3,0,3,0,3,0
DIM bad3%(37)
DIM bad2%(37)
DIM bad1%(37)
GET (0, 0)-(5, 36), bad3%
FOR y = 1 TO 5
FOR x = 1 TO 36
READ z
IF z = 3 THEN
z = 2
END IF
PSET (x - 1, y - 1), z
NEXT
NEXT
GET (0, 0)-(5, 36), bad2%
FOR y = 1 TO 5
FOR x = 1 TO 36
READ z
IF z = 3 THEN
z = 1
END IF
PSET (x - 1, y - 1), z
NEXT
NEXT
GET (0, 0)-(5, 36), bad1%
CLS
PUT (0, 0), bad1%
PUT (0, 37), bad2%
PUT (0, 37 * 2), bad3%

And if you would like to know my intentions, I'm trying to make a amateur *air quotes* screen saver.

User avatar
burger2227
Veteran
Posts: 2144
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: Am I being stupid or not? (Illegal Function on GET)

Postby burger2227 » Tue May 10, 2016 3:42 pm

When the DATA runs out you can RESTORE for next READ.

Code: Select all

SCREEN 1
CLS
FOR y = 1 TO 5
    FOR x = 1 TO 36
        READ z
        PSET (x - 1, y - 1), z
    NEXT
NEXT
Datafield:
DATA 3,3,3,0,0,0,3,0,0,3,3,0,0,0,0,3,3,3,0,3,0,3,3,3,3,0,0,3,3,0,0,0,0,0,0,0
DATA 0,3,0,3,0,3,0,3,0,3,0,3,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0
DATA 0,3,3,0,0,3,3,3,0,3,0,3,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,3,0,0,0,0,0,0,0
DATA 0,3,0,3,0,3,0,3,0,3,0,3,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,0,0,0,0,0,0,0,0
DATA 3,3,3,0,0,3,0,3,0,3,3,0,0,0,0,0,3,0,0,3,0,3,0,3,0,3,0,3,3,0,3,0,3,0,3,0
SLEEP
DIM bad3%(4 * 37)  'approx array size is same as dimensions
DIM bad2%(4 * 37)
DIM bad1%(4 * 37)
GET (0, 0)-(36, 4), bad3%(0)  'GET 36 columns by 4 rows high
RESTORE Datafield
FOR y = 1 TO 5
    FOR x = 1 TO 36
        READ z
        IF z = 3 THEN z = 2
        PSET (x - 1, y - 1), z
    NEXT
NEXT
GET (0, 0)-(36, 4), bad2%(0)
SLEEP
RESTORE Datafield
FOR y = 1 TO 5
    FOR x = 1 TO 36
        READ z
        IF z = 3 THEN z = 1
        PSET (x - 1, y - 1), z
    NEXT
NEXT
GET (0, 0)-(36, 4), bad1%(0)
SLEEP
CLS
PUT (0, 0), bad1%(0)  'PUT each array image below previous
SLEEP
PUT (0, 5), bad2%(0)
SLEEP
PUT (0, 10), bad3%(0)


QB64 would need _FULLSCREEN to see properly
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : http://www.QB64.NET
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0


Return to “QBASIC and QB64 Questions & Answers”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests