Browse Search Popular Register Upload Rules User list Login:
Search:
I need a bit of help...

Image:
screenshot of the scene

Author: CPJchute

Group: Default

Filesize: 31.37 kB

Date added: 2024-04-20

Rating: 6.1

Downloads: 396

Views: 89

Comments: 4

Ratings: 3

Times favored: 1

Made with: Algodoo v2.1.0

Tags:

Scene tag

I made a creative way to show the problem. But here's a summary of whats wrong(TL;DP):
I tried to make a program(made to render an image format i made) for the AHOX Basic PC's, but for some reason, when I try to run it with a test image, it outputs... nonsensical stuff. what am I doing wrong?(code in scene.)

unrelated thoughts of mine-------------------------------------------------------------------------------------------
<markup><i>Wait a minute... Can't I make level this FPPRG 2.0's first level?</i>
<b>I maybe can...
<i>yeah im gonna do it</i></b></markup>
Last edited at 2024/04/21 12:54:35 by CPJchute
Please log in to rate this scene
edit
Cool scene, though the controls are a bit w o n k y

Anyways after a bit of testing (ow my braincell :bonk: ), here's what I've found:
1. The width rendering part starts at 0. It shouldn't, as it reads directly from the file which the image data starts at offset 4

2. The width renderer overrendered image width by 1 char.

3. Renderer is very f a s t
(less than 10 seconds on my portable waffle grill (thingy) with an image width of 5 and height of 3 than the expected 640 seconds).

4. Every time a line is rendered, the reading is offsetted by img_height * p. Typically it should be true_width * p.

So here's the fixes:
1. Yeet the `let g=x+1` out, it causes the width renderer to overrender.
(Dont forget to replace `let n=n+g` to `let n=n+x`)

2. offset j by 4 (The easiest part is in the width rendering loop).

3. Remove the `let x=img_height*p` and replace with `let x=n*p` (below the `let n=img_width-4` of course)

So when all is said and done, the (fixed) piece of code should look like:
`
...
640 | for i=4 img_height
650 | let printt=""
660 | let p=i-4
670 | let n=img_width-4
680 | let x=n*p
690 | let n=n+x
700 | for j=x n
710 | let z=j+4
720 | if file(z)="0" then let printt=printt+" "
730 | if file(z)="1" then let printt=printt+"_"
740 | if file(z)="2" then let printt=printt+"/ "
750 | if file(z)="3" then let printt=printt+"3"
760 | if file(z)="4" then let printt=printt+"#"
770 | if file(z)="5" then let printt=printt+"@"
780 | end
790 | print printt
800 | end
...
`

Happy coding! :tup:
(Btw use another code editor like notepad++ if you're still having trouble with ascii chars)
Last edited at 2024/04/20 15:36:33 by Harraf
@Harraf Haven't tested the fix yet, but thanks!
Also, here's a downloader for a test .UIF:

let list=list("uifstandard", "beh", "5", "5", "4", "4", "4", "4", "4", "4", "0", "0", "0", "4", "4", "0", "5", "0", "4", "4", "0", "4", "4", "4", "4", "4", "4")
write list "testimg.uif"

Also, I thought that it would be that slow, because I thought the Ab computers ran at 30 Hz(which would mean... up to 20*pixel count frames)(yet i made it 10*pixel count SECONDS)(and that was hugely wrong math on my side)

Also, thanks for answering a question I had(but didnt ask why). When I tried rendering testimg.uif, the first three pixels were uhh "@@#" or on lines 3-5 of the image we got:
[Pixels -4 - -2: Other than 5, 4, 3, 2 or 1.]
Pixel -1: 5(img width)
Pixel 0: 5(img height)
Pixel 1(START RENDERING HERE...): 4
ERROR! ERROR! Turns out that something was wrong. When I inputted my image(testimg.uif), I expected:
#####
# #
# @ #
# #
#####
, but got:
#####
# #
# @ #
# ###
###
(Nevermind. Seems like I setted up testimg.uif incorrectly :l)
How do you use triggers?