Log In  

i have 2 carts for this, only one is runnable the other has an error

so, i started with this code;

m={pl=4,ll=4,sl=1,px={30,30,50,50},py={30,50,30,50}}
s=1

function _update()
    cls()
    repeat
        spr(1,m.px[s]-2,m.py[s]-2)
        s+=1
    until s==m.pl+1
    print(s,1,122)
end

it should make 4 sprites at each point with a -2 condition to make the sprite not offset.

but instead,

ok, the first thing i notice...

feild "?"
huh?

so, apparently this is pico-8ʻs way of saying "haha, you stupid, your code suck"(no offence, ZEP, im sorry if you find that, or anything else offensive) EVEN THOUGH IF YOU SEARCH THE CODE FOR THE "?", YOU GET 0 [redacted] RESULTS!

sorry, just needed to get that out of my system.

so, i started to change the code, eventualy i found out, that by uncorrecting the sprite, i can make it work, almost!

Cart #suzigujuwa-0 | 2023-06-16 | Code ▽ | Embed ▽ | No License

no, that would be too easy, if you play that cart, an extra 5th point appears after a little bit, IN A CART THAT PRINTS WITH NO IF CONDITIONS!!!

how do i fix this stupid, bug? or is it not the code? mabye its zeps code?

p.s: i tried to do light editing from my original draft, so i still express my anger, so, again, if you find any of this rude or offensive, im sorry.

P#131010 2023-06-16 12:31

I'm not entirely sure what you're trying to do. If you just want it to go through the tables once, then it shouldn't be in an _update function.

Right now, what's causing the error is s growing too big. It starts at 1 then goes up by at least 1 each update, then causes the error when it hits 6.

The "?" is just saying that the debugger couldn't automatically detect which field the nil came from. I would recommend not interpreting debugging output as a personal insult, as that will always be missing the point.

P#131011 2023-06-16 12:40

The problem is that you don't reset s to 1 prior to the repeat loop in your update. So it runs once, ends when s==5, then the next frame, _update runs again, s is 5 and so m.px[5] returns nil and attempting the -2 throws an error. You might assume the loop would be skipped since s==5, but a repeat loop always executes at least once.

P#131027 2023-06-16 13:46

[Please log in to post a comment]