|
Post by rosy on Oct 29, 2021 14:51:10 GMT -6
Error in For Next in line 26-36
code 139
Attachments:ROKART2.bas (14.45 KB)
|
|
|
Post by n00b on Oct 29, 2021 16:42:19 GMT -6
On line 553 you are causing a memory leak. Your Kolmap[] array is 512x512 but you end up trying to write to index [594, 280].
|
|
|
Post by rosy on Oct 30, 2021 3:06:56 GMT -6
1. Usually the program doesn't get there. As I wrote - the error is initially in the for loop. The music on the next line is not running anymore. 2. Reading alone may cause an error?
Strange ... I started Windows today and the error has stopped showing. But there is still this bug in Linux. Even as in FORs it will change 511 to 111. Just in case, I updated the file ...
|
|
|
Post by n00b on Oct 30, 2021 7:06:02 GMT -6
1. I tried it with a music file on my computer and it played fine.
2. That memory leak on line 553 is still happening. I don't know what its suppose to do but the way it is now will always cause a memory leak.
|
|
|
Post by rosy on Oct 30, 2021 7:19:16 GMT -6
But in fact ... How to remove +144 there is no error ...
Finally, RCBasic signals that the table has been exceeded or not?
|
|
|
Post by n00b on Oct 30, 2021 7:30:25 GMT -6
y[0] is also an error. It eventually becomes negative.
|
|
|
Post by rosy on Oct 30, 2021 8:41:16 GMT -6
He's not telling me that. So nothing has changed, messages are displayed "randomly". I have a problem with that in EVERY game ...
|
|
|
Post by n00b on Oct 30, 2021 8:58:05 GMT -6
He's not telling me that. So nothing has changed, messages are displayed "randomly". I have a problem with that in EVERY game ... If you have been having a problem with this in every game then you might want to think about what you are doing to cause these errors and maybe ask for help in the "Need Help" section.
|
|
|
Post by rosy on Oct 30, 2021 10:12:18 GMT -6
Each time I wonder. It takes an average of 1 day, the problem is solved. And in the next game, I have a problem with crossing the array again and the situation repeats ... There would be no problems if RCBasic signaled an array violation. Now I have another problem, this time I think actually with GetPixel. I have updated the file. Now it displays the track first, then the collision map, after pressing a key the game starts. It's just that the collision map is wrong, it is made of an image from an immediate start of the game. The correct map is created when in line 43, between NEXTs, we enter UPDATE. Sparky Linux. I have not tested in Win.
It looks like adding a second update on line 28 also helps.
|
|
|
Post by rosy on Oct 31, 2021 7:22:33 GMT -6
In Windows, 1 UPDATE is enough, but GETPIXEL is terribly long ...
|
|
|
Post by n00b on Nov 1, 2021 6:20:25 GMT -6
That is because RCBasic uses hardware accelerated rendering. GetPixel has to download the pixel data from VRAM which is slow. Its why I have suggested it not be used for performance critical task.
|
|
|
Post by rosy on Nov 1, 2021 15:17:47 GMT -6
Which does not change the fact that working under Linux is incorrect.
|
|
J7M
New Member
Posts: 18
|
Post by J7M on Nov 1, 2021 15:51:09 GMT -6
Line 15: CanvasOpen(1, 512, 512, 144, 0, 512, 512, 0) ' tor
Maybe I'm wrong. But you open a canvas with 512x512px. Inside this canvas you want to define a viewport which is 512x512px but it starts at x=144. This means that parts of the viewport are outside the canvas. Maybe here you get some trouble.
line 29: c=GetPixel(a+144,b)
you are still operating on the canvas you have defined in line 15. Variable "a" can be max. 511. This means, that you are trying to get a pixel outside the defined canvas (pixel at position 655). Maybe here you get some problems, too.
|
|
|
Post by rosy on Nov 1, 2021 18:02:12 GMT -6
Not. It's good. The window is bigger, the canvas is smaller. GetPixel reads from entire window. Did you understand what I wrote? The error disappears when you use Update 2 times.
|
|