|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1650 |
Random access of database files |
le 01/09/2009 @ 01:51 par Roman
|
The kind of animation found in the Neko Cat example only works if the background is a solid color. In light of this, I've decided to try to store pixel colors in an array so I can restore them after I draw a bitmap over them. Naturally, this requires hundreds of numbers to be stored first.
So, to get to the point, I am having trouble reading these numbers in out of a database. Here's my sample code:
OPEN "pix" FOR RANDOM AS #1 PRINT #1, 17 INPUT #1, A$ CLOSE #1 PRINT A$ KILL "pix"
This is trying to get 17 written in the database, copied to an array, and read out on the screen. I believe the INPUT function is the one I'm having trouble with. Filez shows the "pix" database gains a record (17), but all that is displayed is 0, or "", depending on whether the variable is A or A$.
Perhaps I've said too much :D |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 1 -------- le 01/09/2009 @ 15:42 par Roman
visiteur |
Well, the amateur has solved his own problem. The reason that A$ was only returning zero or nothing was because the record was blank... the last record that is, the one that A$ was being assigned to. To fix the problem, I amended it to the following:
PRINT #1, 17 SEEK #1, 1 'go to 1st record INPUT #1, A$ 'read current record
Before, I was reading a blank, end of file record. That's all, folks. |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 2 -------- le 01/09/2009 @ 21:57 par aldweb
visiteur |
Hello Roman,
I am not sure that your way of proceeding will be the most efficient one in terms of speed. Have you considered adding a background image, eventually by small squares, so that you would only redraw before drawing back your image on top of the background? Or you might also use the SAVESCREEN and RESTORESCREEN statements?
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 3 -------- le 01/09/2009 @ 22:06 par Roman
visiteur |
As it turns out, that is the route I'm going to need to take. I do like the idea of being able to transform the image's color though. |
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|