Qbasicnews.com

Full Version: everything crashes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
apparently, i cant fucking code anything in any language without everything crashing

i try to use the stupid multikey library i downloaded and it crashes... it didnt before... wtf happened?

ok fine, moving on... i try to use BLOAD/BSAVE/GET/PUT and it fucking still crashes... thats just stupidly retarded.

im taking a goddamn break
let me see your code. i can't really do anything without it, as that library works in most situations.
forget about the key program for now, its experimental... what im most concerned about is why after 2 times of running this program, if i run it once more, it closes Qbasic altogether with no warnnig!

Code:
DECLARE SUB SaveImage (x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER, file AS STRING)
DECLARE SUB LoadImage (dimx AS INTEGER, dimy AS INTEGER, file AS STRING, image() AS INTEGER)

DIM image(0) AS INTEGER

SCREEN 13
CALL LoadImage(16, 20, "image1.put", image())

SLEEP

FOR x = 0 TO 19
    FOR y = 0 TO 9
        PUT (x * 16, y * 20), image, PSET
    NEXT y
NEXT x

SLEEP

SUB LoadImage (dimx AS INTEGER, dimy AS INTEGER, file AS STRING, image() AS INTEGER)
    DEF SEG = VARSEG(image(0))
    BLOAD file, VARPTR(image(0))
    DEF SEG
END SUB

SUB SaveImage (x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER, file AS STRING)
    xl = (x2 - x1) + 1
    yl = (y2 - y1) + 1
    d = ((xl * yl) + 4)
    DIM a(d \ 2 - 1) AS INTEGER
    GET (x1, y1)-(x2, y2), a
    DEF SEG = VARSEG(a(0))
    BSAVE file, VARPTR(a(0)), d
    DEF SEG
END SUB

where "image1.put" is a valid .put file of 16x20 res
you need more subscripts in your image() array. 2 bytes ain't gonna hold a 16x20 sprite. Use DIM image(161).

(16 x 20 / 2 + 2 - 1)
+2-1? Why not +1?

...heh ^_^"
yeah, i'd say it's the dimming. instead, use dynamic arrays and redim them to the size you need.
Hell yeah I fixed the multikey and the putting and it works excellingly perfect.

IMPORTANT: I need some sort of equation that uses TIMER that will give me 0 and 1 every other 1/4th of a second.

So that within 1 whole second it will do this:

0, 1, 0, 1

I tried TIMER MOD 2 but that just gives me 0 and 1 every whole second.
This is not a real "formula" or equation, but you can play with it and make it usable (I've not been able to set up a formula, that's the truth). Anyhow, this works:

Code:
t! = TIMER
flag% = 0

DO

   IF TIMER - t! >= .25 THEN flag% = NOT flag%: t! = TIMER
   LOCATE 12, 40: PRINT ABS(flag%)

LOOP WHILE INKEY$ = ""

Just use ABS(flag%). It will be change from 0 to 1 each quarter of a second. Cheers Smile
16 * 20 / 2 + 2

just gives the necessary minimum number of array elements. In a zero-based array, a maximum array index of 1 less than that will give an array with that many elements.


Quote:+2-1? Why not +1?

...heh ^_^"