Page 1 of 1

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

Posted: Fri May 06, 2016 11:19 pm
by ScottBeebiWan
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.

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

Posted: Tue May 10, 2016 3:42 pm
by burger2227
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