devicefuture / atto

The new BASIC computer that runs in your browser!
https://atto.devicefuture.org
MIT License
47 stars 8 forks source link

Can't use `renum` #44

Closed ghost closed 1 year ago

ghost commented 1 year ago

Even after a hard reset, when I try to use renum, it just highlights to the left side and prints a new line. I have no idea why. It doesn't happen with "help", "share" etc. After pressing shift, alt or etc. the cursor stops highlighting. Happened randomly. Possibly related to #43. atto devtools 7 (Also, some commands' descriptions in the "help" menu are mixed up, but I posted so many issues that I don't wanna post another one)

James-Livesey commented 1 year ago

Haha no worries, the more issues the better! Do you get any errors in DevTools for this one? Also what is the atto program you're trying to renum?

ghost commented 1 year ago

Yeah, I checked it before, but:

(126) caught ParsingSyntaxError: Expected operator at StringConcatExpression.parse (syntax.js:507:27) at syntax.js:337:39 at Array.map (<anonymous>) at Function.parse (syntax.js:337:26) at syntax.js:286:44 at Array.forEach (<anonymous>) at LeafExpression.parse (syntax.js:286:27) at syntax.js:301:40 at Array.forEach (<anonymous>) at LiteralNegationExpression.parse (syntax.js:301:23)

...doesn't seem to do something with it. I tried to make a new tab for checking it without any unwanted errors and renum... Worked here for some reason. What is really weird, is that:

but

ghost commented 1 year ago

I tried doing a hard reset, renum still doesnt work and I realized that this error message is actually probably related to that because it happened right after I tried to use renum. atto devtools 8

ghost commented 1 year ago

Link to that unfinished code (it's just a test and doesn't work right now): https://atto.devicefuture.org/?code=5%20img_cursor%3D%22100000000000%2C110000000000%2C101000000000%2C100100000000%2C100010000000%2C100001000000%2C100000100000%2C100000010000%2C100000001000%2C100000000100%2C100000000010%2C100000011111%2C100010010000%2C100110010000%2C101001001000%2C110001001000%2C100000100100%2C000000100100%2C000000010010%2C000000010010%2C000000001100%22%0A10%20turn%0A20%20cls%0A30%20for%20y%3D100%20to%20200%0A40%20for%20x%3D100%20to%20200%0A50%20fg%20%22rgb%22%2C(x-100)%2F100*128%2C(sin((y-100-25%2F4)%2F25)%2B1)*64%2C64%3Aplot%20x%2Cy%0A60%20next%0A70%20next%0A80%20for%20y%3D150%20to%20171%0A90%20for%20x%3D150%20to%20162%0A100%20if%20mid%24(split(img_cursor%2C%22%2C%22)%5By%5D%2Cx%2Cx)%0A105%20fg%20%22rgb%22%2C255%2C255%2C255%3Aelse%3Afg%20%22rgb%22%2C255%2C0%2C0%2Crandom%2F4%2B0.25%3Aend%0A110%20plot%20x%2Cy%0A120%20next%0A130%20next%0A1000%20bg%3Afg

ghost commented 1 year ago

Tried deleting a single letter but renum still doesn't work. Code's contents probably have to do something with it.

James-Livesey commented 1 year ago

Okay, so renum only works when the code has valid syntax, and I've just fixed the code so that the syntax error is shown when renum doesn't work.

For your program, atto only allows the [] syntax after variable names (hence the Expected operator error which wants something like + after the ) of split), so you'll need to edit your code to be like this:

99 pixels=split(img_cursor,",")
100 if mid$(pixels[y],x,x)

I think I can see where you're going with this program — I might consider adding some more graphics commands to atto to let you load and draw images to the screen quicker than using for and plot in atto!